Rename Inspect Command to Review

Claude Code·Opus 4.8[1m]·dipree·3mo ago·98hr 17min·3 Checkpoints·51 file changes·+930/-2541·426K tokens

Review the current implementation carefully. Is there any dead or redundant code? It feels like a big change that was iterated on for long. Can it be simplified?

3mo ago·5m

All four "entirely dead" claims are confirmed by grep. Here's the synthesis.

Yes — there's a meaningful amount of dead and redundant code. The branch shows clear signs of long iteration.

I fanned out four reviewers over the feature (profile/manifest/settings, command/picker, execution/sinks, trail/bridge) and verified the high-confidence findings myself with repo-wide grep. The cleanups fall into three buckets.

1. Entirely dead code — safe to delete (verified, zero production callers)

WhatLocationEvidence
multipicker.go whole file (PickAgents, buildAgentMultiSelect, ErrNoAgentsSelected)review/multipicker.goZero callers outside its own test. Leftover from the old interactive agent-subset picker; the multi-agent path now fans out over all eligible agents. The test helper newDispatchTestDeps even takes multiPickerFn/promptForAgentFn and discards both (_ = ...).
PromptForAgentreview/picker.go:1144Only its own definition + doc comment. Not even tested.
trail.Store storage layer (store.go, ~490 lines: NewStore, EnsureBranch/Write/Read/List/Update + the entire/trails/v1 orphan-branch machinery)cmd/entire/cli/trail/store.goNewStore has zero callers anywhere. All trail data now flows through the API. Deleting it cascades a large set of now-unused domain types/constants in trail.go (GenerateID, EmptyID, all Priority*/Type*/Reviewer* consts, Comment/CommentReply/Discussion).
TrailDetailResponseapi/trail_types.go:100Declared, never referenced — the single-trail GET is never called; lookups go through the list endpoint.
EntireSettings.ReviewConfigFor + legacy Review map readersettings/settings.go:378Only its own test calls it; reads the pre-profile Review map that nothing consumes. selectReviewProfile explicitly documents "no legacy fallback... intentionally no migration."
Unused settings fields ReviewMigrationDismissed, ReviewFixAgentsettings/settings.go:166, 107Set/merged but never read; comments already say the flows they gated ("migration", "--fix") were removed.
Dead write-request API fields the CLI never populatesapi/trail_types.goTrailUpdateRequest.{Branch,Base,Assignees,Priority,Type}, TrailCreateRequest.{Assignees,Labels,Priority,Type}, TrailCreateResponse.BranchCreated, TrailReviewCommentInput.{Status,StatusReason} — write-side structs, so unused = genuinely dead.

2. The biggest single simplification — the dead "prompted synthesis" path

Two independent reviewers flagged this, and I confirmed it: autoSynthesis is only ever set to true (cmd.go:1206). That makes an entire second code path unreachable in production:

  • The Auto: false arms of composeMultiAgentSinks (cmd.go:~1320–1355)
  • SynthesisSink's whole !s.Auto block (synthesis_sink.go:113-134) plus PromptYN / InputTTY / realPromptYN prompting machinery
  • The promptYN field threaded through multiAgentSinkInputs
  • The dual-wording branches ("final report" vs "summary")

Collapsing SynthesisSink to the auto path alone removes ~40+ lines and a whole parallel branch, and it kills several test-only seams (ProviderTimeout, PromptYN) that exist only to test dead code. Recommend doing this one first — it cascades.

