Skip to content

refactor: sweep dead code, route git spawns through the port, unify cached shells - #202

Merged
andyrewlee merged 1 commit into
mainfrom
advisor/029-tech-debt-sweep
Sep 29, 2026
Merged

andyrewlee merged 1 commit into
mainfrom
advisor/029-tech-debt-sweep

Conversation

@andyrewlee

Copy link
Copy Markdown
Owner

Plan 029 — Tech-debt sweep

Verified each "dead" symbol against HEAD before deleting; all four were
unreferenced outside tests.

  • Dead symbols deleted: syncPlan (thin wrapper over
    SyncPlanAgainst — tests ported to call it directly), popUndo
    (test ported to PeekUndo+DropUndo), PushRemote (tests ported to
    PushBranches), DiffCachedPatch (tests ported to
    DiffCachedHunks+DiffCachedPatchFor).
  • Port bypass removed: cmd/worktree_copy.go no longer spawns git
    directly — new port funcs git.LsFilesZ and git.CheckIgnored carry
    the identical batch-then-per-entry-fallback contract.
    grep 'exec.Command("git"' cmd/ outside tests: zero hits.
  • Twin shells collapsed: one cachedPort decorator embeds any
    stack.Git; stackEnv constructs cachedPort{git.QuietShell{}} in
    JSON mode instead of type-asserting (the old swap failed open if
    gitShell's type changed).
  • Smalls: untrack's divergent fs.Usage removed; hasSuffix /
    joinNames / joinComma replaced by strings stdlib; stale
    engine.go:<lines> cites in e2e crash tests refreshed; the 8-param
    printLogJSON/printLogTree context bundled into logData.

File splits (git.go/engine.go/*_test.go sizes) intentionally skipped
per plan — churn without behavior value.

Verification

  • make test-fast green
  • go test ./cmd -run 'Worktree|Include|JSONStackEnv|RenameInvalidates|Untrack|DetectShell' green
  • go test ./internal/git green
  • make ci green — merged coverage 87.5%
  • No plans/ content on this branch.

…ached shells

Plan 029. No behavior change.

- Delete production-dead symbols: syncPlan (superseded by
  SyncPlanAgainst), popUndo (PeekUndo+DropUndo inline), PushRemote
  (superseded by PushBranches), DiffCachedPatch (superseded by
  DiffCachedPatchFor). Tests ported to the successor APIs.
- cmd/worktree_copy.go: move the two direct git spawns behind the port
  — new git.LsFilesZ (NUL-parsed ls-files) and git.CheckIgnored
  (batched check-ignore with per-entry fallback, same semantics).
  Production cmd/ now contains zero exec.Command("git") calls.
- cmd/gitenv.go: collapse cachedShell/cachedQuietShell twins into a
  single cachedPort decorator wrapping any stack.Git; the JSON-mode
  swap now constructs cachedPort{git.QuietShell} instead of a
  fail-open type assertion.
- Smalls: drop untrack's one-off fs.Usage override, hasSuffix ->
  strings.HasSuffix, joinNames/joinComma -> strings.Join, refresh
  stale engine.go line cites in e2e crash tests, and bundle the
  8-param log render context into logData.
@andyrewlee
andyrewlee merged commit 47a8e70 into main Sep 29, 2026
3 checks passed
@andyrewlee
andyrewlee deleted the advisor/029-tech-debt-sweep branch September 29, 2026 01:39
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