Repository navigation
Conversation
`flake.nix` pins `npmDepsHash` over packages/vscode/package-lock.json, because buildNpmPackage hashes the vendored dependency tree. Dependabot updates the lockfile and has no way to know a Nix expression hashes it, so every npm bump to that package landed red on a fixed-output mismatch and sat there until somebody recomputed the hash by hand. That is #2109, #2202 and #2243, and both currently open dependabot PRs (#2269, #2272). `build` requires that job, so none of them could ever merge unattended. There was no tooling for it: nothing in .github, scripts or the justfile mentioned prefetch-npm-deps. The repair was folklore. Adds a workflow that recomputes the hash on any pull request touching the lockfile and commits it to the branch. It is deliberately separate from the `VS Code Extension (Nix)` job: that job verifies, this one repairs, and a verifier that silently rewrites what it is checking is worse than one that fails. It cannot push to a fork, so it always writes the correct value to the job summary as well. A contributor whose PR it cannot fix still gets the exact line to change instead of a bare Nix hash mismatch. The push is self-terminating: it only commits when the computed hash differs, so the run it triggers finds a match and stops. Also adds `just nix-refresh-vscode-hash` for the same repair locally, and documents both in CONTRIBUTING. Verified rather than assumed: the recipe reports "already correct" on main, and when flake.nix is corrupted it repairs the value and restores the file byte-identically. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| # Check out the PR branch itself rather than the merge commit, so a | ||
| # push goes back to the contributor's branch. | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
|
|
||
| - uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1 |
|
Superseded by #2284. The branch used a |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🟡 Changes recommended
The new local recipe is not portable to macOS due to sed -i usage and both the recipe/workflow suppress stderr, making failures unnecessarily hard to diagnose.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds automation and developer tooling to keep flake.nix’s pinned npmDepsHash synchronized with packages/vscode/package-lock.json, preventing routine VS Code extension dependency bumps (notably Dependabot PRs) from failing Nix builds due to fixed-output hash mismatches.
Changes:
- Adds a dedicated GitHub Actions workflow that recomputes
npmDepsHashon relevant PRs and pushes an updatedflake.nixwhen possible (or reports the correct value in the job summary for forks). - Adds a local
just nix-refresh-vscode-hashrecipe to refresh the pinned hash manually. - Documents the workflow and manual fix procedure in
CONTRIBUTING.md.
File summaries
| File | Description |
|---|---|
justfile |
Adds a local just recipe to recompute and rewrite npmDepsHash in flake.nix. |
CONTRIBUTING.md |
Documents why npmDepsHash goes stale and how CI/manual repair works. |
.github/workflows/vscode-npm-deps-hash.yml |
New workflow to recompute and (when allowed) commit refreshed npmDepsHash back to PR branches. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| computed=$(nix shell nixpkgs#prefetch-npm-deps \ | ||
| -c prefetch-npm-deps packages/vscode/package-lock.json 2>/dev/null | tail -1) |
| computed=$(nix shell nixpkgs#prefetch-npm-deps \ | ||
| -c prefetch-npm-deps packages/vscode/package-lock.json 2>/dev/null | tail -1) | ||
| case "$computed" in | ||
| sha256-*) ;; | ||
| *) echo "prefetch-npm-deps produced no hash: '$computed'" >&2; exit 1 ;; | ||
| esac |
| sed -i "s|npmDepsHash = \"[^\"]*\"|npmDepsHash = \"$computed\"|" flake.nix | ||
| grep -q "npmDepsHash = \"$computed\"" flake.nix |
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
flake.nixpinsnpmDepsHashoverpackages/vscode/package-lock.json, becausebuildNpmPackagehashes the vendored dependency tree. Dependabot updates the lockfile and has no way to know a Nix expression hashes it, so every npm bump to that package lands red:That is #2109, #2202, #2243, and both dependabot PRs open right now (#2269, #2272).
buildrequires theVS Code Extension (Nix)job, so none of them can merge unattended.There was no tooling for it. Nothing in
.github/,scripts/, or the justfile mentionedprefetch-npm-deps. The repair was folklore, which is why it recurred rather than got handled.What this adds
A workflow that recomputes the hash on any PR touching the lockfile and commits it to the branch.
It is deliberately separate from the
VS Code Extension (Nix)job. That job verifies; this one repairs. A verifier that silently rewrites the thing it is checking is worse than one that fails.It handles forks. It cannot push to a fork branch, so it always writes the correct value to the job summary regardless:
A contributor whose PR it cannot fix still gets the exact line to change, instead of a bare Nix hash mismatch.
The push is self-terminating. It only commits when the computed hash differs, so the run that push triggers finds a match and stops. No loop.
A local recipe,
just nix-refresh-vscode-hash, plus a CONTRIBUTING section explaining why the failure happens at all.Verification
I verified the command before writing a workflow around it, and verified the recipe both ways rather than only the happy path:
A repair tool that only ever reports "already correct" would be indistinguishable from one that does nothing.
Note
This does not fix #2269 or #2272 themselves — they were opened before the workflow existed. Once this merges, closing and reopening them (or any rerun) will pick it up. Worth knowing that they interfere: each changes the lockfile, so whichever merges first invalidates the other's hash, and the second needs a fresh run.