Return explicit result when updating an unmanaged tool by selector#34
Conversation
Targeted updates of externally managed tools now produce a skip action with reason instead of silently falling out of the plan. Closes #28 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe changes modify Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/plan/update.go (1)
25-31: Centralize the skip-reason string to avoid drift.Now that this message is part of expected behavior, consider using a package-level constant so implementation and tests stay aligned.
♻️ Proposed refactor
+const reasonToolNotManaged = "tool is not managed by atb" + func BuildUpdatePlan(snapshot discovery.Snapshot, managers []pkgmgr.Manager, toolID string) (Plan, error) { @@ if presence.Ownership != state.OwnershipManaged || presence.Receipt == nil { if toolID != "" { actions = append(actions, Action{ Tool: presence.Tool, Type: ActionSkip, - Reason: "tool is not managed by atb", + Reason: reasonToolNotManaged, }) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/plan/update.go` around lines 25 - 31, Introduce a package-level constant for the skip reason string and replace the inline literal in the actions append with that constant; specifically, add something like const SkipReasonToolNotManaged = "tool is not managed by atb" at the top of the package and update the block that appends Action{Tool: presence.Tool, Type: ActionSkip, Reason: "tool is not managed by atb"} to use SkipReasonToolNotManaged instead (referencing Action, ActionSkip, and the append in update.go). Ensure any tests that assert this message are updated to reference the new constant so implementation and tests remain aligned.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@internal/plan/update.go`:
- Around line 25-31: Introduce a package-level constant for the skip reason
string and replace the inline literal in the actions append with that constant;
specifically, add something like const SkipReasonToolNotManaged = "tool is not
managed by atb" at the top of the package and update the block that appends
Action{Tool: presence.Tool, Type: ActionSkip, Reason: "tool is not managed by
atb"} to use SkipReasonToolNotManaged instead (referencing Action, ActionSkip,
and the append in update.go). Ensure any tests that assert this message are
updated to reference the new constant so implementation and tests remain
aligned.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2427375b-afda-4297-a62d-637af2dddde2
📒 Files selected for processing (3)
CHANGELOG.mdinternal/plan/plan_test.gointernal/plan/update.go
Summary
"tool is not managed by atb"instead of a silent empty planCloses #28
Test plan
TestBuildUpdatePlanExternalToolReturnsSkip— external tool produces skip action with reasonTestBuildUpdatePlanUnknownToolReturnsError— unknown selector still returns error (unchanged)TestBuildUpdatePlanManagedOnly— bulk update behavior unchangedgolangci-lintclean🤖 Generated with Claude Code
Summary by CodeRabbit