Skip to content

fix(doctor): the Skills Version check says "Up to date" when skills differ from the bundle at a matching version — the #713 content-drift fix never reached doctor #1490

Closed

Description

@admarble

Found during graph-2026-10-freeze-c planning (Phase 0 of node A); not a graph node.

It lands after freeze-c node A, which rewrites the outdated branch of the same check (doctor.ts:649) to use the scoped remedy.

Problem

doctor's Skills Version check (src/commands/doctor.ts:643-657) reads only areSkillsOutdated().outdated, which compares version markers. At a matching version it always passes with Up to date. areSkillsOutdated already returns contentDrift, the count of installed files that differ from the bundle inside the install scope (src/commands/sync.ts:306-335). doctor ignores it.

Every other consumer of the same status reads both fields:

  • the pre-flight banner (checkAndWarnSkillsOutdated, sync.ts:944-958);
  • runVersionPreflight (version-preflight.ts:82);
  • getSkillsInstallStatus, which backs sequant://install and the serve warning (version-preflight.ts:133).

Reproduced 2026-10-17 (main @ de03af8, dev CLI, temp git repo):

  1. sequant init --manifest-only --yes, then sequant sync --only skills (version 2.19.0, groups: ["skills"]).
  2. One line appended to .claude/skills/spec/SKILL.md. The drift cache was deleted.
  3. sequant doctor (and sequant doctor -q) printed:
    !  Version current, but 1 file(s) differ from bundled content
       Run: sequant sync --only skills --force
    ...
      ✔ Skills Version: Up to date (2.19.0)
    ...
    Passed: 14/20
    Warnings: 6
    
    It exited 0. The banner and the check in the same run contradict each other, and the check list, the summary and the exit code omit the drift.

sequant status printed the same banner. The banner comes from the CLI pre-action hook, not from doctor's checks.

Acceptance Criteria

  • AC-1: At a matching version with content drift above 0, doctor's Skills Version check is a warning. It states the number of differing files and names the remedy the pre-flight banner prints for that install (scopedRemedy(scope, cli, false) on a partial install; the full-install drift text otherwise). Evidence: npx vitest run src/commands/doctor.test.ts -t "Skills Version reports content drift" reports ≥ 2 passed (one partial, one full install), 0 failed, mutation-verified by making the check read only outdated again.
  • AC-2: At a matching version with no content drift, the check still passes with Up to date (<version>). Evidence: npx vitest run src/commands/doctor.test.ts -t "Skills Version passes with no drift" reports ≥ 1 passed, 0 failed.
  • AC-3: The drift remedy text has one producer. The banner and doctor get it from the same function, so the two can't name different commands. Evidence: npx vitest run src/commands/doctor.test.ts -t "Skills Version reports content drift" asserts that the check's remedy equals what checkAndWarnSkillsOutdated prints for the same status, mutation-verified by changing only the banner's full-install drift text (exactly that assertion fails).

Prior fixes / producers

May touch

src/commands/doctor.ts (Skills Version check), src/commands/sync.ts (only to export the shared remedy text), src/commands/doctor.test.ts, CHANGELOG.md.

