name: "precommit-release-gates" description: "How to harden pre-commit against release-only failures, especially packaging mismatches" domain: "release-management" confidence: "high" source: "earned"
Context
Use this when a release workflow fails even though local builds or lighter smoke checks were green.
Patterns
- Reproduce the failure with the exact release command first (for VS Code extensions,
npm run package, not justnpm installornpm run compile). - Promote that exact release command into
scripts/pre-commit.ps1if the failure is deterministic and commit-blocking. - Keep hook documentation synchronized with the real script; stale check lists are a docs bug.
- If the failure is a manifest or metadata mismatch, align the authoritative config files together (for example
package.jsonandpackage-lock.json).
Examples
vscode-extension/package.jsonandvscode-extension/package-lock.jsonboth movedengines.vscodeto^1.110.0to match@types/vscode ^1.110.0.scripts/pre-commit.ps1now runs the samenpm run packagepath that release uses.
Anti-Patterns
- Assuming install or compile coverage proves the package is releasable.
- Updating the hook without updating docs that enumerate its gates.
- Fixing the symptom in one manifest file while leaving the lockfile or related metadata stale.