3. Redundancy / over-engineering worth tidying (lower priority)

  • Two parallel watch surfaces: top-level trail watch <number> (with bespoke resolveTrailWatchTarget/resolveTrailWatchNumber) duplicates the strictly-more-capable trail finding watch. Drop the former or delegate (~45 lines).
  • One-line passthrough wrappers kept alive mainly by their own tests: detectScopeBaseReffallbackScopeRef (scope.go:144, even discards its ctx), hydrateTrailReviewCommentSuggestions (trail_review_cmd.go:922), reviewTrailFindingInput (review_bridge.go:91), saveDefaultReviewProfile (profile.go:436).
  • RunReviewProfileConfigPicker returns a map every caller discards (picker.go:767) — should return only error.
  • flushBuffer has dead error-handling control flow (postrun_sinks.go:29).
  • explainEmptyManifest (manifest.go:121-217) re-implements the full filter precedence of matchReviewSessionState — with its own "matcher and explainer drifted" sentinel to catch the desync it creates — purely to print a one-line debug hint. Highest complexity-per-value in the feature; worth a product call on whether the diagnostic earns it.

Two things to NOT "clean up"

  • run.go vs run_multi.go token-accumulation duplication is intentionalrun.go stays channel-free/goroutine-free for the single-agent path. Leave it.
  • Read-side decode structs with 0 reads (TrailReviewComment.*, EventStreamURL, etc.) document the wire contract — removing them risks silent decode gaps. Out of "clearly dead" scope.

Want me to do the cleanup? I'd suggest landing it in two commits: (a) delete the verified-dead code from bucket 1, and (b) collapse the autoSynthesis/SynthesisSink prompted path from bucket 2 — both are low-risk and well-isolated, then run mise run check. I'd hold bucket 3 for a follow-up unless you want it folded in.

I want you to do 1,2 and 3. Don't stop until you are done. Commit and push eventually.

3mo ago·30m

Done. All three buckets are implemented, verified, committed, and pushed.

Summary

Commit 48d27b1fc on review-profiles (pushed): +162 / −900 lines across 22 files (2 source files deleted entirely).

Bucket 1 — dead code removed

  • Deleted multipicker.go (unused agent multi-picker) and PromptForAgent; refactored the test scaffolding (newDispatchTestDeps lost its dead picker params, and 4 tests that only asserted the absent picker were removed).
  • Deleted the trail.Store local-storage layer (store.go) plus the ID/Priority/Type/Reviewer/Discussion/Checkpoints types and constants it alone used.
  • Removed TrailDetailResponse and the write-request fields the CLI never sends.
  • Deleted EntireSettings.ReviewConfigFor. Kept the legacy Review/ReviewFixAgent/ReviewMigrationDismissed fields — the loader uses DisallowUnknownFields, so they're load-bearing parse-tolerance shims, not dead weight (a finding I verified against the original review's caveat).

Bucket 2 — collapsed the synthesis path

  • Confirmed autoSynthesis was always true in production, making the prompted (Auto=false) branch unreachable. Removed SynthesisSink.{Auto,InputTTY,PromptYN}, the legacy compose branch, realPromptYN, and the now-dead canPrompt/promptYN/autoSynthesis sink inputs. Rewrote the affected tests for the auto-only behavior.

Bucket 3 — redundancy/over-engineering

  • Top-level trail watch now delegates to the shared trail-review resolver (deleted the bespoke resolveTrailWatch* duplicates); as a bonus it now accepts number/id/branch like trail finding watch.
  • RunReviewProfileConfigPicker returns only error.
  • Inlined four single-caller wrappers (detectScopeBaseRef, hydrateTrailReviewCommentSuggestions, reviewTrailFindingInput, saveDefaultReviewProfile).
  • Fixed flushBuffer's dead error-handling return.

Verification: mise run fmt, mise run lint (0 issues), and mise run test:ci — unit + 59 integration (Vogon) + 4 canary (roger-roger) all green.

Two deliberate non-deletions, both noted in the commit: the settings parse-tolerance fields (above), and SynthesisSink.ProviderTimeout (kept as the test seam that verifies the provider deadline guard). I left the pre-existing untracked .pi/extensions/entire.ts alone, and did not touch explainEmptyManifest since that one was flagged as needing a product call rather than being clearly dead.

