Skip to content

feat: detect Yarn Classic lockfile dependency changes - #63

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
KingEmma7:fix/yarn-v1-lockfile-detection
Oct 30, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
KingEmma7:fix/yarn-v1-lockfile-detection

Conversation

@KingEmma7

Copy link
Copy Markdown
Contributor

Root yarn.lock edits currently force a full run. This adds conservative selection for a supported Yarn Classic v1 registry format. Since Classic omits peer relationships and hoisting information, any semantic change treats every old/new root dependency as potentially affected, then selects its importers. Raw lockfile readers are also covered, including for formatting-only changes.

Exact manifest requests and lockfile edges must resolve. Berry, workspaces, mixed package managers, unsupported or malformed input, undeclared imports, untraceable tooling and unresolved readers retain full fallback. No dependencies were added. Selection remains advisory; required CI stays authoritative.

Synthetic regression fixtures cover direct and transitive changes, grouped/scoped selectors, manifest disagreement, unsupported inputs and raw readers. A host-only bump selects both the host and its failing peer consumer, while skipping an unrelated test. The regression fails on the upstream integration and passes with this patch.

Validation on macOS with Node 24.9.0: npm ci, npm run typecheck, npm test (590 tests), npm run build and npm run audit:boundary passed. The built CLI's selected tests reproduce the peer-consumer failure. Hosted CI and Windows have not run; fixtures construct installed packages locally without running Yarn.

Implementation and review were assisted by Codex. All fixtures are synthetic.

Refs #50.

@adityankale190895

Copy link
Copy Markdown
Member

Thanks @KingEmma7, this is a really careful first PR. You claimed the issue, scoped it to Classic v1 and did what you said you would. I especially like that it runs the full suite by default (Berry, workspaces, mixed package managers, .yarnrc / PnP, malformed input), and that undeclared imports of hoisted packages also trigger a full run. That's the right conservative call. Thanks for disclosing the Codex assistance too.

CI (including Windows) is waiting on maintainer approval for first-time contributors; I'll approve it so it runs here. A few things before a deeper review:

  1. Lockfile regex: fix: recognize bun.lock and npm-shrinkwrap.json in the git-diff lockfile signal #64 (fixing Lockfile signal misses bun.lock and npm-shrinkwrap.json #47) merges the four copies of the lockfile regex into src/repo/lockfiles.ts. The otherConfiguration check in git-diff.ts adds another inline copy. Once fix: recognize bun.lock and npm-shrinkwrap.json in the git-diff lockfile signal #64 lands, could you rebase and use the shared helper? release-files.json will probably conflict too.
  2. allowNoReaders in file-references.ts: this changes the general reference resolver, not just lockfile handling. Could you add a test showing that existing data-file behaviour is unchanged when the flag is off?
  3. unsupportedLayout probe: it reads 9 paths at both SHAs, which is up to 18 git show calls on every yarn.lock change. Could you check the repository inventory first and only read files that exist?
  4. Size: at +822 lines this will take me a few days to review properly. If it's easy to split, the parser (yarn-lockfile.ts and its tests) could go in a first PR and the git-diff / impact wiring in a second. Not required, but it would help.

Great work, and welcome to DiffCI!

@adityankale190895
adityankale190895 merged commit 849fc5a into DiffCI:main Oct 30, 2026
7 checks passed
adityankale190895 added a commit to bfs2021/core that referenced this pull request Oct 30, 2026
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

Copy link
Copy Markdown
Member

Merged — thanks again @KingEmma7, and welcome aboard as a DiffCI contributor!

I merged this ahead of the review points above, so please treat them as follow-ups rather than blockers:

  • Lockfile regex: already done. The otherConfiguration check now uses the shared LOCKFILE constant, which I changed while merging main into fix: recognize bun.lock and npm-shrinkwrap.json in the git-diff lockfile signal #64.
  • allowNoReaders: a test showing the general data-file path behaves the same when the flag is off would be the most valuable follow-up.
  • unsupportedLayout probe: check the repository inventory before reading, so a yarn.lock change doesn't cost up to 18 git show calls.
  • Splitting the PR: no longer relevant.

If you're up for more, #49 (pnpm lockfile) is the natural next step after this work. It's the same pattern for a different lockfile format.

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]>
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.

2 participants