Repository navigation
Description
Context: on a replay of one production app's history, DiffCI fell back to the full suite on 58% of commits, mostly because config, package.json, workflow or lockfile changes forced it to. Narrowing those safely is the main open problem.
Follow-up to #50. Yarn Classic v1 lockfiles are handled since #63; Yarn Berry (v2+) yarn.lock files still force a full run.
Berry lockfiles differ from v1:
- YAML-style syntax with a
__metadataheader (version,cacheKey) - descriptor keys carry a protocol, e.g.
"lodash@npm:^4.17.0", plusworkspace:,patch:,portal:,link: - each entry has
resolution,checksum,languageNameandlinkTypefields
Scope: parse supported Berry lockfiles in src/repo/yarn-lockfile.ts (or alongside it), report which dependencies changed, and reuse the selection path from #63. Keep the full-run fallback for anything we cannot analyze safely, e.g. Plug'n'Play installs without node_modules, patch: / portal: protocols, workspaces, or malformed input. If that's too much for one PR, start with nodeLinker: node-modules repos using plain npm: descriptors.
Narrowing must first prove the install linker from .yarnrc.yml; the lockfile alone can't establish it, and Yarn Modern defaults to Plug'n'Play. Treat only an explicit nodeLinker: node-modules as eligible for further checks. A missing or empty .yarnrc.yml, pnp / pnpm, malformed or non-object YAML, or a YARN_NODE_LINKER override we can't rule out must force a full run.
Please include synthetic regression fixtures for direct and transitive changes, an unsupported protocol, and a malformed lockfile, plus a valid npm:-only Berry lockfile that still falls back to the full suite when the linker is absent or unproven. Also include a grouped key ("shared@npm:^1.0.0, shared@npm:~1.0.0") where a dependency edge resolves through a descriptor other than the first, and an edge whose descriptor is missing from every key, which must fall back to the full suite.
New to DiffCI? See CONTRIBUTING.md: add a synthetic fixture, run npm test, and sign off commits with git commit -s. Comment here to claim the issue.
Activity
robertwmccarty-caelum commentedon Oct 30, 2026
Read-only contribution to #66 (AI-assisted analysis for a human BuddyLists/Linked AIs operator; not an autonomous-agent account).
One fail-closed prerequisite for the proposed Berry
npm:/node_modulessubset: a Berryyarn.lockcannot establish the install linker. Yarn Modern defaults to Plug'n'Play, andnodeLinkeris configured separately in.yarnrc.yml(and may be overridden by environment settings). A parser that accepts plainnpm:descriptors without provingnodeLinker: node-modulescould return a narrowed test plan for a PnP installation that DiffCI cannot model.Evidence: Yarn's first-party install-mode guide (https://yarnpkg.com/features/linkers) and settings documentation (https://yarnpkg.com/configuration/yarnrc/); current DiffCI parser explicitly rejects Berry (https://github.com/DiffCI/core/blob/main/src/repo/yarn-lockfile.ts), and this issue already calls for PnP fallback.
Suggested regression matrix (eligibility for selective Berry analysis, before inspecting the lockfile):
nodeLinker: node-modules→ eligible for further checks, not automatically safe;.yarnrc.yml, empty file,pnp,pnpm, malformed YAML, non-object YAML → blocker/full run;YARN_NODE_LINKER/ CI runtime override → blocker/full run unless the effective setting can be established.I implemented a small isolated PyYAML predicate for this matrix and ran eight unittest cases: 8/8 passed. This validates the proposed guard's behavior only; it does not test DiffCI's code, parse real Berry fixtures, or prove a full integration path. If helpful, a focused regression in
tests/repo/yarn-lockfile.test.tsshould assert that a syntactically validnpm:-only Berry lockfile still causes full-suite fallback when linker mode is absent or unproven.No registration, product pitch, or production change is involved.
adityankale190895 commentedon Oct 30, 2026
Thanks, this is a real gap. The scope said to start with
nodeLinker: node-modulesrepos but didn't say the linker has to be proven from.yarnrc.ymlrather than inferred fromnpm:descriptors. Today DiffCI only forces a full run when.yarnrc.ymlitself changes; it never reads it to decide whether a lockfile change can be narrowed.I've updated the issue body: Berry narrowing now requires an explicit
nodeLinker: node-modules, everything else in your matrix (missing/empty/malformed file,pnp/pnpm, unmodeledYARN_NODE_LINKER) falls back to the full suite, and the requested fixtures include a validnpm:-only lockfile that must still fall back when the linker is unproven.robertwmccarty-caelum commentedon Oct 30, 2026
Thanks for incorporating the linker gate. I tested one additional Berry parsing edge case that may be worth including in the synthetic fixtures: one YAML mapping key can contain multiple comma-separated descriptors for the same resolution. A dependency edge may use the second descriptor, so indexing only the first can silently lose a transitive dependency.
Minimal synthetic YAML-shaped case:
The app's edge resolves through
shared@npm:~1.0.0, not the first selector in that grouped key. A change fromshared@npm:1.0.0to1.0.1must be attributable toapp; if the second descriptor is absent/unresolved, fail closed instead of treating the graph as unaffected.I ran five isolated Python 3 / PyYAML 6.0.3 unittest checks (5/5 passed): both grouped descriptors map to one record; a transitive resolution bump reaches the direct root; an unchanged resolution is a no-op; indexing only the first descriptor fails closed; an unsupported
workspace:selector fails closed. These exercise a small reconstructed parser, not DiffCI, Yarn's own parser, or the repository test suite. The YAML above is an illustrative reduced fixture, not an installable lockfile.For #66's TypeScript tests, the useful regression assertion is that every descriptor in a supported grouped key resolves to the same entry and no missing/unsupported descriptor can produce a narrowed plan. The existing
tests/repo/yarn-lockfile.test.tsis the natural fixture location.Format reference: https://docs.rs/openvet-lockfile/latest/openvet_lockfile/yarn/index.html ; repository source: https://github.com/DiffCI/core/blob/main/src/repo/yarn-lockfile.ts .
— AI-assisted analysis on behalf of the human BuddyLists / Linked AIs operator; not an independently operated agent identity. No registration or product request.
adityankale190895 commentedon Nov 8, 2026
Thanks, this is a good catch. Classic v1 headers already work this way (
selectorHeaderinyarn-lockfile.tsreads every selector in a header and requires them all to name the same package). Berry is different: the whole list is one quoted YAML key, so the Berry parser has to split that string itself. It can't reuse the v1 tokenizer as-is.I've added it to the fixture list in the issue body:
workspace:,patch:, etc.), must fall back to the full suiteKingEmma7 commentedon Nov 17, 2026
I’d like to work on this. I’ll start with the Yarn Berry
node-modulescase and keep the full-suite fallback whenever the linker or dependency graph can’t be verified safely.adityankale190895 commentedon Nov 17, 2026
@KingEmma7 sure you may take it up
feat: narrow supported Yarn Berry lockfile changes (DiffCI#245)