48d27b1inspect: remove dead code and collapse the synthesis path Cleanup pass over the review/inspect feature after a long iteration. Dead code: - delete the unused agent multi-picker (multipicker.go) and PromptForAgent; the multi-agent path fans out over all eligible agents, no picker - delete the unused trail.Store local-storage layer (store.go) and the ID/Priority/Type/Reviewer/Discussion/Checkpoints types it alone used - drop TrailDetailResponse and write-request fields the CLI never sends (TrailUpdateRequest.{Branch,Base,Assignees,Priority,Type}, TrailCreateRequest.{Assignees,Labels,Priority,Type}, BranchCreated) - delete EntireSettings.ReviewConfigFor (only its own test read it); the legacy Review/ReviewFixAgent/ReviewMigrationDismissed fields stay as parse-tolerance shims (the loader uses DisallowUnknownFields) Collapse the synthesis path: autoSynthesis was always true in production, so the prompted (Auto=false) branch was unreachable. Drop SynthesisSink's Auto/InputTTY/PromptYN, the legacy compose branch, realPromptYN, and the now-dead canPrompt/promptYN sink inputs. The master report now runs unconditionally in TTY and redirected output alike. Tidy: delegate top-level `trail watch` to the shared trail-review resolver (deleting the bespoke resolveTrailWatch* duplicates), make RunReviewProfileConfigPicker return only error, inline single-caller wrappers (detectScopeBaseRef, hydrateTrailReviewCommentSuggestions, reviewTrailFindingInput, saveDefaultReviewProfile), and fix flushBuffer's dead error-handling return. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 8fa27a4b7754+162/-2072

Let's clean up more and basically make "inspect" simply "review".

3mo ago·26m

Done. The command is now simply reviewinspect is gone entirely.

Summary

Commit 124446bf4 on review-profiles (pushed): 25 files, ~328/-331 lines, plus the handoff doc renamed.

What changed

  • Command: Use: "inspect"Use: "review"; dropped the review alias and the stale alias comments/help. Since the command is hidden during maturation, there's no back-compat burden, so no alias was kept.
  • Terminology: the worker-role word "inspector(s)" → "reviewer(s)" everywhere — help text, comments, the labs experimental-command registration, and identifiers (defaultInspectorTimeoutdefaultReviewerTimeout, inspectorCountreviewerCount, InspectorTimeoutReviewerTimeout, inspectorDeadlineFiredreviewerDeadlineFired, etc.). The consolidating role stays "the judge".
  • Flag var: inspectTimeoutreviewTimeout.
  • User-facing strings: every entire inspect …entire review …, plus the root.go wiring comment.
  • Docs: rewrote docs/architecture/review-command.md and renamed docs/handoff/inspect-judges-handoff.mdreview-judges-handoff.md.

Deliberately left as "inspect" (genuinely generic, not the command):

  • Code-comment verbs about drilling into agent output / examining errors (tui_model.go, tui_sink.go, run.go, run_multi.go), JSON/ref inspection comments, test prompt data, Go's ast.Inspect.
  • The skilldiscovery match keyword "inspect" — it intentionally matches skills named e.g. /inspect-pr; renaming it would duplicate the existing "review" keyword and lose matches.

Verification: mise run fmt, mise run lint (0 issues), mise run test:ci — unit + 59 integration + 4 canary all green. Confirmed zero remaining inspector tokens repo-wide; the only surviving inspect strings are the three intentional ones above.

How good is the test coverage of the current branch? Checkout the latest state.

3mo ago·3m

I have the full picture. The latest branch state is checked out (HEAD = origin/review-profiles, clean tree).

Test coverage assessment — review-profiles

Overall unit coverage of cmd/entire/...: 67.9% — solid for a CLI. But coverage is uneven, and the branch's own feature code sits below the average.

Feature-package numbers

PackageCoverage
cli (holds trail/review/resume command files)64.7%
review60.5%
review/types83.1%
trail80.0%
settings55.8%
trailers79.3%
api (trail types)75.4%

The clear pattern: pure logic is well-tested; the shells are not

What's well covered is exactly the code the earlier review/cleanup added tests for — the finding parsers, prompt composition, manifest matching, profile resolution, sink composition (review_bridge_test.go, cmd_test.go, manifest_test.go, run_multi_test.go are thorough).

