Skip to content

fix: retrospective review fixes for merged PR #106#117

Merged
ikeikeikeike merged 1 commit into
mainfrom
fix/retro-review-pr106
Jul 16, 2026
Merged

fix: retrospective review fixes for merged PR #106#117
ikeikeikeike merged 1 commit into
mainfrom
fix/retro-review-pr106

Conversation

@ikeikeikeike

Copy link
Copy Markdown
Member

Retrospective /code-review sweep of merged PR #106 (symlink root CLAUDE.md into each worktree on create), which shipped without pre-merge review.

Symlink mechanics (ensureSymlink, linkWorktreeClaudeMd) checked out fine — target is absolute (filepath.Abs'd before use), a stale/incorrect symlink is repointed idempotently, a real (non-symlink) CLAUDE.md already in the worktree is refused/left untouched, and a missing monorepo-root CLAUDE.md is a silent no-op rather than a dangling link. No bug there.

What was still live: bough backfill never relinks CLAUDE.md. #106 wired linkWorktreeClaudeMd into bough create only — the exact same shape as issue #61, which PR #112 fixed for linkWorktreeArtifacts (.claude/{skills,agents,commands}) by relinking every discovered worktree dir in runBackfill. That fix reused the pattern for artifacts but didn't also add the equivalent call for CLAUDE.md, since #61 predates #106 and was scoped to skills only.

Net effect: any worktree bootstrapped before the CLAUDE.md-symlink feature shipped, or created outside bough create (hand-created dir, or registered by an earlier bough backfill run), never gets the root CLAUDE.md symlink — and bough backfill, the documented non-destructive repair command for exactly this class of gap, does nothing about it. Those worktree sessions keep starting with zero project guidance indefinitely; the only "fix" is the destructive bough remove + bough create cycle #61 called out as unacceptable for the artifacts case.

Fix: call linkWorktreeClaudeMd(stderr, monorepoRoot, wtRoot) for every discovered worktree dir in runBackfill, alongside the existing linkWorktreeArtifacts call — ensureSymlink is already idempotent so relinking an already-correct worktree is a no-op.

New tests in internal/cli/backfill_test.go:

  • TestRunBackfill_RelinksClaudeMd — backfill creates the worktree CLAUDE.md symlink for a pre-existing dir and is idempotent on a second run (verified this fails without the fix, passes with it).
  • TestRunBackfill_ClaudeMdRealFileGuardAndMissingRoot — a hand-authored real CLAUDE.md in the worktree survives backfill untouched, and a monorepo root with no CLAUDE.md does not error.

Test plan

  • go build ./...
  • go test ./... (all packages green, incl. conformance)
  • golangci-lint run ./... (0 issues)
  • gofumpt -l on touched files (clean)
  • Confirmed the new regression test fails without the fix (RED) and passes with it (GREEN)

PR #106 wired linkWorktreeClaudeMd into `bough create` only, mirroring
`linkWorktreeArtifacts` at the time. That mirrored pattern was itself the
bug issue #61 reported and #112 fixed for .claude/{skills,agents,commands}:
a per-worktree symlink helper wired only into `create` never runs for a
worktree that predates the feature, was hand-created, or was registered
by an earlier `bough backfill` — so it silently keeps missing the linked
content with no non-destructive repair path.

`runBackfill` picked up the artifacts fix but never got the equivalent
call for CLAUDE.md, so any worktree bootstrapped before this symlink
feature shipped (or created outside `bough create`) still starts every
Claude session with no root guidance, and `bough backfill` — the documented
non-destructive repair command — does nothing to fix it.

Call linkWorktreeClaudeMd for every discovered worktree dir in runBackfill,
same as linkWorktreeArtifacts. ensureSymlink is idempotent so relinking an
already-correct worktree is a no-op.
@ikeikeikeike
ikeikeikeike merged commit de1df43 into main Jul 16, 2026
11 checks passed
@ikeikeikeike
ikeikeikeike deleted the fix/retro-review-pr106 branch July 16, 2026 08:29
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.

1 participant