Repository navigation
Description
Tier: mechanical Found: 2026-09-11, first field run of v2.15.0 across 12 local projects Related: #990 (AC-5 covers fresh installs only)
What happened
In every project without a local node_modules/sequant, npx [email protected] sync printed
! scripts/dev templates dir is outside the project tree (npx cache or a sibling checkout) — copying instead of symlinking; pass --no-symlinks to silence
✔ Synced to v2.15.0
but left the pre-existing symlinks exactly as they were:
| project | scripts/dev/*.sh after sync |
|---|---|
| vid-gen | -> ../../../../.npm/_npx/90a139d9a7555efa/node_modules/sequant/templates/scripts/… (a 2.12.0 npx cache) |
| pm-projects, varius | -> ../../../../.npm/_npx/38ae72183b73fa32/… |
| ad-motion, matcha-maps | -> ../../../sequant/templates/scripts/… (sibling dev checkout) |
sequant doctor then reports each link as points outside the project (machine-specific target) - run: sequant sync (re-links scripts/dev …) — and sync does not change it. The two commands point at each other.
Projects with node_modules/sequant (job-scout, sequant-landing, workout, workout-admin, sequant-demo-video) were repointed correctly (-> ../../node_modules/sequant/templates/scripts/…), so AC-4 holds; the gap is the copy branch on an existing link.
Likely cause
copyTemplates' copy mode skips a destination that already exists unless --force, and the existing entry is a symlink; #990 AC-5's test starts from an empty scripts/dev, so it never exercised "foreign link present → copy should replace it".
Release-graph plan — guard-2026-09 (2026-09-20)
Graph: guard-2026-09 Tier: mechanical Wave: 1
May touch: src/lib/templates.ts (copyTemplates copy branch), src/lib/templates.test.ts (append cases only — #1106 deletes a block in this file in the same wave), src/commands/doctor.ts, src/commands/doctor.test.ts, src/commands/sync.ts, src/commands/sync.test.ts, CHANGELOG.md
The npm run build && npm test AC is verified by the runner from a clean shell after the PR opens (PLAN I-1); the agent runs only the test files its ACs name. Mutation markers use failedTest starting with the test file path (I-4). #1097 AC-3 asserts this issue's AC-1 cell inside the writer matrix, so the test name replaces a foreign symlink is a contract.
Acceptance criteria
- AC-1: in copy mode, an existing
scripts/dev/*.shsymlink (any target) is replaced by a copy; an existing regular file is left alone without--force— Verify:npx vitest run src/lib/templates.test.ts -t "replaces a foreign symlink"→ temp project seeded with a link into a fake_npxpath,copyTemplatesin copy mode →isSymlinkfalse, file content equals the template. Mutation: restore the exists-skip for symlinks → fails; restore. - AC-2:
doctornever recommends a command that will not change the link: on a machine-specific link it says which ofsync(localnode_modules/sequantpresent) ornpm install sequant --save-dev && sequant syncapplies — Verify:npx vitest run src/commands/doctor.test.ts -t "machine-specific"→ message names the applicable fix; no--force. - AC-3:
sync --dry-runlists each foreign link it will replace with a copy (old → (copy)), so I-2 holds for this path — Verify:npx vitest run src/commands/sync.test.ts -t "copy mode preview". - AC-4: suite green —
npm run build && npm test.
Activity
admarble commentedon Sep 20, 2026
Runner context — guard-2026-09 launch, 2026-09-20. Base:
origin/mainatda9ed6e8(2.16.0 plus the plan docs). These rules override the exec skill's defaults for this run:npm testin the worktree. Run only the test files this issue's ACs name. The runner runs the full suite once per PR from a clean shell. Undersequant runthe suite is not hermetic againstSEQUANT_*(bug(test): suite isn't hermetic against the SEQUANT_* env phases inject — exec sees red tests it didn't cause and opens no PR #1086), so a full run shows red files you did not cause.env -u SEQUANT_ORCHESTRATOR -u SEQUANT_WORKTREE -u SEQUANT_PHASE -u SEQUANT_ISSUE -u SEQUANT_RELAY -u SEQUANT_RELAY_FRAME npx vitest run <file>. If it is still red, the PR body names the issue number and the base-vs-head result for that test.<!-- SEQUANT_MUTATION: {"ac":"AC-N","mutation":"<what you deleted>","failedTest":"<test file path> > <describe> > <case>"} -->in the PR body.failedTestMUST start with the test file path, or the qa classifier reports it Failed. Commit before mutating.timeout.git commit -m "...", noCo-Authored-By. Never rebase or force-push after pushing. One AC per line in the PR body, idsAC-Nonly.Issue-specific: In
src/lib/templates.test.tsappend cases only; #1106 deletes the old side-(b) block in the same file concurrently, so do not reorder or reformat existing blocks. #1097 later asserts your AC-1 cell by the test namereplaces a foreign symlink, so keep that name exact.admarble commentedon Sep 20, 2026
Complexity: Standard (4 ACs, 3 directories)
AC Quality Check
All four ACs carry a
Verify:command and an outcome, so there is no vague, unmeasurable or open-ended wording. Two are precise but rest on wrong or ambiguous premises:copyDirskips existing destinations. It doesn't. See Diagnosis.--force" conflicts with sync's current behavior. See Open Question 1.npm install … && sequant sync" is stricter than needed once AC-1 lands. See Open Question 2.Scope Assessment
Non-Goals:⚠️ Not stated in the issue. Proposed: no change to symlink mode (
symlinkDir), the #990 target resolver, or the--no-symlinksflag.src/lib,src/commands, rootCHANGELOG.md)Verdict: ✅ SCOPE_OK
Diagnosis (differs from the issue's "Likely cause")
The issue says copy mode skips an existing destination. It doesn't.
copyDir(src/lib/templates.ts:~1000) has no exists-skip forscripts/dev. It reads the template and callswriteFile(destPath, content), which isfsWriteFileand follows symlinks. I checked with a scratch link into a fake cache dir:So in copy mode against a foreign link, sync:
_npxcache or the sibling dev checkout'stemplates/scripts/(ad-motion and matcha-maps). That second effect is worse than the reported one and is not in the issue.The fix is the same: unlink a symlink destination before writing. Both tests must assert the link target was not modified, or the write-through goes unguarded.
Acceptance Criteria
AC-1: copy mode replaces a foreign symlink; regular file left alone without
--forceVerification: Unit Test (real fs,
src/lib/templates.test.ts, inside the existingscripts/dev symlink target routing (#990)fixture)Scenario: Given a temp project with no local
node_modules/sequant, a templates dir outside cwd (→ copy mode), andscripts/dev/new-feature.shsymlinked into a fake_npxfile → WhencopyTemplates("generic")runs → ThenisSymlinkis false, content equals the template, and the fake_npxfile is byte-identical to before (write-through guard).Test name (contract):
replaces a foreign symlink. #1097 AC-3 asserts it, so keep it exact. Append only; #1106 edits the same file concurrently.Mutation (corrected): delete the
removeFileOrSymlinkcall added for symlink destinations incopyDir→ the test fails; restore. MarkerfailedTest=src/lib/templates.test.ts > … > replaces a foreign symlink.Assumptions: a broken link (target missing) behaves the same.
unlinkhandles it. Add a second case for that in the same describe block.AC-2: doctor names the fix that will actually change the link
Verification: Unit Test (
src/commands/doctor.test.ts -t "machine-specific")Scenario: Given a foreign, existing link target and no
node_modules/sequant/templates/scripts→ Then the message containsnpm install sequant --save-dev && sequant sync. Given that dir present → Then it saysrun: sequant sync. Neither contains--force.Assumptions: doctor.test.ts mocks
fs/promisesandexistsSync. The "local present" cell needsexistsSyncstubbed for that path. The existing test at line ~1219 (toContain("run: sequant sync")) must be updated for the no-local case. Both cells go under a describe/it name containing "machine-specific".AC-3:
sync --dry-runlists each foreign link it will replace asold → (copy)Verification: Unit Test (
src/commands/sync.test.ts -t "copy mode preview") plus a real-fs unit test onpreviewScriptsSymlinkTargets(see Derived AC-5)Scenario: Given
previewScriptsSymlinkTargetsreturns{path, oldTarget:"../…/_npx/…", newTarget:"(copy)", changed:true}→ WhensyncCommand({dryRun:true})→ Then output containsscripts/dev/x.sh: <old> → (copy).Assumptions: sync.test.ts mocks
previewScriptsSymlinkTargets, so this test only proves the printer. The real behavior lives in the derived test below.AC-4: suite green
Verification:
npm run build && npm test, run by the runner from a clean shell after the PR opens (per the runner-context comment). The agent runs only the three named test files.Implementation Plan
Phase 1: templates.ts (AC-1, AC-3)
copyDir's write step, beforewriteFile(destPath, content),lstatthe destination. If it is a symlink,removeFileOrSymlink(destPath).isSymlinkandremoveFileOrSymlinkare already imported. Symlink removal is unconditional (matchessymlinkDir, "symlinks are always replaced").scripts/devcopy call only, gated onoptions.force. Sync passesforce:true, so refresh is unchanged.initpasses none, so it leaves existing files alone.previewScriptsSymlinkTargets: whentarget.mode === "copy"(and not--no-symlinks/Windows), walkscripts/devand emit{oldTarget: <link target>, newTarget: "(copy)", changed: true}for each destination that is a symlink. The existing sync printer (${path}: ${old} → ${new}) then renders the AC-3 format with no sync.ts change. Files with no symlink produce no entry.Phase 2: doctor.ts (AC-2)
checkScriptsDevLinks's machine-specific branch, computehasLocalSequant = existsSync(join(nodeModulesSequant,"templates","scripts")), the same predicateresolveScriptsSymlinkTargetuses. Branch the message. Leave the dead-symlink branch as is: plain sync still fixes it, since the target then resolves.Phase 3: tests, changelog
CHANGELOG.mdentry under Unreleased.sync.tsneeds no change unless the printer text must differ. It is in the "may touch" list only as a fallback.Rule Touchpoints
Not triggered. The ACs have no
default/always/never/rule/behavior/skipkeyword pairs.Design Review
copyTemplates' copy branch, the one writer for scripts. Doctor and the preview only reflect what that writer does.writeFilewithO_NOFOLLOW, because it would fail instead of replace. Rejected: teachingwriteFileinsrc/lib/fs.tsto unlink symlinks globally, because it is shared by every writer (.claude/settings.json, the version marker) and widens blast radius. Unlinking incopyDiralso affects every tree it copies (skills, agents, hooks). That is harmless and arguably correct, since a symlinked skill file would otherwise be written through, but the tests only coverscripts/dev.symlinkDir(templates.ts:806) already removes existing symlinks and skips regular files unlessforce. The copy branch should mirror it.npm installwhen sync alone now fixes it?" See Open Question 2. And "why does the preview say(copy)for a file whose content might already match?" Preview lists every symlink that will be replaced, which is the I-2 contract, so listing all of them is right.Feature Quality Planning
Notable items:
templates/scripts/*.shwith rendered content. For ad-motion and matcha-maps that meansgit statusin the siblingsequantcheckout may show modified template scripts. Worth a one-line check before closing.--no-symlinkshit the same branch, so both are fixed. Symlinks are uncommon there.copyTemplatescall leaves it a regular file.Derived ACs
templates.test.tsthatpreviewScriptsSymlinkTargetsin copy mode returnsold → (copy)for a foreign link and nothing for a regular file. AC-3's sync test mocks this function, so nothing else proves it. Mutation: return[]in copy mode → fails.Open Questions
--force" vs. sync today.copyDircurrently overwrites regularscripts/devfiles, andsyncrefreshes stale copies on Windows and--no-symlinks. A literal reading that ignoresforcewould freeze those copies at their install-time version. Recommendation: gate onoptions.force. Sync always passesforce:true, so sync behavior is unchanged, andinitand direct callers get the AC's "left alone" behavior. Impact if wrong: copy-mode users stop getting script updates fromsync.sequant syncalso clears the warning without a local install, by replacing the link with a copy. Recommendation: follow the AC as written, but phrase the no-local message assequant sync(replaces the link with a copy), ornpm install sequant --save-dev && sequant syncto keep a link. It must contain thenpm installstring so the AC-2 test can match it. Impact if wrong: low. It is a message.git -C ../sequant statusin ad-motion and matcha-maps' sibling checkout? Recommendation: yes, as a note in the PR body, not code.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: Bug fix, ~30 lines of source, and the ACs have explicit verify commands.
testgenis skipped (buglabel only, and the ACs name their tests). No UI, no security-sensitive surface (a symlinkunlinkinsidescripts/devonly).Label Review
Current: bug
Recommended: bug, planned
Reason: planning complete.
Quality Loop: won't auto-enable (SCOPE_OK, no
complex/refactor/breakinglabel).admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 0/6 met
Gaps:
test(#1053): doctor fixture leaves a pre-existing node_modules/sequan…
chore(#1053): merge origin/main
fix(#1053): copy-mode sync replaces foreign scripts/dev symlinks; doc…
test(#1097): writer state-matrix — init/sync/update × every destinati…
fix(#1122): writers replace a symlink and skip a directory at a templ…