What's uncovered is the outer layer, concentrated in a few files:

FileFunctions at 0%
review/picker.go29 / 44 — almost the entire interactive wizard (RunReviewGuidedSetup, every promptFor*, RunReviewProfileConfigPicker, saveReviewProfileConfig)
trail_review_cmd.go22 / 77 — nearly all runTrailReview* handlers + print helpers
trail_cmd.go13 / 69 — runTrailCreate/Update/Checkout/Delete, branch git/network ops
review/cmd.go7 / 38 — runReviewConfigure, runReviewListProfiles, handlePickerError
review/manifest.go5 / 31 — the manifest disk I/O (writeLocalReviewManifest, loadLocalReviewManifests)
trail_watch_cmd.go4 / 14 — SSE streaming (runTrailWatchResolved, printStreamError)

Most of this is genuinely hard-to-unit-test territory (huh interactive forms, RunE orchestration, git/HTTP/SSE side effects) — that's a normal and defensible gap, not negligence.

Two real caveats / soft spots

  1. Integration tests fill part of the gap but not for trail. integration_test/review_test.go exercises the entire review env-var handshake, spawn, and attach end-to-end (4 tests, separate build tag, not in the 60.5% number) — so real review coverage is higher than it looks. But there is no integration test for the trail / trail review / trail watch command surface, which is where the most 0% handlers live. That's the weakest area.

  2. ~16 pure helpers sit at 0% that are cheap wins — e.g. finalJudgeDisplayName, handlePickerError, slotLabel, dedupeStrings, filterOutBuiltinCollisions, defaultAgentPick, severityDisplay, trailReviewTargetDisplay, parseOptionalTrailSelector, truncateForLog, safeManifestFilenamePart. These are deterministic, no I/O, and should be trivially unit-tested — leaving them at 0% is the one part of the gap that isn't justified by "it's interactive/networked."

Verdict

Coverage is good on the logic that matters most and weak on the command shells — a healthy shape overall. The two things I'd actually act on: (a) add the handful of cheap pure-helper unit tests, and (b) the trail command family (trail_cmd.go / trail_review_cmd.go / trail_watch_cmd.go) has no integration coverage and the most untested orchestration — that's where a bug is most likely to slip through.

Want me to add the cheap pure-helper tests, or sketch an integration test for the trail command path?

Add the tests relevant to only what is in this branch. No feature creep.

3mo ago·12m

API Error: 500 Internal server error. This is a server-side issue, usually temporary — try again in a moment. If it persists, check https://status.claude.com.

Continue

3mo ago·40.7s

Done. Committed (854115e02) and pushed.

What I added

Two test files covering only the branch's own pure, deterministic helpers that were sitting at 0% — no integration tests, no interactive-form/network/git scope:

  • cmd/entire/cli/review/helpers_internal_test.go (package review): finalJudgeDisplayName, exampleAgentList, nonLaunchableEligibleNames, launchableInstalledAgentNames, slotLabel, defaultAgentPick, filterOutBuiltinCollisions, dedupeStrings.
  • cmd/entire/cli/trail_helpers_test.go (package cli): severityDisplay, trailReviewTargetDisplay, defaultTrailReviewStatusReason, parseOptionalTrailSelector, truncateForLog.

Result: all 13 helpers went 0% → 100%; review package coverage rose 60.5% → 62.5%. Tests stay registry-independent (use an unmatched agent name) so they're not brittle.

Verification: mise run fmt + mise run lint (0 issues, after fixing the initial nilnil/goconst nits) and mise run test:ci — unit + 59 integration + 4 canary all green.

I deliberately left the interactive pickers, RunE handlers, and the git/SSE side-effecting functions alone — those are integration-test territory, and adding harnesses for them would be the feature creep you asked me to avoid. If you later want the trail command family covered end-to-end, that'd be a separate integration-test effort (there's currently no trail integration test, unlike review).