Skip to content

fix: recognize bun.lock and npm-shrinkwrap.json in the git-diff lockfile signal - #64

Merged
adityankale190895 merged 2 commits into
DiffCI:mainfrom
bfs2021:fix/lockfile-bun-shrinkwrap
Oct 30, 2026
Merged

adityankale190895 merged 2 commits into
DiffCI:mainfrom
bfs2021:fix/lockfile-bun-shrinkwrap

Conversation

@bfs2021

@bfs2021 bfs2021 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Problem

computeAnalysis in src/git/git-diff.ts reports which changed files are lockfiles, and that signal is one of the reasons a replay falls back to the full suite. Its inline regex matched package-lock.json, yarn.lock, pnpm-lock.yaml and bun.lockb, but not Bun's text lockfile bun.lock nor npm's npm-shrinkwrap.json — even though the planner's own lockfile checks (src/planner/check-narrowing.ts, src/repo/analyzer.ts) already treat both as lockfiles. A change to either file alone therefore still forced the full suite.

Fixes #47

Root cause

Four copies of the lockfile regex had drifted apart. The planner carried three identical LOCKFILE constants (check-narrowing.ts:55, script-reads.ts:36, type-program.ts:28) matching bun.lock (via bun\.lockb?) and npm-shrinkwrap.json, while git-diff.ts computed its lockfile signalPath from a fourth, older inline copy that knew neither name.

Fix

  • Add src/repo/lockfiles.ts exporting the single LOCKFILE constant (the planner form: package-lock.json, npm-shrinkwrap.json, pnpm-lock.yaml, yarn.lock, bun.lock/bun.lockb).
  • src/git/git-diff.ts now imports it instead of its inline regex, so the git-diff signal recognizes both names.
  • The three planner copies are deleted in favor of the same import, so the four call sites can no longer drift.
  • Registered the new file in release-files.json so npm run audit:boundary stays green.

No existing behavior narrows beyond the two names the issue asks for: the shared constant is exactly the union of the previous planner and git-diff regexes.

Testing

  • Added two cases to tests/git/git-diff.analysis.test.ts, one per newly recognized name; both fail against main and pass with the fix.
  • npm run typecheck — passes.
  • npm test — 524 pass; the 2 remaining failures are in tests/cli-failure-baseline.test.ts (compareWithBaseline), which fail identically on unmodified main at ceaefd7 and are unrelated to this change.
  • npm run build — passes.
  • npm run audit:boundary — passes (221 reviewed files, closed Core imports).

…ile signal

computeAnalysis's inline lockfile regex knew bun.lockb but not Bun's text
lockfile bun.lock, and not npm's npm-shrinkwrap.json, so a change to either
file alone still forced the full suite. The planner's three LOCKFILE copies
(check-narrowing.ts, script-reads.ts, type-program.ts) already matched both.

Share one LOCKFILE constant in src/repo/lockfiles.ts across the git-diff
signal and the three planner copies, and add a git-diff analysis test case
for each newly recognized name (issue DiffCI#47).

Fixes DiffCI#47

Signed-off-by: bfs2021 <[email protected]>
Resolve the git-diff.ts import conflict with the Yarn Classic lockfile
work (DiffCI#63), and switch its nested-lockfile check to the shared LOCKFILE
pattern so no inline copy of the regex remains in git-diff.ts.

Signed-off-by: adityankale190895 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@adityankale190895
adityankale190895 merged commit 2d5cc05 into DiffCI:main Oct 30, 2026
7 checks passed
@adityankale190895

Copy link
Copy Markdown
Member

Merged — thanks @bfs2021, and welcome as a DiffCI contributor! Fixing #47 and folding the four copies of the regex into one constant was exactly right.

Heads-up: #63 landed first and conflicted with this PR in git-diff.ts, so I pushed a merge of main to your branch. It keeps both imports and switches the new Yarn check to your LOCKFILE constant. CI passed on it before merging.

If you'd like another one, #48 (treat more package.json fields as data) is a good next issue.

adityankale190895 added a commit that referenced this pull request Oct 30, 2026
Bundles Core 0b82acb. verify no longer refuses a verdict when the run
only writes new files (such as __pycache__ from a repository's own
tests): those are listed as written during verification, while edits to
existing files or a moved HEAD still block and are now named. Replaying
28 previously blocked DentalPresence commits on Cloudflare gave 0
blocked. Also includes Yarn Classic lockfile attribution (#63) and
bun.lock / npm-shrinkwrap.json detection (#64). Records the Muse
marketplace digest for the 0.3.19 package tree (pinned Muse
1.4.11-R6667.1, LF archive; the same method reproduces 0.3.18's).

Also lists packages/diffci-cli/tests/client/verify-snapshot.test.ts in
release-files.json: 0b82acb added it without an entry, so Core CI's
boundary audit was failing on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityankale190895 <[email protected]>
@adityankale190895

Copy link
Copy Markdown
Member

@bfs2021 thanks for #64. Bun and shrinkwrap repositories get the right lockfile signal because of it. If DiffCI has been useful to you, a ⭐ on the repo helps others find it. No pressure either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lockfile signal misses bun.lock and npm-shrinkwrap.json

2 participants