Non-Goals

  • The remedy on the outdated branch (doctor.ts:649). Freeze-c node A owns it.
  • How contentDrift is computed, or the drift cache.
  • The full-install remedy in getSkillsInstallStatus (version-preflight.ts:145, update), which differs from the banner's.
  • Changing doctor's exit code. A warning keeps exit 0, as every other warning does today.
  • The Skills Committed check and phase skill sources (feat(doctor): report each phase skill's source; narrow the committed-skills guards (ADR-0012 follow-up 3) #1399).
  • Any edit under plugin/, .claude/skills/ or templates/skills/ (plugin freeze).
  • A release.

Activity

  1. added
    bug
    on Oct 17, 2026
  2. admarble commented on Oct 18, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (3 ACs, 2 directories)

    AC Quality Check

    All three ACs are single-line with Evidence: clauses. Two findings:

    • AC-3 evidence is not runnable as written. doctor.test.ts replaces ./sync.js wholesale with vi.mock (lines 49-60: only areSkillsOutdated and a stub scopedRemedy are exported). checkAndWarnSkillsOutdated does not exist in that mock, and the stub scopedRemedy never returns the real full-install text. The "equals what the banner prints" assertion therefore has to use vi.importActual("./sync.js") for the banner side. It cannot compare against the mock. This is a test-design constraint, not an AC change.
    • Vacuity: the -t "Skills Version reports content drift" and -t "Skills Version passes with no drift" filters match no test today, so both commands report 0 passed and fail the ≥ N passed bar. AC-2's behaviour already holds on current code, so AC-2 gates only that the new branch does not regress the pass path.

    Scope Assessment

    Non-Goals: present in the issue (outdated-branch remedy, drift computation, version-preflight remediation, exit code, plugin/skill dirs, release).

    Metric Value Status
    Feature count 1 ✅
    AC items 3 ✅
    Directory spread 1 (src/commands) + CHANGELOG ✅

    Verdict: ✅ SCOPE_OK

    Acceptance Criteria

    AC-1: drift at matching version → warning with count and banner remedy

    Verification: Unit Test
    Scenario: Given areSkillsOutdated returns outdated:false, contentDrift:2 → When doctorCommand() runs → Then the Skills Version check is warn, its message contains 2 file(s) and the remedy. Two cases: partial scope → sync --only skills --force; full scope → sync --force (or … update).
    Assumptions: the warning counts toward Warnings: and exit stays 0 (Non-Goal).

    AC-2: no drift → still passes

    Verification: Unit Test
    Scenario: Given outdated:false, contentDrift:0 → Then Up to date (<version>) pass. Note that the existing default mock omits contentDrift, so the check must treat undefined as 0 (> 0 does).

    AC-3: one producer for the drift remedy

    Verification: Unit Test
    Scenario: Given a drift status → When doctor formats its message and checkAndWarnSkillsOutdated prints → Then the remedy substrings are equal. Mutation: change only the banner's full-install text → this assertion fails.

    Implementation Plan

    Phase 1: shared producer (src/commands/sync.ts)

    1. Add and export formatSkillsDriftRemedy(scope, cli) returning scopedRemedy(scope, cli, false) ?? \${cli} sync --force (or ${cli} update)`. Replace the inline expression at sync.ts:~953-955incheckAndWarnSkillsOutdated` with a call to it. The banner's own text and output stay identical.

    Phase 2: doctor (src/commands/doctor.ts)

    1. Add formatSkillsDriftMessage(status, cli) next to formatSkillsOutdatedMessage (~line 553): ${n} file(s) differ from bundled content (version ${v}) - run: ${remedy}, using formatSkillsDriftRemedy.
    2. In the Check 3.5 block (~line 663), insert an else if ((skillsStatus.contentDrift ?? 0) > 0) branch pushing a warn, ahead of the pass branch.

    Phase 3: tests and changelog

    1. In doctor.test.ts, add describe("Skills Version reports content drift") (partial + full cases) and describe("Skills Version passes with no drift"). Extend the ./sync.js mock to delegate formatSkillsDriftRemedy to the actual module via vi.importActual, and add the AC-3 parity test importing the real checkAndWarnSkillsOutdated from importActual (capture console.log).
    2. Mutation-verify per CLAUDE.md: (a) make the check read only outdated → AC-1 tests fail; (b) change only the banner full-install text → the AC-3 test fails. Record Mutation-verified: markers in the PR body with the src/commands/doctor.test.ts > … path format.
    3. CHANGELOG.md entry.

    Design Review

    1. Where does this belong? The remedy text in sync.ts (it already owns scopedRemedy and the banner). The doctor check is a consumer.
    2. Simplest approach: a shared one-line helper and one new else if. Rejected: having doctor call checkAndWarnSkillsOutdated (it prints and returns a boolean, which would double-print and break the Warnings: count, cf. fix(onboarding): first-run papercuts from a stranger smoke test — doctor contradicts the README install, init omits the commit step, warning count and phase timer are off #1387 AC-3). Rejected: also unifying version-preflight.ts:145 (Non-Goal).
    3. Pattern and recurrence: "a surface reads outdated but not contentDrift". Prior fixes: 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): a --only skills install warns 'N file(s) differ' forever, and the suggested sync --force overwrites the repo's constitution #1409 — three, each on a different surface. This is the class's last known reader (git grep contentDrift shows doctor is the only status consumer without it). The class is closed by AC-3's shared producer for doctor and banner. version-preflight.ts:145 is deliberately left divergent per Non-Goals, so file a follow-up for it. Recording: deliberately local for remediation, reason: Non-Goal, class tracked in follow-up.
    4. Reviewer challenge: "Why not fold version-preflight's remediation in too?" Answer: Non-Goal, it changes sequant://install output.
    5. Producers/consumers of areSkillsOutdated status: consumers are sync.ts banner, version-preflight.ts (:82, :133, :165) and doctor.ts. The single producer is areSkillsOutdated. Remedy-text producers: sync.ts banner and version-preflight.ts:145. After this change doctor and the banner share one.

    Feature Quality Planning

    All standard checks pass. Notable:

    Open Questions

    1. Message wording for the drift warning — Recommendation: mirror the banner ("N file(s) differ from bundled content"). Impact: cosmetic only; tests match on the count and remedy.
    2. Follow-up issue for version-preflight.ts:145 remedy divergence? — Recommendation: yes, file after merge. Impact: the divergence stays unfiled otherwise.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: small single-file bug fix with Unit Test evidence on a bug label. testgen skipped (bug-only, targeted tests are in the plan). No UI, so no test phase.

    Label Review

    Current: bug
    Recommended: bug, planned
    Quality Loop: won't auto-enable (SCOPE_OK).

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

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

    AC coverage: 3/3 met

    Gaps:

    • Gate-test ACs AC-1 and AC-3 lack recorded mutation markers (QA ran both mutations and they killed as specified)
    • AC-3 parity assertion matches the first run: in the whole doctor output rather than the Skills Version line, so an unrelated check message could make it compare the wrong text

    Suggestions:

    • The AC-3 parity test takes the first run: (.*) match from the whole doctor output. If an earlier check's message ever contains run:, the test would compare the wrong line. Scoping the match to the Skills Version: line would make it robust.
  5. added a commit that references this issue on Oct 19, 2026
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

    bugplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions