Skip to content

fix(sync): plain sync and doctor still steer a skills-only install into a full install — sync ignores the recorded scope, doctor names bare sync #1485

Closed

Description

@admarble

Epic: graph-2026-10-freeze-c Tier: mechanical Execution: sequant_run

Owner ruling (2026-10-17, plan OQ-1): a plain sync keeps a skills-only scope. Widening to a full install is deliberate, through sequant init.

Follow-up from #1409 (PR #1467). #1409's spec raised these as OQ-1 and OQ-2, and its QA marked both unresolved. #1482 is the sibling node for update.

Problem

#1409 records the install scope (groups: ["skills"]), and scopedRemedy (src/commands/sync.ts:107) gives a partial install a fix that rewrites skills only. Plain sync never reads the scope for what it writes, and two of the commands that print a fix message ignore it too. They steer a skills-only install into a full install, which writes the hooks, agents and .claude/settings.json the install skipped. A --force sync also overwrites the repo's constitution (#814).

Observed on main @ 0857484 (dev CLI, temp repo, init --manifest-only + sync --only skills):

Acceptance Criteria

  • AC-1: On a manifest with groups: ["skills"] at a matching version, plain sync (no --only) counts drift only inside the install scope. With .claude/skills/ matching the bundle it reports up to date and exits 0. With one skill file edited it reports exactly that one file, names sync --only skills --force, and exits 1. Evidence: npx vitest run src/commands/sync.install-scope.integration.test.ts -t "plain sync on a skills-only install" reports ≥ 1 passed and 0 failed (a filter that matches nothing reports all skipped and exits 0), mutation-verified by restoring the unscoped change set in the report-only fast path.
  • AC-2: On a manifest with groups: ["skills"] and outdated skills, doctor's Skills Version check names sync --only skills (the scopedRemedy text), never a bare sync. A full install keeps its current message. Evidence: npx vitest run src/commands/doctor.test.ts -t "scoped install remedy" reports ≥ 1 passed and 0 failed (a filter that matches nothing reports all skipped and exits 0), mutation-verified by restoring the bare sync remedy in the Skills Version check.
  • AC-3: On a manifest without groups, when .claude/hooks/, .claude/settings.json and .claude/agents/ are all absent, doctor adds one advisory line. It says the install reads as full and names the edit "groups": ["skills"] in .sequant-manifest.json. The line is never printed when any of the three exists, or when groups is present. getInstallScope is unchanged. Evidence: npx vitest run src/commands/doctor.test.ts -t "legacy skills-only manifest" reports ≥ 1 passed and 0 failed (a filter that matches nothing reports all skipped and exits 0), mutation-verified by deleting the advisory check.
  • AC-4: No fix message printed for a partial install names update, sync --force without --only skills, or a bare sync. A test checks every per-install producer through scopedRemedy: checkAndWarnSkillsOutdated (sync.ts:939, :954), getSkillsInstallStatus (version-preflight.ts:146), the plain-sync fast path and doctor. Evidence: npx vitest run src/commands/sync.install-scope.integration.test.ts -t "no remedy widens a partial install" reports ≥ 1 passed and 0 failed (a filter that matches nothing reports all skipped and exits 0), mutation-verified by replacing scopedRemedy's partial branch with the full-install text.
  • AC-5: On a manifest with groups: ["skills"] and .claude/skills/.sequant-version older than the package, a plain sync (no --only) writes only under .claude/skills/: .claude/hooks/, .claude/agents/ and .claude/settings.json stay absent, and the manifest keeps groups: ["skills"]. sync --dry-run previews the same scoped set. A manifest without groups still gets a full sync. The fix(sync): a --only skills install warns 'N file(s) differ' forever, and the suggested sync --force overwrites the repo's constitution #1409 test AC-4: a full sync on a skills-only install records a full install is rewritten to this outcome. Evidence: npx vitest run src/commands/sync.install-scope.integration.test.ts -t "plain sync keeps a skills-only scope" reports ≥ 1 passed and 0 failed (a filter that matches nothing reports all skipped and exits 0), mutation-verified by deriving skillsOnly from --only alone again.
  • AC-6: ADR-0015 says a plain sync keeps a partial scope and that sequant init is the way to widen it to a full install. Evidence: sed -n '/^## Decision/,/^## Options/p' docs/adr/0015-install-scope-recorded-in-manifest.md | grep -c "sequant init" prints ≥ 1 (0 today).

