Skip to content

refactor(sync): fold computeDriftFingerprint's templates→.claude mapping into templateDestination (#1045) - #1047

Merged
admarble merged 4 commits into
mainfrom
feature/1045-refactor-sync-fold-computedriftfingerprint-s-templ
Sep 11, 2026
Merged

admarble merged 4 commits into
mainfrom
feature/1045-refactor-sync-fold-computedriftfingerprint-s-templ

Conversation

@admarble

@admarble admarble commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • computeDriftFingerprint (src/commands/sync.ts) now derives install paths via the exported templateDestination() from src/lib/templates.ts instead of its own private templates/→.claude/ string replace — the same root-cause pattern fix(sync): dry-run lists files apply never writes — the template walk maps templates/opencode/** to .claude/opencode/** (phantom drift nag in serve; update plants unrendered {{PHASE}} files) #1030 fixed for computeTemplateChanges. An excluded template (templates/opencode/**, templates/relay/**, templates/mcp.json) contributes nothing to the fingerprint's cache key, matching the write path's own skip.
  • Guarded the .claude/.local/ override-path check with localPath.startsWith(".claude/"), since templateDestination can also return scripts/dev/... paths (for templates/scripts/**) that have no .local override concept.
  • Documented the retired-file drift-detection blind spot (a template removed from the bundle leaves its installed copy invisible to sync's drift check, since the walk is template-driven) in docs/reference/cheat-sheet.md.

Acceptance Criteria

AC Status Evidence
AC-1: computeDriftFingerprint derives install paths via templateDestination, no private templates/→.claude/ replace ✅ grep -n 'replace("templates/"' src/commands/sync.ts → only the unrelated on-disk-path strip remains; npx vitest run src/commands/sync.test.ts -t "content-drift cache" → 5/5 green, including the new excluded-template case
AC-2: retired-file limitation documented in one sentence ✅ grep -rc "retired" docs/reference/*.md → cheat-sheet.md:1
AC-3: suite green ✅ npm run build && npm run lint pass; npm test → 6326 passed, 3 failed in files untouched by this change (batch-executor.test.ts, relay-hook.integration.test.ts, prompt-wait.test.ts — confirmed via git diff --stat against those paths showing zero change)

Mutation-verified: AC-1 — reverted templateDestination(normalized) back to the private normalized.replace("templates/", ".claude/"); src/commands/sync.test.ts > sync command > areSkillsOutdated content-drift cache (AC-5) > an excluded template (templates/opencode/**) contributes nothing to the fingerprint (AC-1, #1045) failed; restored.

Test plan

  • npm run build
  • npm run lint
  • npm test (full suite; 3 pre-existing unrelated failures noted above)
  • Mutation-verified the new gate test (see above)

Closes #1045

Post-QA (AC_MET_BUT_NOT_A_PLUS) — runner notes, f3412e9

Mutation-verified: AC-1 — restored the unconditional .claude/ → .claude/.local/ override derivation for every install path; src/commands/sync.test.ts > a scripts template contributes its scripts/dev install path and no .claude/.local override line (#1045 QA) failed; restored.

t and others added 4 commits September 10, 2026 20:50
Entire-Checkpoint: 521a30718b1d
… into templateDestination (#1045)

- computeDriftFingerprint now derives install paths via the exported
  templateDestination() instead of a private templates/->.claude/ replace,
  matching the skip pattern computeTemplateChanges already uses for
  excluded templates (opencode/, relay/, mcp.json).
- Guard the .local override-path check with localPath.startsWith(".claude/")
  since templateDestination can also return non-.claude/ paths
  (scripts/dev/...).
- Add a fingerprint test proving an excluded template contributes nothing
  to the cache key (mutation-verified).
- Document the retired-file drift-detection blind spot in
  docs/reference/cheat-sheet.md.

Entire-Checkpoint: 7746fbc46dce
… no override line

QA note: the non-.claude branch of the fingerprint (scripts/dev templates)
shipped untested. The pre-#1045 override derivation was a no-op string
replacement on scripts/dev paths, so the same path was stat'd twice as a
bogus o: line; the test asserts exactly one stat and no .local ghost.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0147heJNRw8wBBujPGMqxDpR
…-sync-fold-computedriftfingerprint-s-templ
@admarble
admarble merged commit 238a2dd into main Sep 11, 2026
6 checks passed
@admarble
admarble deleted the feature/1045-refactor-sync-fold-computedriftfingerprint-s-templ branch September 11, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(sync): fold computeDriftFingerprint's templates→.claude mapping into templateDestination; document the retired-file limitation

1 participant