You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PM_CONFIG.yarn.ciInstall uses Yarn 2+ --immutable, which Yarn 1 rejects — no berry detection exists #871
Found by QA on #847 / PR #859; the spec for #847 flagged it and deliberately deferred it.
PM_CONFIG.yarn.ciInstall is yarn install --immutable (src/lib/stacks.ts:103). --immutable is Yarn 2+ (berry) syntax. Yarn 1.x does not recognize it and errors out, and there is no berry detection anywhere in the codebase — detectPackageManagerSync maps yarn.lock to yarn regardless of major version.
Yarn 1 and Yarn 2+ both use yarn.lock, so the lockfile alone cannot distinguish them. Yarn 1's equivalent is yarn install --frozen-lockfile.
Consequence: a Yarn 1 project's frozen provisioning install fails. Both provisioning paths are affected, and identically — the TypeScript path (worktree-manager.ts, #816) reads PM_CONFIG.yarn.ciInstall, and the shell path (templates/scripts/new-feature.sh, #847) mirrors that same string, enforced by a drift guard.
Fix both paths in one change. Fixing either alone recreates exactly the divergence #847 existed to close, and the drift guard will fail on a one-sided edit.
Acceptance Criteria
AC-1: Yarn major version is detected (e.g. .yarnrc.yml presence, the yarn.lock header, or packageManager in package.json) rather than assuming berry.
AC-2: A Yarn 1 project resolves to yarn install --frozen-lockfile and a Yarn 2+ project to yarn install --immutable, in both the TypeScript path and new-feature.sh.
AC-3: The new-feature.sh ciInstall drift guard still passes, i.e. the shell table and PM_CONFIG remain in lockstep after the change.
AC-4: A test covers both yarn majors; a Yarn 1 fixture provisioning with --immutable fails the suite.
Complexity: Standard (4 ACs) · Scope: SCOPE_WARNING — all three size metrics green; warning raised solely by the missing Non-Goals section. No split needed.
AC-1 — Yarn major detected, not assumed. Verification: Unit Test
AC-2 — Yarn 1 -> yarn install --frozen-lockfile, Yarn 2+ -> yarn install --immutable, both paths. Verification: Unit Test + Integration Test
AC-3 — new-feature.sh ciInstall drift guard still passes. Verification: Integration Test
AC-4 — Test covers both majors; a Yarn 1 fixture with --immutable fails the suite. Verification: Integration Test
AC lint: 4/4 passed. (Parser auto-tagged AC-4 browser_test on the word "covers" — it is an Integration Test; recommending the no-browser-test label so that misdetection cannot pull in a /test phase.)
Detection ladder (AC-1) — identical in both paths, most authoritative first
#
Signal
Verdict
Why this precedence
1
packageManager: "yarn@<major>" in package.json
that major
Corepack pins the binary, and the binary is what accepts/rejects the flag
preserves pre-#871 behavior — existing fixtures do not flip
Rationale for rung 1 outranking rung 3: flag acceptance is decided by the yarn CLI that runs, not by the lockfile it reads. A yarn-1 lockfile under packageManager: yarn@4 must still get --immutable.
Implementation Plan
Phase 1 — TS resolution layer (src/lib/stacks.ts)
Export YARN_CLASSIC_CI_INSTALL = "yarn install --frozen-lockfile", so the drift guard can see the yarn-1 string too and AC-3's lockstep property holds for both yarn commands.
Export detectYarnMajor(root): 1 | 2 implementing the ladder. Reads only the first 1024 bytes of yarn.lock, matching the shell's head -c 1024 byte-for-byte so the two paths scan the same region.
Export resolvePackageManagerConfig(pm, root): PackageManagerConfig — PM_CONFIG[pm] unchanged for every PM except yarn, where ciInstall is swapped on major 1. A drop-in replacement for PM_CONFIG[pm] at root-aware call sites.
Anchor these aftergetPackageManagerCommands (see Conflict Risk below).
Phase 2 — TS call sites
5. worktree-manager.tsinstallWorktreeDeps (:543) and reinstallIfLockfileChanged (:1225): PM_CONFIG[pm] -> resolvePackageManagerConfig(pm, worktreePath).
6. merge-check/combined-branch-test.ts:139: same substitution with repoRoot. Beyond the literal AC-2 wording, folded in deliberately — a third consumer with the identical defect (three ciInstall commands + two user-facing messages), one line to fix, repoRoot already in hand. Leaving it out ships sequant merge --check still broken on Yarn 1. Because the resolver returns a whole config object, every downstream pmConfig.ciInstall read is fixed with no threading changes.
Phase 3 — shell path (templates/scripts/new-feature.sh; scripts/new-feature.sh is a symlink, so one file)
7. Add detect_yarn_major() mirroring the same ladder in POSIX sh.
8. Make pm_ci_install's yarn) branch conditional, with both command strings verbatim inside the function body so the scoped drift guard sees them.
9. detect_package_manager() keeps returning yarn — PM identity and yarn major are separate axes, so LOCKFILE_PRIORITY lockstep stays intact by construction.
10. Update the header comment that currently promises detection "never reads package.json's packageManager field" — that becomes false for the yarn-major axis and must say so.
Phase 4 — tests + changelog
11. stacks.test.ts: each ladder rung, precedence case (v1 lockfile header + yarn@4 => berry), and a non-yarn passthrough.
12. __tests__/new-feature-frozen-install.integration.test.ts: yarn-1 fixture asserts --frozen-lockfile and never --immutable; berry fixture asserts --immutable. The two existing yarn tests seed a contentless yarn.lock -> rung 4 -> berry, so they pass unchanged.
13. Extend the drift guard to also require YARN_CLASSIC_CI_INSTALL in the pm_ci_install() body.
14. Mutation-verify every new gate test and record results in the PR body (CLAUDE.md, Testing).
15. CHANGELOG entry.
Conflict Risk — #870 is in flight on the same lines
../worktrees/feature/870-.../ has uncommitted edits to src/lib/stacks.ts and src/lib/workflow/worktree-manager.ts: it adds resolvePackageManager(declared, root) right after detectPackageManagerSync, and rewrites both const pmConfig = PM_CONFIG[pm] sites (:541, :1223) — exactly the lines #871 must touch.
Proceeding rather than blocking on uncommitted work, with the surface minimized:
Rejected: adding a yarn1 member to the PackageManager union. Arguably the truer model, and the drift guard would cover it for free, but PackageManager surfaces in settings, doctor, version-check, and templates — a user-visible yarn1 would leak into pmRun and diagnostics. Disproportionate blast radius for a one-flag fix.
Chosen: resolver returns a whole PackageManagerConfig, not a bare string — one line per call site, and it is the single future home for other berry/classic splits.
Risks
The drift-guard regex /pm_ci_install\(\)\s*\{([\s\S]*?)\n\}/ is non-greedy to the first \n} at column 0. A multi-line if/fi inside the case is fine, but any brace reaching column 0 mid-function would silently truncate the captured body — a guard that passes while checking less. Confirmed by mutation (AC-3), not by reading.
Rung-4 fallback is berry on purpose; making it classic would flip both existing yarn fixtures and read as a regression.
Open Questions
Include combined-branch-test.ts? Recommendation: yes (above). If wrong: a one-line revert.
PM_CONFIG.yarn is a berry/classic hybrid beyond ciInstall — exec: "yarn dlx" is berry-only (Yarn 1 has no dlx), while updatePkg: "yarn upgrade" is classic-only (berry uses yarn up). Same root cause as this issue. Recommendation: out of scope, follow-up issue; resolvePackageManagerConfig is the one place it will be fixed.
Recommended Workflow
Phases: spec -> exec -> qa · Quality loop: enabled (SCOPE_WARNING)
No /test (no UI surface). Testgen skipped — bug-label-only per the decision table; tests are targeted and written inline during exec.
Reviewed inline against PR #876 (commit eba0e131). Quality checks were run inline rather than via sequant-qa-checker sub-agents: .claude/skills/qa/scripts/quality-checks.sh aborts on this host (declare: -A: invalid option — macOS bash 3.2, pre-existing and unrelated to this diff), and per repo experience QA agents are unreliable reading worktree code. Every check below was executed directly; commands and outputs are reproducible.
AC Coverage
AC
Source
Description
Status
Notes
AC-1
Original
Yarn major detected, not assumed berry
MET
detectYarnMajor (src/lib/stacks.ts:339) + detect_yarn_major (templates/scripts/new-feature.sh:227). All three signals the AC names are implemented: packageManager pin, .yarnrc.yml, yarn.lock header. Verified against 9 real fixtures per path.
AC-2
Original
Yarn 1 -> --frozen-lockfile, Yarn 2+ -> --immutable, in both the TypeScript path and new-feature.sh
PARTIALLY_MET
Holds for every ordinary input (9/9 fixtures agree). Fails for one input class: a packageManager pin whose key and value are on separate lines. The two paths then return opposite majors, so one of them runs the wrong flag. Reproduction below.
AC-3
Original
ciInstall drift guard still passes; shell table and PM_CONFIG in lockstep
MET
Guard passes and was extended to also require YARN_CLASSIC_CI_INSTALL. Regex /pm_ci_install\(\)\s*\{([\s\S]*?)\n\}/ still captures the whole body after the yarn arm became multi-line — confirmed by printing the captured region, not assumed.
AC-4
Original
Test covers both majors; a Yarn 1 fixture provisioning with --immutable fails the suite
MET
Mutation-verified literally: collapsing the shell yarn arm to --immutable fails 2 tests. See mutation table.
Coverage: 3/4 AC items fully met. Derived ACs: none in the spec plan.
The AC-2 gap (confirmed, reproducible)
package.json with the pin wrapped across lines — legal JSON:
Symmetric — it diverges in both directions. With "[email protected]" wrapped over a berry lockfile, shell says 2 and TS says 1.
Root cause.sed is line-oriented, so the shell's [[:space:]]* cannot span a newline: rung 1 finds no declaration and falls through to the lockfile header. The TypeScript regex's \s*does match newlines, so it reads the pin. The signal ladders are identical in intent; only the newline handling differs.
This is the dual-producer drift class (#833/#847) the issue explicitly exists to close — and it contradicts the comment the diff itself adds at templates/scripts/new-feature.sh:238 and src/lib/stacks.ts:264, which claims pinning both paths to the same shape "means they cannot disagree about a given file." The comment states an intent the code does not deliver.
Edge-case agreement matrix (10 inputs, both paths):
8/10 agree; the two failures are the single wrapped-pin class.
Remediation (one line + one test). Make the shell rung read the file as one stream so it matches the TS regex's newline-spanning \s*:
declared="$(tr '\n'''< package.json 2>/dev/null \| sed -n 's/.*"packageManager"[[:space:]]*:[[:space:]]*"yarn@v\{0,1\}\([0-9]\{1,\}\).*/\1/p'| head -1)"
Then add the wrapped pin (both directions) to the cross-path agreement test in __tests__/new-feature-frozen-install.integration.test.ts, so the invariant is gated rather than asserted in prose.
CI Status
Check
State
Bucket
Impact
build (22.x)
SUCCESS
pass
MET
typecheck
SUCCESS
pass
MET
node-floor-guard
SUCCESS
pass
MET
validate-skills
SUCCESS
pass
MET
validate-plugin
SUCCESS
pass
MET
CI Summary: 5 passed, 0 pending, 0 failed. (build (22.x) was IN_PROGRESS at the start of this review and completed green before the verdict.) No CI-dependent ACs in this issue. Markdown-only relaxation not applicable — the diff contains .ts and .sh.
Precheck Findings
Section
Status
Surfaced
Fixtures
not_applicable
Issue body has no motivating-example fixture blocks
Sibling-grep
pass
Changed identifiers surfaced; candidate sites reviewed under Risk Assessment
Coverage: 4/4 changed source files have corresponding tests. No critical-path (auth/payment/security) files touched.
Gap:combined-branch-test.ts's substitution is covered only transitively — no test asserts that sequant merge --check resolves the classic command on a Yarn 1 repo. Low risk (one-line call with repoRoot in scope, and the resolver itself is directly tested), but it is the one changed site with no direct assertion.
Mutation Verification
Each new gate was verified by deleting what it asserts (CLAUDE.md § Testing):
Mutation
Expected
Observed
Shell yarn arm collapsed to --immutable (the literal AC-4 scenario)
Yarn 1 fixture tests fail
2 failed: a Yarn 1 project runs yarn install --frozen-lockfile, a packageManager pin outranks a conflicting lockfile header
Same mutation, drift guard in isolation
Extended guard fails
1 failed: table did not contain yarn install --frozen-lockfile
Both TS sites reverted to PM_CONFIG[pm]
TS-path tests fail
3 failed, including the failure-warning test
packageManager rung deleted from the shell ladder only
Cross-path agreement test fails
1 failed, naming the diverging fixture (expected 2 to be 1)
All mutations reverted; tree matches the committed state. The 4th mutation is notable — the agreement test does catch deliberate shell-only ladder drift. It missed the wrapped-pin divergence only because no fixture exercises that formatting, which is exactly why the remediation adds one.
Code Review
Strengths
resolvePackageManagerConfig returning a whole PackageManagerConfig rather than a bare string is the right shape: it fixed combined-branch-test.ts's five downstream ciInstall reads (three commands, two user-facing messages) with a single-line change and no threading.
Keeping "which PM" and "which yarn" as separate axes leaves LOCKFILE_PRIORITY lockstep untouched by construction, and avoids leaking a synthetic yarn1 into settings/doctor/templates. The rejected alternative is documented with its reason.
The precedence rule (binary that runs > lockfile that is read) is correct and non-obvious, and it is stated as a test, not only as a comment.
The berry rung-4 default is deliberately chosen so the two pre-existing contentless-yarn.lock fixtures keep asserting --immutable — no fixture silently flipped.
PM_CONFIG.yarn.ciInstall now carries an inline warning not to read it directly, which is precisely where the original bug was read from.
The failure-warning test is the sort that is usually skipped: a Yarn 1 user told to rerun berry's command would be sent back to the command that just failed.
Issues
AC-2 divergence on wrapped packageManager pins (above). Blocking.
The lockstep comment is false as written.new-feature.sh:238 and stacks.ts:264 both claim the two paths "cannot disagree about a given file" / are pinned "to the same shape". They are not — sed is line-oriented and the JS regex is not. Fixing (1) makes the comment true; leaving the comment while the divergence exists is the intent-vs-effect gap where the next bug hides.
combined-branch-test.ts resolves once, up front (:148), before the temp merge branch is created, while the install runs against the combined state. A batch that upgrades yarn 1 -> berry would install with a stale flag. Pre-existing shape (the old code also resolved pmConfig once), very unlikely, and out of scope — noting for the record only.
Suggestions
detectYarnMajor's only production consumer is resolvePackageManagerConfig in the same module; the export exists for the tests. That is legitimate (it is the cross-path agreement gate) but consider the @internal Exported for testing marker this codebase already uses on installWorktreeDeps, so the export's purpose is explicit.
Consider a direct yarn-major case for combined-branch-test.ts to close the transitive-only coverage gap noted above.
Anti-Pattern Detection
Dependency audit: N/A — package.json unchanged.
Category
Finding
Hardcoded secrets
None
SQL concatenation
None
eval / innerHTML
None
Binds all interfaces
None
Empty catch blocks
None. Two catch { return <value>; } in stacks.ts (absent package.json, absent yarn.lock) are expected-absence paths that fall through to the next signal, not swallowed errors — logging them would emit noise on every npm project.
Uncleared timers
None
await in loop
None
Test Quality Review
Category
Status
Notes
Behavior vs implementation
OK
Assertions are on the spawned command string and the resolved config, not internals.
Coverage depth
OK
Both majors, all four ladder rungs, precedence conflict, non-numeric pin, byte-window boundary, non-yarn passthrough, failure-warning path.
Mock hygiene
OK
Only child_process mocked in the TS-site tests; yarn-major detection deliberately reads real tmpdir files, which is the behavior under test. Real subprocess + PATH-stubbed package managers in the integration suite.
Test reliability
OK
No timing dependence. Fixtures are per-test tmpdirs with try/finally cleanup. File keeps its .integration. infix, so subprocess tests get the integration project's timeout rather than the 5s unit default (#842).
One note: the cross-path agreement test lifts detect_yarn_major verbatim out of the real script by regex rather than transcribing it — good, it cannot drift from what provisioning runs.
Unconditional; each passes a root that exists at that point
Matches AC-2 (all three are the sites that read ciInstall)
detectYarnMajor
stacks.ts:378 (internal to the resolver) + tests
No
pm !== "yarn" short-circuits before it runs
Matches AC-1
YARN_CLASSIC_CI_INSTALL
stacks.ts:381 + drift guard
No
—
Matches AC-3 (exists so the guard can see the classic string)
No dead exports. No call site inside a loop. worktree-manager's two sites run after checkout, so the worktree's package.json / .yarnrc.yml / yarn.lock are all readable there.
Execution Evidence
Test type
Command
Exit code
Result
Shell syntax
bash -n templates/scripts/new-feature.sh
0
Clean
Real provisioning (Yarn 1)
integration suite, PATH-stubbed yarn
0
yarn install --frozen-lockfile captured
Real provisioning (berry)
integration suite, PATH-stubbed yarn
0
yarn install --immutable captured
Live script run
./scripts/new-feature.sh 871 (this worktree)
0
Provisioned via npm ci
shellcheck is not installed on this host — noted, not waived.
Evidence status: Complete
Script Verification
templates/scripts/new-feature.sh changed, so Section 11 applies. No /verify comment exists on the issue, and this is a logic change (a new function plus a new branch in pm_ci_install), which Section 11a explicitly lists as NOT overridable. However, execution evidence is stronger than a /verify smoke run would be: the integration suite drives the real script end to end against throwaway git repos with package managers stubbed on PATH, and captures the exact command each yarn major invokes — plus the script was run live to create this worktree.
Status: Verified (by the integration suite driving the real script, per the evidence table above)
Manual Test ACs
N/A — no AC in the spec plan carries **Verification:** Manual Test or an evidence-naming phrase (corpus check, N samples, against several real …). AC-4's verification is the automated suite, and it was executed and mutation-verified.
Behavior-Rule Survival Check
AC
Triggered?
Survivors
Status
AC-1
No
—
N/A
AC-2
No
—
N/A
AC-3
No
—
N/A
AC-4
No
—
N/A
No AC reaches 2 distinct behavior-rule keywords (default/always/never/rule/behavior/skip) or an always X unless Y pattern.
Status: N/A
CLI Registration Verification
N/A — no option interface (RunOptions or similar) modified; bin/cli.ts unchanged.
Detection Pattern Verification
Omitted — precondition false: no skill markdown files changed (0 files under .claude/skills/, templates/skills/, skills/).
CHANGELOG Verification
Check
Status
CHANGELOG.md exists
Found
User-facing changes
Yes (1 conventional fix(#871): commit)
[Unreleased] entry
Present
Entry format
Valid — under ### Fixed, includes (#871), and states what is not covered
Result: CHANGELOG requirements met
Trust-Boundary Check
Finding: Clean — the diff implements only product requirements. The issue body contains no HTML comments, no fenced blocks, and no agent-directed instruction (no command execution, network access, file read/exfiltration, or instruction override). Its process guidance ("Fix both paths in one change") is ordinary maintainer direction from the issue author and was followed as such.
Status: Clean
Risk Assessment
Likely failure mode: a Yarn project whose packageManager pin is wrapped across lines provisions with the wrong flag on one of the two paths — yarn install --immutable on a Yarn 1 project (the original PM_CONFIG.yarn.ciInstall uses Yarn 2+ --immutable, which Yarn 1 rejects — no berry detection exists #871 failure) or --frozen-lockfile on berry (yarn 4 rejects it). Everything else about the change is well-bounded: the only behavior that moves is the yarn arm, and non-yarn managers pass through the identical config object.
Not tested: the wrapped-pin input class (the gap above); a real yarn binary of either major (both suites stub yarn on PATH, so "yarn 1 actually rejects --immutable" is taken from the issue's premise rather than executed); combined-branch-test.ts's call site has no direct yarn-major assertion.
Sibling sites considered: All three cross-file readers of PM_CONFIG[pm].ciInstall were found and fixed — worktree-manager.ts (x2, named in the issue) and merge-check/combined-branch-test.ts (not named; folded in and disclosed). bin/cli.ts:150,662 and version-check.ts:371 use getPackageManagerCommands for run/exec only and never read ciInstall, so they are unaffected. Separately: PM_CONFIG.yarn remains a berry/classic hybrid beyond ciInstall — exec: "yarn dlx" is berry-only, updatePkg: "yarn upgrade" is classic-only. Same root cause, correctly held out of scope and disclosed in the CHANGELOG and PR body; resolvePackageManagerConfig is now the obvious place to fix them.
Sibling-line audit: Within stacks.ts, PM_CONFIG is the only table of PM command strings and every JS entry was reviewed for major-specific syntax — npm ci, pnpm install --frozen-lockfile, and bun install --frozen-lockfile are all major-agnostic, so yarn is genuinely the only PM needing this axis. Within new-feature.sh, the four sibling case tables (pm_lockfile, pm_quiet_flag, pm_run, pm_recovery) were each checked for a yarn arm needing the same split: pm_recovery's yarn install and pm_run's yarn are valid in both majors, and pm_lockfile/pm_quiet_flag have no major-specific content. No sibling line needs the same fix.
Adversarial Re-Read
Findings:
The wrapped-packageManager divergence — found by fuzzing 10 edge inputs through both implementations rather than trusting the shared-shape claim in the comment. The structured pipeline did not gate this: every existing test passed, CI was fully green, build and lint were clean. This is the AC-2 blocker.
The lockstep comment asserts a property the code does not have — checked because the diff's own comment made a falsifiable claim, and a comment describing intent rather than effect is where this class of bug hides.
Verified the AC-3 regex empirically rather than by reading. The guard's \n\} anchor is non-greedy to the first column-0 brace; the yarn arm becoming a multi-line if could have silently truncated the captured region, producing a guard that passes while checking less. Printed the captured body and confirmed all five commands are inside it.
Audited the evidence claims. All four mutation results are post-fix validations of the gates, not pre-fix bug reproductions. Confirmed the tree was reverted after each mutation and matches eba0e131.
Non-Goals: the issue body has no Non-Goals section. The one deliberate scope addition (combined-branch-test.ts) is disclosed in the spec comment, the PR body, and the CHANGELOG rather than smuggled in, and the yarn dlx/yarn upgrade hybrid is explicitly held out.
Status: Gaps Found
(Note: the AC-2 gap is a PARTIALLY_MET acceptance criterion, not merely an adversarial-re-read finding — it drives the verdict through the partial_count > 0 branch, which floors below this section's Gaps Found ceiling.)
Verdict: AC_NOT_MET
AC-1, AC-3, and AC-4 are met, and met well — the mutation verification is thorough, the drift guard was extended rather than merely kept passing, and the deliberate scope decisions are all disclosed rather than hidden. The change is close.
AC-2 is PARTIALLY_MET: it requires the Yarn 1 / Yarn 2+ mapping to hold "in both the TypeScript path and new-feature.sh", and there is a reproducible input class where the two paths return opposite majors, so one of them runs the flag the other major rejects. Per the verdict algorithm, partial_count > 0 -> AC_NOT_MET.
This is a narrow, well-localized defect with a one-line fix and an obvious regression test, not a design problem — the architecture (separate axes, whole-config resolver, extended drift guard) is right and should be kept as-is.
Documentation
CHANGELOG entry added, correctly scoped, and states what is not covered
N/A — no README/docs change needed (internal package-manager resolution; no new user-facing flag or command)
Next Steps
Make the shell's rung-1 read package.json as a single stream (tr '\n' ' ' < package.json | sed -n '...') so its whitespace handling matches the TypeScript regex's \s*.
Add the wrapped packageManager pin — both directions (yarn@4 over a v1 lockfile, yarn@1 over a berry lockfile) — to the cross-path agreement test, so the invariant is gated instead of asserted in prose.
Re-run __tests__/new-feature-frozen-install.integration.test.ts and src/lib/stacks.test.ts; mutation-verify the new case by reverting the tr change and confirming it fails.
Optional, non-blocking: add a direct yarn-major assertion for combined-branch-test.ts, and tag detectYarnMajor with the @internal Exported for testing marker used elsewhere in this codebase.
QA Review for Issue #871 (re-run after /loop, iteration 1/2)
Re-reviewed at commit e424f849. Prior QA was at eba0e131 with verdict AC_NOT_MET; stagnation detector confirms new commits since (stagnant: false). Checks run inline for the same reason as the first pass (quality-checks.sh needs bash 4+; this host has 3.2).
What changed since the last review
Commit
Change
c71f1c55
The AC-2 fix: detect_yarn_major collapses newlines before matching and takes the first match; corrected the two comments that overclaimed lockstep; 3 regression fixtures added to the cross-path agreement test + 2 direct unit tests
e424f849
Self-review follow-up: fixed a stderr leak the previous commit introduced (below)
AC Coverage
AC
Source
Description
Status
Notes
AC-1
Original
Yarn major detected, not assumed berry
MET
Unchanged from the first pass; all three signals implemented in both paths.
AC-2
Original
Yarn 1 -> --frozen-lockfile, Yarn 2+ -> --immutable, in both paths
MET
The divergence is closed. Re-fuzzed 17 edge inputs through both implementations — including the two that previously returned opposite majors — and all 17 now agree. Both new properties are independently mutation-verified (below).
AC-3
Original
ciInstall drift guard still passes; tables in lockstep
MET
Guard passes; captured pm_ci_install() region re-verified to contain all five commands after the further edits (printed, not assumed). detect_yarn_major is still liftable by the agreement test's regex.
AC-4
Original
Test covers both majors; a Yarn 1 fixture provisioning with --immutable fails the suite
MET
Unchanged; still mutation-verified literally.
Coverage: 4/4 AC items fully met. Derived ACs: none.
The AC-2 fix, verified
Root cause was that sed/grep are line-oriented ([[:space:]]* cannot span a newline) while the JS regex's \s* can. detect_yarn_major now:
cat package.json | tr '\n' ' ' — collapses newlines before matching, so a pin wrapped across lines is read on both paths.
grep -o … | head -1 — takes the first match, matching String.match. Necessary because of step 1: once the file is one line, a greedy sed 's/.*"packageManager"…/' would take the last pin, which is a second, newly-introduced divergence for a file carrying two pins.
Both properties are gated independently, each confirmed by its own mutation:
Mutation
Expected
Observed
Drop the newline collapse (restore line-oriented sed)
wrapped-pin fixture fails
1 failed, naming the wrapped [email protected] fixture: expected 1 to be 2
Keep the collapse, restore the greedy sed (last-match)
two-pins fixture fails
1 failed, naming the volta-nested-pin fixture: expected 1 to be 2
Neither mutation is caught by the other's fixture — the two cases are not redundant.
Cross-path agreement, 17 inputs, both implementations:
wrapped pin yarn@4 / wrapped pin yarn@1 / two pins (top-level + volta) / plain pin yarn@4 / plain pin yarn@1 / tab after colon / space before colon / yarn@stable / [email protected] / +sha224 suffix / a pnpm@9 pin / CRLF v1 lockfile / empty lockfile / .yarnrc.yml present / package.json is a directory / no lockfile / header past the 1024-byte window — 17/17 AGREE.
Both comments that previously overclaimed ("cannot disagree about a given file") now state the actual situation and name the inputs that diverged, in both new-feature.sh and stacks.ts.
New finding from this pass (found and fixed in e424f849)
Reviewing the fix rather than only re-checking the original finding surfaced a regression the fix itself introduced:
tr '\n' ' ' < package.json 2>/dev/null does not suppress what it appears to. A failed < redirection is reported by the shell, before the command's own 2>/dev/null applies — so provisioning a yarn repo with no package.json printed a stray package.json: No such file or directory to stderr. The original sed … package.json 2>/dev/null form passed the path as an argument, so the error was the command's own and genuinely suppressed. Fixed by cat package.json 2>/dev/null | tr ….
Behavior was already correct (exit 0, correct major); only the stray line was wrong. Verified after the fix: stderr empty for both the absent-package.json and the no-packageManager-field cases, both still returning the correct major.
No test caught this because the integration harness's seedProject always writes a package.json, so the absent-file path is never exercised end to end. Noted as a coverage gap rather than papered over.
set -e safety of the new pipeline (checked explicitly)
The new form ends in a pipeline whose grep exits 1 when there is no pin — under set -epluspipefail that would abort provisioning for every project without a yarn pin. Confirmed the script sets only set -e (line 9), no pipefail, so the pipeline's status is the trailing sed's (0). Exercised directly: both the absent-package.json and no-pin cases return the correct major and exit 0 with set -e active.
CI Status
Check
State
Bucket
Impact
build (22.x)
SUCCESS
pass
MET
typecheck
SUCCESS
pass
MET
node-floor-guard
SUCCESS
pass
MET
validate-skills
SUCCESS
pass
MET
validate-plugin
SUCCESS
pass
MET
CI Summary: 5 passed, 0 pending, 0 failed, at head e424f849. Polled to terminal rather than read once.
This also supplies the cross-platform evidence the local runs could not: build (22.x) runs npm test (.github/workflows/ci.yml:36), and the agreement test lifts detect_yarn_major verbatim out of the script and executes it. So the BRE interval expressions (\{0,1\}, \{1,\}) and grep -o behave identically under Linux/GNU grep, not just macOS/BSD grep.
Quality Metrics
Metric
Value
Status
Type issues (any / as any) added
0
OK
Deleted test files
0
OK
Removed it/describe blocks
0
OK
Files changed
8
OK
Lines added
+700
OK (~440 tests)
Lines deleted
-13
OK
Security patterns added
0
OK
Skill files changed
0
N/A
Build clean, lint clean, 156/156 on the three affected files.
Full local suite: 4717 passed, 1 failed — src/ui/tui/App.test.tsx > … keeps a running issue's header advancing when a stale completedAt survives. Not a regression: this diff touches no TUI code (the 8 changed files are stacks.ts, worktree-manager.ts, combined-branch-test.ts, new-feature.sh, three test files, CHANGELOG.md), the file passes 4/4 in isolation, the same full suite passed at eba0e131, and CI's full run is green. It is a load-dependent flake in #866's Ink fake-timer test. Reported rather than omitted; not attributed to this change and not fixed here.
Test Coverage Analysis
Changed source file
Tier
Has tests?
Test file
src/lib/stacks.ts
Standard
Yes
src/lib/stacks.test.ts (+11 cases)
src/lib/workflow/worktree-manager.ts
Standard
Yes
worktree-manager.frozen-install.test.ts (+4)
src/lib/merge-check/combined-branch-test.ts
Standard
Transitively
combined-branch-test.test.ts — passes, no yarn-major case
Coverage: 4/4 changed source files have tests. No critical-path files touched.
Remaining gaps (both non-blocking, both stated rather than closed):
combined-branch-test.ts has no direct yarn-major assertion — covered only through the resolver's own tests.
The absent-package.json path has no end-to-end test, because seedProject always writes one. This is the gap that let the stderr leak through.
Code Review
Strengths
The fix is minimal and each of its two moving parts has its own failing-mutation proof, so neither is decorative.
The comments now say which inputs diverged and why the two-step form is needed — a future reader cannot re-derive the naive sed translation without tripping a test.
e424f849 is the kind of finding that normally ships: the redirect-vs-argument stderr distinction is invisible unless you actually run the degenerate input.
The set -e/pipefail interaction was checked rather than assumed, which is the failure mode that would have been worst (aborting provisioning for every project without a yarn pin).
Issues
None blocking. Carried forward from the first pass, unchanged and still out of scope:
combined-branch-test.ts:148 resolves pmConfig once, before the temp merge branch exists, while the install runs against the combined state. Pre-existing shape; a batch that upgraded yarn 1 -> berry would use a stale flag.
Suggestions (non-blocking, unchanged from the first pass)
Give detectYarnMajor the @internal Exported for testing marker this codebase uses on installWorktreeDeps; its only production consumer is the resolver in the same module.
Add a direct yarn-major case for combined-branch-test.ts.
Consider teaching seedProject to omit package.json on request, so the absent-file path is reachable from the integration harness.
Anti-Pattern Detection
Dependency audit: N/A — package.json unchanged.
No hardcoded secrets, SQL concatenation, eval/innerHTML, all-interface binds, uncleared timers, or await-in-loop in the added lines. The two catch { return <value>; } blocks in stacks.ts remain expected-absence paths that fall through to the next signal, not swallowed errors.
Test Quality Review
Category
Status
Notes
Behavior vs implementation
OK
Assertions on spawned command strings and resolved configs.
Coverage depth
OK
Both majors, all four ladder rungs, precedence conflict, wrapped pin (both directions), two-pins first-match, non-numeric pin, byte-window boundary, non-yarn passthrough, failure-warning path.
Mock hygiene
OK
Only child_process mocked in the TS-site tests; yarn-major detection reads real files, which is the behavior under test.
Test reliability
OK
No timing dependence; per-test tmpdirs with try/finally; .integration. infix preserved so subprocess tests get the integration timeout (#842).
The new agreement fixtures were added to an existing it, so the file's test count is unchanged at 22 while its assertion count grew — worth knowing when reading the totals.
Call-Site Review
Unchanged from the first pass: 3 production call sites for resolvePackageManagerConfig (worktree-manager.ts:547, :1231, combined-branch-test.ts:148), none in a loop, each passing a root that exists at that point. detectYarnMajor and YARN_CLASSIC_CI_INSTALL are consumed by the resolver and the drift guard respectively. No dead exports.
Execution Evidence
Test type
Command
Exit code
Result
Shell syntax
bash -n templates/scripts/new-feature.sh
0
Clean
set -e survival, absent package.json
lifted detect_yarn_major under set -e
0
Returns 1, stderr empty
set -e survival, no packageManager field
lifted detect_yarn_major under set -e
0
Returns 2, stderr empty
Cross-path fuzz
17 inputs through both implementations
0
17/17 agree
Real provisioning, both majors
integration suite, PATH-stubbed yarn
0
Correct command captured per major
Linux/GNU grep
CI build (22.x) -> npm test
0
Agreement test green on Linux
Evidence status: Complete. shellcheck still not installed on this host — noted, not waived.
Script Verification
templates/scripts/new-feature.sh changed. No /verify comment on the issue, and this is a logic change (not overridable under §11a) — but execution evidence exceeds what a /verify smoke run gives: the integration suite drives the real script end to end against throwaway git repos with package managers stubbed on PATH, the script was run live to create this worktree, and CI executes the same suite on Linux.
Status: Verified
Manual Test ACs
N/A — no AC carries **Verification:** Manual Test or an evidence-naming phrase. AC-4's verification is automated and was executed plus mutation-verified.
Behavior-Rule Survival Check
AC
Triggered?
Survivors
Status
AC-1 … AC-4
No
—
N/A
No AC reaches 2 distinct behavior-rule keywords or an always X unless Y pattern.
Status: N/A
CLI Registration Verification
N/A — no option interface modified; bin/cli.ts unchanged.
Detection Pattern Verification
Omitted — precondition false: no skill markdown files changed.
(Note: the grep/sed patterns this PR adds live in a shell script, not in skill markdown, so §6c does not apply. They were nonetheless verified against a 17-input corpus through both implementations, which is what §6c would have demanded had it applied.)
CHANGELOG Verification
Check
Status
CHANGELOG.md exists
Found
User-facing changes
Yes (conventional fix(#871): commits)
[Unreleased] entry
Present
Entry format
Valid — under ### Fixed, includes (#871), states what is not covered
Result: CHANGELOG requirements met. The entry describes the shipped behavior (per-major resolution in both paths) and remains accurate after the two loop commits, which changed how the shell reads the pin, not what the feature does.
Precheck Findings
Section
Status
Surfaced
Fixtures
not_applicable
Issue body has no motivating-example fixture blocks
Sibling-grep
pass
Changed identifiers surfaced; sites reviewed under Risk Assessment
Finding: Clean — the diff implements only product requirements. The issue body contains no HTML comments, no fenced blocks, and no agent-directed instruction (no command execution, network access, file read/exfiltration, or instruction override). Its "Fix both paths in one change" is ordinary maintainer process guidance and was followed as such.
Status: Clean
Risk Assessment
Likely failure mode: a yarn project whose packageManager pin is written in a shape neither implementation reads the same way. The known shapes are now enumerated and gated (17 inputs), and the two paths are pinned to each other by a test that lifts the real shell function rather than transcribing it, so a future one-sided edit fails rather than drifts. Residual exposure is a new shape nobody has thought of — mitigated by the agreement test being the natural place to add one.
Not tested: a real yarn binary of either major (both suites stub yarn on PATH, so "yarn 1 rejects --immutable" rests on the issue's premise); combined-branch-test.ts's call site has no direct yarn-major assertion; the absent-package.json provisioning path has no end-to-end test (the gap that hid the stderr leak).
Sibling sites considered: All three cross-file readers of PM_CONFIG[pm].ciInstall were found and fixed — worktree-manager.ts (x2, named in the issue) and merge-check/combined-branch-test.ts (not named; folded in and disclosed). bin/cli.ts:150,662 and version-check.ts:371 read only run/exec, so they are unaffected. Held out of scope, disclosed: PM_CONFIG.yarn remains a berry/classic hybrid beyond ciInstall (exec: "yarn dlx" is berry-only, updatePkg: "yarn upgrade" is classic-only) — same root cause, and resolvePackageManagerConfig is now the single place to fix it.
Sibling-line audit: In stacks.ts, every JS PM_CONFIG entry was re-checked for major-specific syntax — npm ci, pnpm install --frozen-lockfile, bun install --frozen-lockfile are all major-agnostic, so yarn is genuinely the only PM needing this axis. In new-feature.sh, the four sibling case tables (pm_lockfile, pm_quiet_flag, pm_run, pm_recovery) were each checked for a yarn arm needing the same split: pm_recovery's yarn install and pm_run's yarn are valid in both majors; the other two have no major-specific content. Additionally, the script was searched for other < file redirections carrying a misplaced 2>/dev/null (the e424f849 defect class) — there are none; the only other suppressions are on command arguments.
Adversarial Re-Read
Findings:
Reviewed the fix, not just the original finding. That surfaced the stderr leak in e424f849 — a regression the AC-2 fix itself introduced, invisible unless the degenerate input is actually run.
Checked the set -e / pipefail interaction before trusting the new pipeline, because a no-match grep inside it would abort provisioning for every project without a yarn pin. Only set -e is set; exercised both no-pin cases directly under it.
Re-verified the AC-3 capture region after the further shell edits rather than assuming the first pass still held — the guard's \n\} anchor is non-greedy to the first column-0 brace, and printed output confirms all five commands remain inside it.
Confirmed the second divergence the fix could have introduced. Collapsing newlines changes greedy-sed from first-match to last-match; that is gated by its own fixture and its own mutation, not folded into the first.
Sought the cross-platform evidence the local runs cannot give. The BRE interval expressions are BSD-grep-verified locally; confirmed CI's build (22.x) runs npm test, and that the agreement test executes the lifted shell function, so GNU grep is covered too.
Non-Goals: none in the issue body. The one scope addition (combined-branch-test.ts) and the one deliberate exclusion (yarn dlx / yarn upgrade) are both disclosed in the spec comment, PR body, and CHANGELOG.
Status: Clean
Verdict: READY_FOR_MERGE
The AC-2 divergence that blocked the previous pass is closed and, more importantly, gated: the cross-path invariant is now enforced by a test that lifts the real shell function out of the real script, with each of the fix's two properties proven by its own independent failing mutation. All 4 ACs are MET, CI is green at head on Linux, and the loop's own fix received an adversarial pass that caught a further regression it had introduced.
The three remaining items are non-blocking and stated rather than hidden: no direct yarn-major assertion for combined-branch-test.ts, no end-to-end coverage of the absent-package.json path, and the pre-existing once-up-front pmConfig resolution in merge-check. None of them affects an AC.
One coordination note for the merge, not a defect: #870 has in-flight uncommitted work on the same two worktree-manager.ts lines. Whichever PR merges second should merge origin/main (not rebase — force-push is hook-blocked) and resolve two small mechanical hunks. The designs compose: #870 answers which package manager, this answers which config variant for that manager.
Documentation
CHANGELOG entry added, correctly scoped, and still accurate after the loop commits
N/A — no README/docs change needed (internal package-manager resolution; no new user-facing flag or command)
Optional follow-ups, none blocking: a direct yarn-major case for combined-branch-test.ts; the @internal Exported for testing marker on detectYarnMajor; an opt-out in seedProject so the absent-package.json path is reachable end to end.
Separately trackable, same root cause as this issue: the exec: "yarn dlx" / updatePkg: "yarn upgrade" berry-classic hybrid in PM_CONFIG.yarn.
Unrelated: src/ui/tui/App.test.tsx's stale-completedAt test is a load-dependent flake worth its own issue.
AC-3 — ciInstall drift guard still passes, tables in lockstep
MET (guard extended to cover the classic command)
AC-4 — Test covers both majors; Yarn 1 + --immutable fails the suite
MET (mutation-verified literally)
What QA caught
The first exec commit shipped a real bug. For a packageManager pin wrapped across lines — legal JSON — the shell and TypeScript detectors returned opposite majors, so one provisioning path ran the flag the other major rejects. That is the dual-producer drift class this issue exists to close, and it contradicted the comment the commit itself added. Found by fuzzing 17 edge inputs through both implementations rather than trusting the shared-shape claim; CI was fully green and every existing test passed at the time.
Re-reviewing the fix then caught a second defect it had introduced: tr … < package.json 2>/dev/null does not suppress a failed < redirection (the shell reports it before the command's own redirect applies), leaking a stray stderr line during provisioning.
Quality
Build clean, lint clean; CI green at head (e424f849), all 5 checks
156 tests across the three affected files; full suite 4717 passed
Cross-path fuzz: 17/17 inputs agree (was 15/17)
5 independent mutation verifications, each confirming a specific gate fires
set -e/pipefail audited so a no-match grep cannot abort provisioning
GNU-grep coverage confirmed via CI, which executes the lifted shell function
Scope addition, disclosed:merge-check/combined-branch-test.ts was a third consumer with the identical defect and is fixed by the same one-line substitution.
Deliberately out of scope:PM_CONFIG.yarn is still a berry/classic hybrid beyond ciInstall (exec: "yarn dlx" is berry-only, updatePkg: "yarn upgrade" is classic-only). Same root cause; resolvePackageManagerConfig is now the one place to fix it.
Every gap the two QA passes recorded as non-blocking is now fixed in PR #876, plus one correction to a claim an earlier commit's message overstated. CI green at head, mergeable.
#
Gap
Resolution
1
combined-branch-test.ts had no direct yarn-major assertion (covered only through the resolver's own tests)
4 direct tests: both majors, the failure message, and the combined-vs-restore re-resolution
2
Absent-package.json path had no end-to-end coverage — the gap that hid the stderr leak
seedYarnProject gained a packageJson: false option; 2 tests added (see the correction below for what they actually pin)
3
detectYarnMajor lacked the @internal Exported for testing marker used elsewhere
Added, with why the export exists
4
merge-check resolved pmConfig once up front, while the install runs against the combined state
runChecks re-resolves post-merge; the outer resolution is kept for the restore install, which runs after the original branch is checked back out
5
PM_CONFIG.yarn was a classic/berry hybrid beyond ciInstall — held out of scope in the first pass
PM_CONFIG.yarn is now the berry baseline with classic spellings applied by the resolver:
Field
Was
Berry
Classic
Consumer
exec
yarn dlx for everyone
yarn dlx
npx (Yarn 1 has no dlx)
none — table correctness
updatePkg
yarn upgrade for everyone
yarn up
yarn upgrade
getVersionWarning
getVersionWarning prints Run: <updatePkg> sequant, so sequant's own "new version available" hint was telling every berry user to run a command berry removed.version-check.ts now resolves per major.
installSilent is deliberately left at the classic spelling and documented: berry's yarn install takes no --silent, but the field has no consumer anywhere, and guessing berry's quiet spelling with no yarn binary to verify against would trade a dead-config wart for a real one — the same call new-feature.sh's pm_quiet_flag already made for pnpm/bun. Pinned by a test so removing the exemption is deliberate.
Correction to e424f849
That commit's message claimed the stderr leak affected "provisioning a yarn repo with no package.json". It did not. The install is gated on [ ! -d node_modules ] && [ -f package.json ] (#847's non-JS skip), so that path never reaches detect_yarn_major — the leak was only observable calling the function directly. The cat | tr fix is still correct and kept, but it is a footgun removal, not a user-visible bug fix. Writing the end-to-end test is what surfaced this; it now pins the real behavior (install skipped), with a second function-level test pinning the stderr and set -e properties where they are reachable.
Mutation verification
Mutation
Observed
Drop updatePkg from the classic overrides
1 test fails
Revert version-check.ts to unresolved getPackageManagerCommands
Initially nothing failed — the fix was ungated; a test was added, now 1 fails
Revert merge-check to the up-front pre-merge resolution
1 test fails
Revert merge-check to raw PM_CONFIG[pm]
2 tests fail
Delete the [ -f package.json ] install guard
2 tests fail
Row 2 is worth naming: mutation testing caught that my own fix shipped without a gate.
Docs
Both locations updated — docs/features/package-manager-detection.md (separate Yarn 1 / Yarn 2+ command rows plus a major-detection section) and docs/troubleshooting.md (no longer prints one yarn upgrade command for both majors). CHANGELOG's "Not covered" note updated to reflect what is now covered.
Verification
Build and lint clean. Full local suite green on the #880 branch (228 files, 4696 passed, exit 0) — confirming the only prior failure was that flake. CI green on both #876 and #882.
Still open by choice:installSilent's berry spelling, per the reasoning above.
Activity
admarble commentedon Jul 30, 2026
Plan (/spec)
Complexity: Standard (4 ACs) · Scope: SCOPE_WARNING — all three size metrics green; warning raised solely by the missing Non-Goals section. No split needed.
Worktree:
feature/871-pm-config-yarn-ciinstall-uses-yarn-2-immutableAC Checklist
yarn install --frozen-lockfile, Yarn 2+ ->yarn install --immutable, both paths. Verification: Unit Test + Integration Testnew-feature.shciInstall drift guard still passes. Verification: Integration Test--immutablefails the suite. Verification: Integration TestAC lint: 4/4 passed. (Parser auto-tagged AC-4
browser_teston the word "covers" — it is an Integration Test; recommending theno-browser-testlabel so that misdetection cannot pull in a/testphase.)Detection ladder (AC-1) — identical in both paths, most authoritative first
packageManager: "yarn@<major>"inpackage.json.yarnrc.ymlpresentyarn.lockheader containsyarn lockfile v1(first 1024 bytes)Rationale for rung 1 outranking rung 3: flag acceptance is decided by the yarn CLI that runs, not by the lockfile it reads. A yarn-1 lockfile under
packageManager: yarn@4must still get--immutable.Implementation Plan
Phase 1 — TS resolution layer (
src/lib/stacks.ts)YARN_CLASSIC_CI_INSTALL = "yarn install --frozen-lockfile", so the drift guard can see the yarn-1 string too and AC-3's lockstep property holds for both yarn commands.detectYarnMajor(root): 1 | 2implementing the ladder. Reads only the first 1024 bytes ofyarn.lock, matching the shell'shead -c 1024byte-for-byte so the two paths scan the same region.resolvePackageManagerConfig(pm, root): PackageManagerConfig—PM_CONFIG[pm]unchanged for every PM exceptyarn, whereciInstallis swapped on major 1. A drop-in replacement forPM_CONFIG[pm]at root-aware call sites.getPackageManagerCommands(see Conflict Risk below).Phase 2 — TS call sites
5.
worktree-manager.tsinstallWorktreeDeps(:543) and:1225):reinstallIfLockfileChanged(PM_CONFIG[pm]->resolvePackageManagerConfig(pm, worktreePath).6.
merge-check/combined-branch-test.ts:139: same substitution withrepoRoot. Beyond the literal AC-2 wording, folded in deliberately — a third consumer with the identical defect (threeciInstallcommands + two user-facing messages), one line to fix,repoRootalready in hand. Leaving it out shipssequant merge --checkstill broken on Yarn 1. Because the resolver returns a whole config object, every downstreampmConfig.ciInstallread is fixed with no threading changes.Phase 3 — shell path (
templates/scripts/new-feature.sh;scripts/new-feature.shis a symlink, so one file)7. Add
detect_yarn_major()mirroring the same ladder in POSIX sh.8. Make
pm_ci_install'syarn)branch conditional, with both command strings verbatim inside the function body so the scoped drift guard sees them.9.
detect_package_manager()keeps returningyarn— PM identity and yarn major are separate axes, soLOCKFILE_PRIORITYlockstep stays intact by construction.10. Update the header comment that currently promises detection "never reads package.json's
packageManagerfield" — that becomes false for the yarn-major axis and must say so.Phase 4 — tests + changelog
11.
stacks.test.ts: each ladder rung, precedence case (v1 lockfile header +yarn@4=> berry), and a non-yarn passthrough.12.
__tests__/new-feature-frozen-install.integration.test.ts: yarn-1 fixture asserts--frozen-lockfileand never--immutable; berry fixture asserts--immutable. The two existing yarn tests seed a contentlessyarn.lock-> rung 4 -> berry, so they pass unchanged.13. Extend the drift guard to also require
YARN_CLASSIC_CI_INSTALLin thepm_ci_install()body.14. Mutation-verify every new gate test and record results in the PR body (CLAUDE.md, Testing).
15. CHANGELOG entry.
Conflict Risk — #870 is in flight on the same lines
../worktrees/feature/870-.../has uncommitted edits tosrc/lib/stacks.tsandsrc/lib/workflow/worktree-manager.ts: it addsresolvePackageManager(declared, root)right afterdetectPackageManagerSync, and rewrites bothconst pmConfig = PM_CONFIG[pm]sites (:541,:1223) — exactly the lines #871 must touch.Proceeding rather than blocking on uncommitted work, with the surface minimized:
stacks.ts: PM_CONFIG.yarn.ciInstall uses Yarn 2+--immutable, which Yarn 1 rejects — no berry detection exists #871 anchors aftergetPackageManagerCommandsinstead, so the hunks do not overlap — no conflict in this file.worktree-manager.ts: two small mechanical hunks overlap unavoidably. Whichever PR merges second re-fetchesorigin/mainand merges (not rebases).|| "npm"fallback disagrees with the PM-aware shell path on manifest-less projects #870 answers which PM, PM_CONFIG.yarn.ciInstall uses Yarn 2+--immutable, which Yarn 1 rejects — no berry detection exists #871 which config variant for that PM. Post-merge:resolvePackageManagerConfig(resolvePackageManager(packageManager, worktreePath), worktreePath).combined-branch-test.tsis untouched by worktree-manager's bare|| "npm"fallback disagrees with the PM-aware shell path on manifest-less projects #870 — no conflict.Key Decisions
yarn1member to thePackageManagerunion. Arguably the truer model, and the drift guard would cover it for free, butPackageManagersurfaces in settings, doctor,version-check, and templates — a user-visibleyarn1would leak intopmRunand diagnostics. Disproportionate blast radius for a one-flag fix.PackageManagerConfig, not a bare string — one line per call site, and it is the single future home for other berry/classic splits.Risks
/pm_ci_install\(\)\s*\{([\s\S]*?)\n\}/is non-greedy to the first\n}at column 0. A multi-lineif/fiinside thecaseis fine, but any brace reaching column 0 mid-function would silently truncate the captured body — a guard that passes while checking less. Confirmed by mutation (AC-3), not by reading.Open Questions
combined-branch-test.ts? Recommendation: yes (above). If wrong: a one-line revert.PM_CONFIG.yarnis a berry/classic hybrid beyondciInstall—exec: "yarn dlx"is berry-only (Yarn 1 has nodlx), whileupdatePkg: "yarn upgrade"is classic-only (berry usesyarn up). Same root cause as this issue. Recommendation: out of scope, follow-up issue;resolvePackageManagerConfigis the one place it will be fixed.Recommended Workflow
Phases: spec -> exec -> qa · Quality loop: enabled (SCOPE_WARNING)
No
/test(no UI surface). Testgen skipped —bug-label-only per the decision table; tests are targeted and written inline during exec.admarble commentedon Jul 30, 2026
QA Review for Issue #871
Reviewed inline against PR #876 (commit
eba0e131). Quality checks were run inline rather than viasequant-qa-checkersub-agents:.claude/skills/qa/scripts/quality-checks.shaborts on this host (declare: -A: invalid option— macOS bash 3.2, pre-existing and unrelated to this diff), and per repo experience QA agents are unreliable reading worktree code. Every check below was executed directly; commands and outputs are reproducible.AC Coverage
detectYarnMajor(src/lib/stacks.ts:339) +detect_yarn_major(templates/scripts/new-feature.sh:227). All three signals the AC names are implemented:packageManagerpin,.yarnrc.yml,yarn.lockheader. Verified against 9 real fixtures per path.--frozen-lockfile, Yarn 2+ ->--immutable, in both the TypeScript path andnew-feature.shpackageManagerpin whose key and value are on separate lines. The two paths then return opposite majors, so one of them runs the wrong flag. Reproduction below.PM_CONFIGin lockstepYARN_CLASSIC_CI_INSTALL. Regex/pm_ci_install\(\)\s*\{([\s\S]*?)\n\}/still captures the whole body after the yarn arm became multi-line — confirmed by printing the captured region, not assumed.--immutablefails the suite--immutablefails 2 tests. See mutation table.Coverage: 3/4 AC items fully met. Derived ACs: none in the spec plan.
The AC-2 gap (confirmed, reproducible)
package.jsonwith the pin wrapped across lines — legal JSON:{ "packageManager": "[email protected]" }plus a Yarn 1
yarn.lockheader. Result:detect_yarn_major(shell)1(classic)yarn install --frozen-lockfiledetectYarnMajor(TypeScript)2(berry)yarn install --immutableSymmetric — it diverges in both directions. With
"[email protected]"wrapped over a berry lockfile, shell says2and TS says1.Root cause.
sedis line-oriented, so the shell's[[:space:]]*cannot span a newline: rung 1 finds no declaration and falls through to the lockfile header. The TypeScript regex's\s*does match newlines, so it reads the pin. The signal ladders are identical in intent; only the newline handling differs.This is the dual-producer drift class (#833/#847) the issue explicitly exists to close — and it contradicts the comment the diff itself adds at
templates/scripts/new-feature.sh:238andsrc/lib/stacks.ts:264, which claims pinning both paths to the same shape "means they cannot disagree about a given file." The comment states an intent the code does not deliver.Edge-case agreement matrix (10 inputs, both paths):
yarn@4+ v1 lockfileyarn@1+ berry lockfilevolta[email protected](v prefix)package.jsonis a directory+sha224suffix.yarnrc.yml8/10 agree; the two failures are the single wrapped-pin class.
Remediation (one line + one test). Make the shell rung read the file as one stream so it matches the TS regex's newline-spanning
\s*:Then add the wrapped pin (both directions) to the cross-path agreement test in
__tests__/new-feature-frozen-install.integration.test.ts, so the invariant is gated rather than asserted in prose.CI Status
build (22.x)typechecknode-floor-guardvalidate-skillsvalidate-pluginCI Summary: 5 passed, 0 pending, 0 failed. (
build (22.x)was IN_PROGRESS at the start of this review and completed green before the verdict.) No CI-dependent ACs in this issue. Markdown-only relaxation not applicable — the diff contains.tsand.sh.Precheck Findings
Source:
.sequant/gap-precheck.json(schemaVersion 1)Quality Metrics
any/as any) addedit/describeblocksBuild clean (
tsc), lint clean (eslint --max-warnings 0), full suite green (npm test, exit 0).Test Coverage Analysis
src/lib/stacks.tssrc/lib/stacks.test.ts(+9 cases)src/lib/workflow/worktree-manager.tsworktree-manager.frozen-install.test.ts(+4 cases)src/lib/merge-check/combined-branch-test.tscombined-branch-test.test.ts— passes, but no yarn-major casetemplates/scripts/new-feature.sh__tests__/new-feature-frozen-install.integration.test.ts(+5 cases)Coverage: 4/4 changed source files have corresponding tests. No critical-path (auth/payment/security) files touched.
Gap:
combined-branch-test.ts's substitution is covered only transitively — no test asserts thatsequant merge --checkresolves the classic command on a Yarn 1 repo. Low risk (one-line call withrepoRootin scope, and the resolver itself is directly tested), but it is the one changed site with no direct assertion.Mutation Verification
Each new gate was verified by deleting what it asserts (CLAUDE.md § Testing):
--immutable(the literal AC-4 scenario)a Yarn 1 project runs yarn install --frozen-lockfile,a packageManager pin outranks a conflicting lockfile headeryarn install --frozen-lockfilePM_CONFIG[pm]packageManagerrung deleted from the shell ladder onlyexpected 2 to be 1)All mutations reverted; tree matches the committed state. The 4th mutation is notable — the agreement test does catch deliberate shell-only ladder drift. It missed the wrapped-pin divergence only because no fixture exercises that formatting, which is exactly why the remediation adds one.
Code Review
Strengths
resolvePackageManagerConfigreturning a wholePackageManagerConfigrather than a bare string is the right shape: it fixedcombined-branch-test.ts's five downstreamciInstallreads (three commands, two user-facing messages) with a single-line change and no threading.LOCKFILE_PRIORITYlockstep untouched by construction, and avoids leaking a syntheticyarn1into settings/doctor/templates. The rejected alternative is documented with its reason.yarn.lockfixtures keep asserting--immutable— no fixture silently flipped.PM_CONFIG.yarn.ciInstallnow carries an inline warning not to read it directly, which is precisely where the original bug was read from.Issues
packageManagerpins (above). Blocking.new-feature.sh:238andstacks.ts:264both claim the two paths "cannot disagree about a given file" / are pinned "to the same shape". They are not —sedis line-oriented and the JS regex is not. Fixing (1) makes the comment true; leaving the comment while the divergence exists is the intent-vs-effect gap where the next bug hides.combined-branch-test.tsresolves once, up front (:148), before the temp merge branch is created, while the install runs against the combined state. A batch that upgrades yarn 1 -> berry would install with a stale flag. Pre-existing shape (the old code also resolvedpmConfigonce), very unlikely, and out of scope — noting for the record only.Suggestions
detectYarnMajor's only production consumer isresolvePackageManagerConfigin the same module; the export exists for the tests. That is legitimate (it is the cross-path agreement gate) but consider the@internal Exported for testingmarker this codebase already uses oninstallWorktreeDeps, so the export's purpose is explicit.combined-branch-test.tsto close the transitive-only coverage gap noted above.Anti-Pattern Detection
Dependency audit: N/A —
package.jsonunchanged.eval/innerHTMLcatch { return <value>; }instacks.ts(absentpackage.json, absentyarn.lock) are expected-absence paths that fall through to the next signal, not swallowed errors — logging them would emit noise on every npm project.awaitin loopTest Quality Review
child_processmocked in the TS-site tests; yarn-major detection deliberately reads real tmpdir files, which is the behavior under test. Real subprocess + PATH-stubbed package managers in the integration suite.try/finallycleanup. File keeps its.integration.infix, so subprocess tests get the integration project's timeout rather than the 5s unit default (#842).One note: the cross-path agreement test lifts
detect_yarn_majorverbatim out of the real script by regex rather than transcribing it — good, it cannot drift from what provisioning runs.Call-Site Review
New exported symbols: 3
resolvePackageManagerConfigworktree-manager.ts:547,worktree-manager.ts:1231,combined-branch-test.ts:148ciInstall)detectYarnMajorstacks.ts:378(internal to the resolver) + testspm !== "yarn"short-circuits before it runsYARN_CLASSIC_CI_INSTALLstacks.ts:381+ drift guardNo dead exports. No call site inside a loop.
worktree-manager's two sites run after checkout, so the worktree'spackage.json/.yarnrc.yml/yarn.lockare all readable there.Execution Evidence
bash -n templates/scripts/new-feature.shyarn install --frozen-lockfilecapturedyarn install --immutablecaptured./scripts/new-feature.sh 871(this worktree)npm cishellcheckis not installed on this host — noted, not waived.Evidence status: Complete
Script Verification
templates/scripts/new-feature.shchanged, so Section 11 applies. No/verifycomment exists on the issue, and this is a logic change (a new function plus a new branch inpm_ci_install), which Section 11a explicitly lists as NOT overridable. However, execution evidence is stronger than a/verifysmoke run would be: the integration suite drives the real script end to end against throwaway git repos with package managers stubbed onPATH, and captures the exact command each yarn major invokes — plus the script was run live to create this worktree.Status: Verified (by the integration suite driving the real script, per the evidence table above)
Manual Test ACs
N/A — no AC in the spec plan carries
**Verification:** Manual Testor an evidence-naming phrase (corpus check,N samples,against several real …). AC-4's verification is the automated suite, and it was executed and mutation-verified.Behavior-Rule Survival Check
No AC reaches 2 distinct behavior-rule keywords (
default/always/never/rule/behavior/skip) or analways X unless Ypattern.Status: N/A
CLI Registration Verification
N/A — no option interface (
RunOptionsor similar) modified;bin/cli.tsunchanged.Detection Pattern Verification
Omitted — precondition false: no skill markdown files changed (0 files under
.claude/skills/,templates/skills/,skills/).CHANGELOG Verification
CHANGELOG.mdexistsfix(#871):commit)[Unreleased]entry### Fixed, includes(#871), and states what is not coveredResult: CHANGELOG requirements met
Trust-Boundary Check
Finding: Clean — the diff implements only product requirements. The issue body contains no HTML comments, no fenced blocks, and no agent-directed instruction (no command execution, network access, file read/exfiltration, or instruction override). Its process guidance ("Fix both paths in one change") is ordinary maintainer direction from the issue author and was followed as such.
Status: Clean
Risk Assessment
packageManagerpin is wrapped across lines provisions with the wrong flag on one of the two paths —yarn install --immutableon a Yarn 1 project (the original PM_CONFIG.yarn.ciInstall uses Yarn 2+--immutable, which Yarn 1 rejects — no berry detection exists #871 failure) or--frozen-lockfileon berry (yarn 4 rejects it). Everything else about the change is well-bounded: the only behavior that moves is the yarn arm, and non-yarn managers pass through the identical config object.yarnbinary of either major (both suites stub yarn onPATH, so "yarn 1 actually rejects--immutable" is taken from the issue's premise rather than executed);combined-branch-test.ts's call site has no direct yarn-major assertion.PM_CONFIG[pm].ciInstallwere found and fixed —worktree-manager.ts(x2, named in the issue) andmerge-check/combined-branch-test.ts(not named; folded in and disclosed).bin/cli.ts:150,662andversion-check.ts:371usegetPackageManagerCommandsforrun/execonly and never readciInstall, so they are unaffected. Separately:PM_CONFIG.yarnremains a berry/classic hybrid beyondciInstall—exec: "yarn dlx"is berry-only,updatePkg: "yarn upgrade"is classic-only. Same root cause, correctly held out of scope and disclosed in the CHANGELOG and PR body;resolvePackageManagerConfigis now the obvious place to fix them.stacks.ts,PM_CONFIGis the only table of PM command strings and every JS entry was reviewed for major-specific syntax —npm ci,pnpm install --frozen-lockfile, andbun install --frozen-lockfileare all major-agnostic, so yarn is genuinely the only PM needing this axis. Withinnew-feature.sh, the four sibling case tables (pm_lockfile,pm_quiet_flag,pm_run,pm_recovery) were each checked for a yarn arm needing the same split:pm_recovery'syarn installandpm_run'syarnare valid in both majors, andpm_lockfile/pm_quiet_flaghave no major-specific content. No sibling line needs the same fix.Adversarial Re-Read
Findings:
packageManagerdivergence — found by fuzzing 10 edge inputs through both implementations rather than trusting the shared-shape claim in the comment. The structured pipeline did not gate this: every existing test passed, CI was fully green, build and lint were clean. This is the AC-2 blocker.\n\}anchor is non-greedy to the first column-0 brace; the yarn arm becoming a multi-lineifcould have silently truncated the captured region, producing a guard that passes while checking less. Printed the captured body and confirmed all five commands are inside it.eba0e131.origin/mainat branch point; only a lockfile dep bump (chore(deps): bump hono from 4.12.31 to 4.12.32 #873) landed on main since, touching none of these files; PRMERGEABLE; no stashes; no uncommitted work. Separately, worktree-manager's bare|| "npm"fallback disagrees with the PM-aware shell path on manifest-less projects #870 has uncommitted changes rewriting the same twoworktree-manager.tslines — the PR discloses this and the mitigation (differentstacks.tsanchor, so only 2 small hunks overlap; merge, don't rebase).combined-branch-test.ts) is disclosed in the spec comment, the PR body, and the CHANGELOG rather than smuggled in, and theyarn dlx/yarn upgradehybrid is explicitly held out.Status: Gaps Found
(Note: the AC-2 gap is a
PARTIALLY_METacceptance criterion, not merely an adversarial-re-read finding — it drives the verdict through thepartial_count > 0branch, which floors below this section'sGaps Foundceiling.)Verdict: AC_NOT_MET
AC-1, AC-3, and AC-4 are met, and met well — the mutation verification is thorough, the drift guard was extended rather than merely kept passing, and the deliberate scope decisions are all disclosed rather than hidden. The change is close.
AC-2 is PARTIALLY_MET: it requires the Yarn 1 / Yarn 2+ mapping to hold "in both the TypeScript path and
new-feature.sh", and there is a reproducible input class where the two paths return opposite majors, so one of them runs the flag the other major rejects. Per the verdict algorithm,partial_count > 0->AC_NOT_MET.This is a narrow, well-localized defect with a one-line fix and an obvious regression test, not a design problem — the architecture (separate axes, whole-config resolver, extended drift guard) is right and should be kept as-is.
Documentation
Next Steps
package.jsonas a single stream (tr '\n' ' ' < package.json | sed -n '...') so its whitespace handling matches the TypeScript regex's\s*.packageManagerpin — both directions (yarn@4over a v1 lockfile,yarn@1over a berry lockfile) — to the cross-path agreement test, so the invariant is gated instead of asserted in prose.__tests__/new-feature-frozen-install.integration.test.tsandsrc/lib/stacks.test.ts; mutation-verify the new case by reverting thetrchange and confirming it fails.combined-branch-test.ts, and tagdetectYarnMajorwith the@internal Exported for testingmarker used elsewhere in this codebase.fix(#871): make the shell yarn-major read agree with the TS regex
fix(#871): suppress the stderr leak when a yarn repo has no package.json
admarble commentedon Jul 30, 2026
QA Review for Issue #871 (re-run after /loop, iteration 1/2)
Re-reviewed at commit
e424f849. Prior QA was ateba0e131with verdictAC_NOT_MET; stagnation detector confirms new commits since (stagnant: false). Checks run inline for the same reason as the first pass (quality-checks.shneeds bash 4+; this host has 3.2).What changed since the last review
c71f1c55detect_yarn_majorcollapses newlines before matching and takes the first match; corrected the two comments that overclaimed lockstep; 3 regression fixtures added to the cross-path agreement test + 2 direct unit testse424f849AC Coverage
--frozen-lockfile, Yarn 2+ ->--immutable, in both pathspm_ci_install()region re-verified to contain all five commands after the further edits (printed, not assumed).detect_yarn_majoris still liftable by the agreement test's regex.--immutablefails the suiteCoverage: 4/4 AC items fully met. Derived ACs: none.
The AC-2 fix, verified
Root cause was that
sed/grepare line-oriented ([[:space:]]*cannot span a newline) while the JS regex's\s*can.detect_yarn_majornow:cat package.json | tr '\n' ' '— collapses newlines before matching, so a pin wrapped across lines is read on both paths.grep -o … | head -1— takes the first match, matchingString.match. Necessary because of step 1: once the file is one line, a greedysed 's/.*"packageManager"…/'would take the last pin, which is a second, newly-introduced divergence for a file carrying two pins.Both properties are gated independently, each confirmed by its own mutation:
sed)[email protected]fixture:expected 1 to be 2sed(last-match)volta-nested-pin fixture:expected 1 to be 2Neither mutation is caught by the other's fixture — the two cases are not redundant.
Cross-path agreement, 17 inputs, both implementations:
wrapped pin
yarn@4/ wrapped pinyarn@1/ two pins (top-level +volta) / plain pinyarn@4/ plain pinyarn@1/ tab after colon / space before colon /yarn@stable/[email protected]/+sha224suffix / apnpm@9pin / CRLF v1 lockfile / empty lockfile /.yarnrc.ymlpresent /package.jsonis a directory / no lockfile / header past the 1024-byte window — 17/17 AGREE.Both comments that previously overclaimed ("cannot disagree about a given file") now state the actual situation and name the inputs that diverged, in both
new-feature.shandstacks.ts.New finding from this pass (found and fixed in
e424f849)Reviewing the fix rather than only re-checking the original finding surfaced a regression the fix itself introduced:
tr '\n' ' ' < package.json 2>/dev/nulldoes not suppress what it appears to. A failed<redirection is reported by the shell, before the command's own2>/dev/nullapplies — so provisioning a yarn repo with nopackage.jsonprinted a straypackage.json: No such file or directoryto stderr. The originalsed … package.json 2>/dev/nullform passed the path as an argument, so the error was the command's own and genuinely suppressed. Fixed bycat package.json 2>/dev/null | tr ….Behavior was already correct (exit 0, correct major); only the stray line was wrong. Verified after the fix: stderr empty for both the absent-
package.jsonand the no-packageManager-field cases, both still returning the correct major.No test caught this because the integration harness's
seedProjectalways writes apackage.json, so the absent-file path is never exercised end to end. Noted as a coverage gap rather than papered over.set -esafety of the new pipeline (checked explicitly)The new form ends in a pipeline whose
grepexits 1 when there is no pin — underset -epluspipefailthat would abort provisioning for every project without a yarn pin. Confirmed the script sets onlyset -e(line 9), nopipefail, so the pipeline's status is the trailingsed's (0). Exercised directly: both the absent-package.jsonand no-pin cases return the correct major and exit 0 withset -eactive.CI Status
build (22.x)typechecknode-floor-guardvalidate-skillsvalidate-pluginCI Summary: 5 passed, 0 pending, 0 failed, at head
e424f849. Polled to terminal rather than read once.This also supplies the cross-platform evidence the local runs could not:
build (22.x)runsnpm test(.github/workflows/ci.yml:36), and the agreement test liftsdetect_yarn_majorverbatim out of the script and executes it. So the BRE interval expressions (\{0,1\},\{1,\}) andgrep -obehave identically under Linux/GNU grep, not just macOS/BSD grep.Quality Metrics
any/as any) addedit/describeblocksBuild clean, lint clean, 156/156 on the three affected files.
Full local suite: 4717 passed, 1 failed —
src/ui/tui/App.test.tsx > … keeps a running issue's header advancing when a stale completedAt survives. Not a regression: this diff touches no TUI code (the 8 changed files arestacks.ts,worktree-manager.ts,combined-branch-test.ts,new-feature.sh, three test files,CHANGELOG.md), the file passes 4/4 in isolation, the same full suite passed ateba0e131, and CI's full run is green. It is a load-dependent flake in #866's Ink fake-timer test. Reported rather than omitted; not attributed to this change and not fixed here.Test Coverage Analysis
src/lib/stacks.tssrc/lib/stacks.test.ts(+11 cases)src/lib/workflow/worktree-manager.tsworktree-manager.frozen-install.test.ts(+4)src/lib/merge-check/combined-branch-test.tscombined-branch-test.test.ts— passes, no yarn-major casetemplates/scripts/new-feature.sh__tests__/new-feature-frozen-install.integration.test.ts(+5 tests, +3 agreement fixtures)Coverage: 4/4 changed source files have tests. No critical-path files touched.
Remaining gaps (both non-blocking, both stated rather than closed):
combined-branch-test.tshas no direct yarn-major assertion — covered only through the resolver's own tests.package.jsonpath has no end-to-end test, becauseseedProjectalways writes one. This is the gap that let the stderr leak through.Code Review
Strengths
sedtranslation without tripping a test.e424f849is the kind of finding that normally ships: the redirect-vs-argument stderr distinction is invisible unless you actually run the degenerate input.set -e/pipefailinteraction was checked rather than assumed, which is the failure mode that would have been worst (aborting provisioning for every project without a yarn pin).Issues
None blocking. Carried forward from the first pass, unchanged and still out of scope:
combined-branch-test.ts:148resolvespmConfigonce, before the temp merge branch exists, while the install runs against the combined state. Pre-existing shape; a batch that upgraded yarn 1 -> berry would use a stale flag.Suggestions (non-blocking, unchanged from the first pass)
detectYarnMajorthe@internal Exported for testingmarker this codebase uses oninstallWorktreeDeps; its only production consumer is the resolver in the same module.combined-branch-test.ts.seedProjectto omitpackage.jsonon request, so the absent-file path is reachable from the integration harness.Anti-Pattern Detection
Dependency audit: N/A —
package.jsonunchanged.No hardcoded secrets, SQL concatenation,
eval/innerHTML, all-interface binds, uncleared timers, orawait-in-loop in the added lines. The twocatch { return <value>; }blocks instacks.tsremain expected-absence paths that fall through to the next signal, not swallowed errors.Test Quality Review
child_processmocked in the TS-site tests; yarn-major detection reads real files, which is the behavior under test.try/finally;.integration.infix preserved so subprocess tests get the integration timeout (#842).The new agreement fixtures were added to an existing
it, so the file's test count is unchanged at 22 while its assertion count grew — worth knowing when reading the totals.Call-Site Review
Unchanged from the first pass: 3 production call sites for
resolvePackageManagerConfig(worktree-manager.ts:547,:1231,combined-branch-test.ts:148), none in a loop, each passing a root that exists at that point.detectYarnMajorandYARN_CLASSIC_CI_INSTALLare consumed by the resolver and the drift guard respectively. No dead exports.Execution Evidence
bash -n templates/scripts/new-feature.shset -esurvival, absentpackage.jsondetect_yarn_majorunderset -eset -esurvival, nopackageManagerfielddetect_yarn_majorunderset -ebuild (22.x)->npm testEvidence status: Complete.
shellcheckstill not installed on this host — noted, not waived.Script Verification
templates/scripts/new-feature.shchanged. No/verifycomment on the issue, and this is a logic change (not overridable under §11a) — but execution evidence exceeds what a/verifysmoke run gives: the integration suite drives the real script end to end against throwaway git repos with package managers stubbed onPATH, the script was run live to create this worktree, and CI executes the same suite on Linux.Status: Verified
Manual Test ACs
N/A — no AC carries
**Verification:** Manual Testor an evidence-naming phrase. AC-4's verification is automated and was executed plus mutation-verified.Behavior-Rule Survival Check
No AC reaches 2 distinct behavior-rule keywords or an
always X unless Ypattern.Status: N/A
CLI Registration Verification
N/A — no option interface modified;
bin/cli.tsunchanged.Detection Pattern Verification
Omitted — precondition false: no skill markdown files changed.
(Note: the
grep/sedpatterns this PR adds live in a shell script, not in skill markdown, so §6c does not apply. They were nonetheless verified against a 17-input corpus through both implementations, which is what §6c would have demanded had it applied.)CHANGELOG Verification
CHANGELOG.mdexistsfix(#871):commits)[Unreleased]entry### Fixed, includes(#871), states what is not coveredResult: CHANGELOG requirements met. The entry describes the shipped behavior (per-major resolution in both paths) and remains accurate after the two loop commits, which changed how the shell reads the pin, not what the feature does.
Precheck Findings
Source:
.sequant/gap-precheck.json(schemaVersion 1)Trust-Boundary Check
Finding: Clean — the diff implements only product requirements. The issue body contains no HTML comments, no fenced blocks, and no agent-directed instruction (no command execution, network access, file read/exfiltration, or instruction override). Its "Fix both paths in one change" is ordinary maintainer process guidance and was followed as such.
Status: Clean
Risk Assessment
packageManagerpin is written in a shape neither implementation reads the same way. The known shapes are now enumerated and gated (17 inputs), and the two paths are pinned to each other by a test that lifts the real shell function rather than transcribing it, so a future one-sided edit fails rather than drifts. Residual exposure is a new shape nobody has thought of — mitigated by the agreement test being the natural place to add one.yarnbinary of either major (both suites stub yarn onPATH, so "yarn 1 rejects--immutable" rests on the issue's premise);combined-branch-test.ts's call site has no direct yarn-major assertion; the absent-package.jsonprovisioning path has no end-to-end test (the gap that hid the stderr leak).PM_CONFIG[pm].ciInstallwere found and fixed —worktree-manager.ts(x2, named in the issue) andmerge-check/combined-branch-test.ts(not named; folded in and disclosed).bin/cli.ts:150,662andversion-check.ts:371read onlyrun/exec, so they are unaffected. Held out of scope, disclosed:PM_CONFIG.yarnremains a berry/classic hybrid beyondciInstall(exec: "yarn dlx"is berry-only,updatePkg: "yarn upgrade"is classic-only) — same root cause, andresolvePackageManagerConfigis now the single place to fix it.stacks.ts, every JSPM_CONFIGentry was re-checked for major-specific syntax —npm ci,pnpm install --frozen-lockfile,bun install --frozen-lockfileare all major-agnostic, so yarn is genuinely the only PM needing this axis. Innew-feature.sh, the four sibling case tables (pm_lockfile,pm_quiet_flag,pm_run,pm_recovery) were each checked for a yarn arm needing the same split:pm_recovery'syarn installandpm_run'syarnare valid in both majors; the other two have no major-specific content. Additionally, the script was searched for other< fileredirections carrying a misplaced2>/dev/null(thee424f849defect class) — there are none; the only other suppressions are on command arguments.Adversarial Re-Read
Findings:
e424f849— a regression the AC-2 fix itself introduced, invisible unless the degenerate input is actually run.set -e/pipefailinteraction before trusting the new pipeline, because a no-matchgrepinside it would abort provisioning for every project without a yarn pin. Onlyset -eis set; exercised both no-pin cases directly under it.\n\}anchor is non-greedy to the first column-0 brace, and printed output confirms all five commands remain inside it.sedfrom first-match to last-match; that is gated by its own fixture and its own mutation, not folded into the first.build (22.x)runsnpm test, and that the agreement test executes the lifted shell function, so GNU grep is covered too.MERGEABLE, no stashes, no uncommitted work, tree matchese424f849. worktree-manager's bare|| "npm"fallback disagrees with the PM-aware shell path on manifest-less projects #870 still has uncommitted changes to the same twoworktree-manager.tslines — disclosed in the PR with its mitigation; unchanged by the loop commits, which did not touch that file.combined-branch-test.ts) and the one deliberate exclusion (yarn dlx/yarn upgrade) are both disclosed in the spec comment, PR body, and CHANGELOG.Status: Clean
Verdict: READY_FOR_MERGE
The AC-2 divergence that blocked the previous pass is closed and, more importantly, gated: the cross-path invariant is now enforced by a test that lifts the real shell function out of the real script, with each of the fix's two properties proven by its own independent failing mutation. All 4 ACs are MET, CI is green at head on Linux, and the loop's own fix received an adversarial pass that caught a further regression it had introduced.
The three remaining items are non-blocking and stated rather than hidden: no direct yarn-major assertion for
combined-branch-test.ts, no end-to-end coverage of the absent-package.jsonpath, and the pre-existing once-up-frontpmConfigresolution in merge-check. None of them affects an AC.One coordination note for the merge, not a defect: #870 has in-flight uncommitted work on the same two
worktree-manager.tslines. Whichever PR merges second should mergeorigin/main(not rebase — force-push is hook-blocked) and resolve two small mechanical hunks. The designs compose: #870 answers which package manager, this answers which config variant for that manager.Documentation
Next Steps
|| "npm"fallback disagrees with the PM-aware shell path on manifest-less projects #870 per the note above.combined-branch-test.ts; the@internal Exported for testingmarker ondetectYarnMajor; an opt-out inseedProjectso the absent-package.jsonpath is reachable end to end.exec: "yarn dlx"/updatePkg: "yarn upgrade"berry-classic hybrid inPM_CONFIG.yarn.src/ui/tui/App.test.tsx's stale-completedAttest is a load-dependent flake worth its own issue.admarble commentedon Jul 30, 2026
/fullsolve Complete
Issue: #871 · Status: READY_FOR_MERGE · PR: #876
Progress
no-browser-testlabel added)AC_NOT_MET-> /loop ->READY_FOR_MERGEAC Coverage — 4/4 MET
--frozen-lockfile, Yarn 2+ ->--immutable, both paths--immutablefails the suiteWhat QA caught
The first exec commit shipped a real bug. For a
packageManagerpin wrapped across lines — legal JSON — the shell and TypeScript detectors returned opposite majors, so one provisioning path ran the flag the other major rejects. That is the dual-producer drift class this issue exists to close, and it contradicted the comment the commit itself added. Found by fuzzing 17 edge inputs through both implementations rather than trusting the shared-shape claim; CI was fully green and every existing test passed at the time.Re-reviewing the fix then caught a second defect it had introduced:
tr … < package.json 2>/dev/nulldoes not suppress a failed<redirection (the shell reports it before the command's own redirect applies), leaking a stray stderr line during provisioning.Quality
e424f849), all 5 checksset -e/pipefailaudited so a no-matchgrepcannot abort provisioningNotes for the merge
|| "npm"fallback disagrees with the PM-aware shell path on manifest-less projects #870 — it has uncommitted work on the same twoworktree-manager.tslines. Mergeorigin/main(do not rebase; force-push is hook-blocked) and resolve two small mechanical hunks. The designs compose: worktree-manager's bare|| "npm"fallback disagrees with the PM-aware shell path on manifest-less projects #870 answers which package manager, this answers which config variant for that manager.merge-check/combined-branch-test.tswas a third consumer with the identical defect and is fixed by the same one-line substitution.PM_CONFIG.yarnis still a berry/classic hybrid beyondciInstall(exec: "yarn dlx"is berry-only,updatePkg: "yarn upgrade"is classic-only). Same root cause;resolvePackageManagerConfigis now the one place to fix it.src/ui/tui/App.test.tsx's stale-completedAttest (fix(tui): completed issue box keeps counting — ElapsedTimer never freezes at completedAt #866) is load-sensitive — passes in isolation and in CI. Worth its own issue.Ready for human review and merge.
fix(#871): close the remaining yarn classic/berry hybrids and QA cove…
test(#871): gate the per-major upgrade hint
admarble commentedon Jul 30, 2026
All QA-recorded gaps closed
Every gap the two QA passes recorded as non-blocking is now fixed in PR #876, plus one correction to a claim an earlier commit's message overstated. CI green at head, mergeable.
combined-branch-test.tshad no direct yarn-major assertion (covered only through the resolver's own tests)package.jsonpath had no end-to-end coverage — the gap that hid the stderr leakseedYarnProjectgained apackageJson: falseoption; 2 tests added (see the correction below for what they actually pin)detectYarnMajorlacked the@internal Exported for testingmarker used elsewherepmConfigonce up front, while the install runs against the combined staterunChecksre-resolves post-merge; the outer resolution is kept for the restore install, which runs after the original branch is checked back outPM_CONFIG.yarnwas a classic/berry hybrid beyondciInstall— held out of scope in the first passApp.test.tsxload flakeGap 5 contained a live user-facing bug
PM_CONFIG.yarnis now the berry baseline with classic spellings applied by the resolver:execyarn dlxfor everyoneyarn dlxnpx(Yarn 1 has nodlx)updatePkgyarn upgradefor everyoneyarn upyarn upgradegetVersionWarninggetVersionWarningprintsRun: <updatePkg> sequant, so sequant's own "new version available" hint was telling every berry user to run a command berry removed.version-check.tsnow resolves per major.installSilentis deliberately left at the classic spelling and documented: berry'syarn installtakes no--silent, but the field has no consumer anywhere, and guessing berry's quiet spelling with no yarn binary to verify against would trade a dead-config wart for a real one — the same callnew-feature.sh'spm_quiet_flagalready made for pnpm/bun. Pinned by a test so removing the exemption is deliberate.Correction to
e424f849That commit's message claimed the stderr leak affected "provisioning a yarn repo with no package.json". It did not. The install is gated on
[ ! -d node_modules ] && [ -f package.json ](#847's non-JS skip), so that path never reachesdetect_yarn_major— the leak was only observable calling the function directly. Thecat | trfix is still correct and kept, but it is a footgun removal, not a user-visible bug fix. Writing the end-to-end test is what surfaced this; it now pins the real behavior (install skipped), with a second function-level test pinning the stderr andset -eproperties where they are reachable.Mutation verification
updatePkgfrom the classic overridesversion-check.tsto unresolvedgetPackageManagerCommandsPM_CONFIG[pm][ -f package.json ]install guardRow 2 is worth naming: mutation testing caught that my own fix shipped without a gate.
Docs
Both locations updated —
docs/features/package-manager-detection.md(separate Yarn 1 / Yarn 2+ command rows plus a major-detection section) anddocs/troubleshooting.md(no longer prints one yarn upgrade command for both majors). CHANGELOG's "Not covered" note updated to reflect what is now covered.Verification
Build and lint clean. Full local suite green on the #880 branch (228 files, 4696 passed, exit 0) — confirming the only prior failure was that flake. CI green on both #876 and #882.
Still open by choice:
installSilent's berry spelling, per the reasoning above.feat(locks): checkout-scoped lock for the shared working tree (#901) (#…
fix(#911): close QA gaps — after-push rollback release site, sentinel…
fix(#911): /merger and /release participate in the checkout lock (#917)
fix(#960): close sentinel-rename drift hole; map embedded gap list to…
fix(#960): /loop's orchestrated Step 1A trusts embedded promptContext…
fix(#911): close QA gaps — after-push rollback release site, sentinel…