Prior fixes / producers

May touch

src/commands/sync.ts (the effective scope at :460, the report-only fast path, scopedRemedy), src/commands/doctor.ts (Skills Version check, new advisory line), src/mcp/server.ts:46 (text only), src/commands/doctor.test.ts, src/commands/sync.install-scope.integration.test.ts, src/commands/sync.test.ts, docs/adr/0015-install-scope-recorded-in-manifest.md (the plain-sync sentences), CHANGELOG.md (including the unreleased #1409 entry's "a full sync … removes it").

Non-Goals

Activity

  1. added
    bug
    graph-2026-10-freeze-c
    on Oct 17, 2026
  2. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    Runner context (graph-2026-10-freeze-c, wave 2). Both blockers are merged. Repo state on main 96990da:

  3. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (6 ACs, 5 directories)

    AC Quality Check

    All six ACs are single-line, carry Evidence: with a -t filter, and name a mutation. Notes:

    • AC-1..AC-5 filters match test names that don't exist yet, so they fail today (not vacuous). Each uses the ≥1 passed guard.
    • AC-6 grep -c "sequant init" prints 0 today, so it fails before the change (good).
    • AC-4's "every producer" is enumerable from the issue's producer list; the test should iterate them, not spot-check.

    Scope Assessment

    Non-Goals: present in the issue body (no inference in getInstallScope, update, groups: [], no widen flag, doctor.ts:684, plugin/skills dirs).

    Metric Value Status
    Feature count 1 (scope-aware sync/doctor) ✅
    AC items 6 ✅
    Directory spread 5 (src/commands, src/mcp, src/lib-read-only, docs/adr, root) ⚠️

    Verdict: ✅ SCOPE_OK

    Acceptance Criteria

    AC-1: plain sync fast path counts drift inside the install scope

    Verification: Integration Test
    Scenario: Given groups:["skills"], matching version → When sync → Then up to date/exit 0; with one skill edited, exactly 1 file, names sync --only skills --force, exit 1.
    Assumptions: fast path at sync.ts:537-583 can reuse filterToInstallScope.

    AC-2: doctor Skills Version remedy is scoped

    Verification: Unit Test (doctor.test.ts, "scoped install remedy")
    Scenario: Given partial manifest and outdated skills → When doctor → Then message names sync --only skills; full install unchanged.

    AC-3: legacy skills-only advisory

    Verification: Unit Test ("legacy skills-only manifest")
    Scenario: Given manifest without groups, and hooks/, settings.json, agents/ all absent → advisory naming "groups": ["skills"]; absent when any exists or groups present.

    AC-4: no partial-install remedy widens

    Verification: Integration Test ("no remedy widens a partial install")
    Scenario: Given a partial scope → each producer (checkAndWarnSkillsOutdated ×2, getSkillsInstallStatus, fast path, doctor) output contains none of update, sync --force without --only skills, bare sync.

    AC-5: plain sync keeps a skills-only scope

    Verification: Integration Test ("plain sync keeps a skills-only scope")
    Scenario: Given groups:["skills"], older .sequant-version → sync writes only under .claude/skills/; manifest keeps groups; --dry-run previews the same set; no groups → full sync. Rewrite #1409's "AC-4: a full sync on a skills-only install records a full install".

    AC-6: ADR-0015 Decision names sequant init

    Verification: Manual/command (sed … | grep -c "sequant init" ≥ 1)

    Implementation Plan

    Phase 1: Single effective scope in sync (AC-1, AC-5)

    1. sync.ts:460: derive skillsOnly = only === "skills" || scope is partial once, after the manifest is read. Partial means kind==="partial" and groups non-empty (groups: [] stays full, per Non-Goals). Skip skillsOnly side effects only for manifest-derived case as needed: the manifest write at :827 must keep groups (use addGroup:"skills", which is a no-op on an existing skills scope).
    2. Verify every consumer of skillsOnly (:517, :539, :551, :607, :624-635, :754, :827, :833, :876, :887) behaves correctly with the derived value. Fast-path scoping (AC-1) then falls out. Check the remedy at :578 goes through scopedRemedy.
    3. Edge: a partial scope without the skills group (e.g. ["hooks"] if possible) — filterToInstallScope returns []; confirm that does not make plain sync a silent no-op trap; fall back to full only for groups: [].

    Phase 2: Route messages through scopedRemedy (AC-2, AC-3, AC-4)

    1. doctor.ts:649: read getInstallScope(manifest) (manifest is already read at :595), use scopedRemedy(scope, cli, true) ?? \${cli} sync`. Needs scopedRemedyimported from./sync.js`.
    2. doctor.ts: add the legacy advisory (no groups, hooks/settings.json/agents absent). Use fileExists. Do not change getInstallScope.
    3. mcp/server.ts:46: reword sequant update (text only; check any test pinning that string).
    4. Fast-path remedy at sync.ts:578 uses scopedRemedy, not a local ternary.

    Phase 3: Tests, ADR, changelog

    1. Add the tests named in the ACs to sync.install-scope.integration.test.ts and doctor.test.ts; rewrite fix(sync): a --only skills install warns 'N file(s) differ' forever, and the suggested sync --force overwrites the repo's constitution #1409's AC-4 test.
    2. Mock gaps: doctor.test.ts mocks ../lib/manifest.js without getInstallScope and ./sync.js without scopedRemedy (:36, :49). Add both. Also check run.test.ts, run-preflight-exit.test.ts, init.test.ts mocks of manifest.js (grep vi.mock(".*manifest before pushing).
    3. ADR-0015 Decision: add the plain-sync-keeps-scope sentence plus sequant init to widen. Leave the update sentences. CHANGELOG: fix the unreleased fix(sync): a --only skills install warns 'N file(s) differ' forever, and the suggested sync --force overwrites the repo's constitution #1409 "a full sync … removes it" line.
    4. Run mutation checks per CLAUDE.md and record Mutation-verified: AC-N — … markers with the FILE path before the first > in the PR body.

    Design Review

    1. Where does the logic belong? The effective scope is resolved once in syncCommand; message text in scopedRemedy; getInstallScope stays the only reader of the manifest field.
    2. Simplest correct approach? One derived skillsOnly, and all producers call scopedRemedy. Rejected: patching each consumer, and a --full flag (Non-Goal).
    3. Existing pattern / re-patch count: fix-message text has been patched 7 times (fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708, fix(sync): areSkillsOutdated/checkAndWarnSkillsOutdated pre-flight is version-only — misses content drift (sibling of #708) #713, fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814, fix: recommend the CLI invocation that reaches the running build #898, fix(cli): preAction auto-sync fires on serve — the plugin's @latest MCP server silently rewrites .claude/hooks, skills, AGENTS.md in every project it starts in (#793 pin never ships via marketplace source "./") #988, fix(sync): never rewrite a user-owned AGENTS.md or write a machine-specific scripts/dev symlink (absorbs #991) #990, fix(sync): a --only skills install warns 'N file(s) differ' forever, and the suggested sync --force overwrites the repo's constitution #1409) — the issue already treats this as a class. The plan fixes the class by routing every per-install producer through scopedRemedy and asserting all of them in one AC-4 test, rather than one more local patch. Recorded as class fix, not deliberately local.
    4. Reviewer challenge: "Why not infer scope from disk?" — owner ruling (inference can't tell skipped from deleted). "Why does plain sync not widen?" — owner ruling 2026-10-17 (OQ-1).
    5. Producers/consumers: producers of the remedy: sync.ts fast path, checkAndWarnSkillsOutdated (×2), version-preflight.ts:146, doctor.ts:649, mcp/server.ts:46 (static). Consumers of skillsOnly: the ten sites listed in step 2. Only one resolver after this change.

    Feature Quality Planning

    All standard checks pass. Notable items:

    • Behavior-rule ACs (AC-5 "keeps", "never"): touchpoints are sync.ts (runtime) and ADR-0015; no skill-prompt touchpoint, and the plugin freeze forbids touching skills dirs anyway.
    • Silent-narrowing risk: someone on a hand-edited groups:["skills"] manifest now can't widen via sync; the message must point to sequant init. Include that in the sync output when the scope is kept (small, no new AC).

    Open Questions

    1. Does a keep-scope plain sync print a note? — Recommendation: one gray line "install scope: skills only (widen with sequant init)". Impact: discoverability only; no AC depends on it.
    2. Partial scope that lacks skills — Recommendation: treat as skills-only write set is wrong; make plain sync a reported no-op. Impact: edge case; no current command writes such a manifest.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: CLI/text change with Integration/Unit Test ACs declared via Evidence:; tests are named in the ACs so testgen is skipped. No UI. Bug label, 1 feature.

    Label Review

    Current: bug, graph-2026-10-freeze-c
    Recommended: + planned
    Reason: plan posted
    Quality Loop: Won't auto-enable (SCOPE_OK).

  4. added
    planned
    on Oct 18, 2026
  5. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_NOT_MET

    AC coverage: 5/6 met

    Gaps:

    • AC-4's required test does not check the doctor producer through the real scopedRemedy, so AC-4's own mutation would not fail for doctor
    • Mutation records for AC-4 and AC-5 are missing; add the markers to exec's final ## Summary
    • Required test CI check still pending
    • On a groups: [] manifest at a matching version, the remedy names sync --only skills --force, which cannot clear non-skills drift — dropped: groups: [] is a Non-Goal and the case is not reachable in practice
  6. added a commit that references this issue on Oct 18, 2026
  7. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #1485

    AC Coverage

    AC Description Status Notes
    AC-1 Plain sync fast path scoped to a skills-only install MET -t "plain sync on a skills-only install" 1 passed. Mutating sync.ts:552 back to allChanges fails exactly that test (re-run by QA). A smoke run on the dev CLI prints "already up to date" with exit 0.
    AC-2 doctor's Skills Version check names sync --only skills MET 2 passed. formatSkillsOutdatedMessage routes through scopedRemedy. In the smoke run, doctor printed run: sequant sync --only skills, the same command as its banner.
    AC-3 Legacy-manifest advisory MET 3 passed (absent / any-one-present / groups present). getInstallScope is unchanged. Removing the agents check fails "stays quiet when any of the three exists" (re-run by QA).
    AC-4 No remedy widens a partial install MET 1 passed. The test exercises checkAndWarnSkillsOutdated (via runVersionPreflight), getSkillsInstallStatus, the fast path and doctor's formatter, all with the real scopedRemedy. A grep of every non-test producer shows each one either calls scopedRemedy or is a full-install fallback after ??.
    AC-5 Plain sync keeps a skills-only scope MET 3 passed: apply, --dry-run, and a legacy manifest that gets a full sync. The #1409 AC-4 test is rewritten. In the smoke run, only .claude/skills exists and groups stays ["skills"].
    AC-6 ADR-0015 names sequant init MET The sed/grep evidence command prints 1.

    CI Status

    Check State
    test IN_PROGRESS ⏳
    typecheck, canary, structural, validate-skills, validate-plugin, node-floor-guard, Gitleaks, tautology-advisory SUCCESS

    The required test check is still running, so the verdict is NEEDS_VERIFICATION.

    Local verification

    • npm run build: passes.
    • Affected tests: 14 files, 421 tests, all passed. The files were sync.install-scope, doctor, doctor.integration, sync, update, version-preflight, src/mcp/*, templates and tautology-detector-cli.

    Code Review

    Strengths: skillsOnly is decided once, from the effective scope, which is the single-decision fix the spec asked for. The apply path passes only: "skills" through that one flag. groups: [] still gets a full install (Non-Goal respected).
    Suggestions (non-blocking):

    • When a plain sync keeps the scope, the completion line says (--only skills: nothing outside .claude/skills/ …) even though --only was not passed. The "Install scope: skills only" banner already explains it, so this is only wording.
    • At a matching version with groups: [], the fast-path remedy would name sync --only skills --force. This is very unlikely, because .sequant-version does not exist after init --manifest-only.

    Mutation Verification

    The PR body carries markers for AC-1 through AC-5, and every marker names a test file in the diff (Verified). QA re-ran the AC-1 and AC-3 mutations independently, and each one failed its target test.

    Declared-Evidence Execution

    All six AC evidence commands were executed by QA, each with ≥1 passed and 0 failed (AC-6 printed 1). Status: Complete.

    CHANGELOG

    [Unreleased] has a Fixed entry for #1485, and the #1409 entry's update wording is corrected. Status: met.

    Risk Assessment

    • Likely failure mode: A user who wants a full install runs plain sync and gets skills only. This is intended (owner ruling), and the gray banner names sequant init.
    • Sibling sites considered: The defect class is fix-message producers that do not read the install scope. All per-install producers (sync.ts:955/971, :591, version-preflight.ts:146, doctor.ts:560) go through scopedRemedy. sync.ts:446/705/831/882 are preserved-file notes on full-install paths, which the issue excludes. mcp/server.ts text no longer names update.

    Trust-Boundary Check

    Status: Clean. The diff implements only the product requirements in the issue.

    Adversarial Re-Read

    The diff ran against the issue's motivating scenario (init --manifest-only + sync --only skills, then plain sync at a matching version, plain sync at an outdated version, and doctor). Every result matched the ACs, and the doctor/banner contradiction is gone. The two mutations re-run above failed their target tests. No files were touched under plugin/ or the skill directories (freeze respected). The only gaps are the two non-blocking wording/edge suggestions above. Status: Gaps Found (minor).

    Follow-up Ledger

    N/A. Nothing was deferred.

    Verdict: NEEDS_VERIFICATION

    All six ACs are MET locally, but the required test CI check is still in progress. Re-run QA once it reports. If it passes, the expected verdict is AC_MET_BUT_NOT_A_PLUS because of the minor wording suggestions.

  8. added
    needs-verification
    on Oct 18, 2026
  9. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    QA Verdict: NEEDS_VERIFICATION

    AC coverage: 6/6 met

  10. added a commit that references this issue on Oct 18, 2026
  11. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    Runner verification (graph-2026-10-freeze-c W2). I ran this after QA's NEEDS_VERIFICATION, in the worktree.

    Fixes after the first QA (AC_NOT_MET 5/6):

    • f55b0a901: AC-4's test now checks doctor's Skills Version remedy through the real scopedRemedy, using the exported formatSkillsOutdatedMessage. The mutation records for AC-4 and AC-5 are now in the PR body.
    • 19e19f545: a plain sync that keeps the scope no longer says "--only skills" was passed. QA had dropped this as cosmetic, but the line gave the wrong cause of the scoping. It now has a test, mutation-verified.

    Evidence commands, run verbatim on f55b0a901:

    AC Result
    AC-1 1 passed, 0 failed
    AC-2 2 passed, 0 failed
    AC-3 3 passed, 0 failed
    AC-4 1 passed, 0 failed
    AC-5 3 passed, 0 failed (4 on 19e19f545)
    AC-6 printed 1 (it printed 0 on main)

    The whole sync.install-scope.integration.test.ts file passes 16/16 on 19e19f545. tsc --noEmit is clean. The freeze grep (plugin/ and the skill directories) printed nothing.

    Mutations, each failing its target test and then restored:

    • AC-4: scopedRemedy's partial branch returns the full-install text.
    • AC-4, doctor only: formatSkillsOutdatedMessage passes undefined as the scope. This is the only failure in the file.
    • AC-5: skillsOnly is derived from --only alone.
    • AC-2: re-checked.
    • The summary text is hardcoded to --only skills again.

    Follow-up ledger: QA wrote nothing to defer. The groups: [] remedy case from the first QA was dropped as a Non-Goal.

    PR #1498 waits on CI for 19e19f545 and then on the owner's merge decision.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggraph-2026-10-freeze-cneeds-verificationplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions