Skip to content

refactor(doctor): select Safe next action via the canonical decision (#6986) - #8319

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/project-thread-4fi52l
Oct 17, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
claude/project-thread-4fi52l

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Before: ripr doctor chose its "Safe next action" line with two duplicated matches! ladders over DoctorFirstCommand, outside the canonical next-action decision.

After: both sites call safe_next_action_recovery_line, which builds a CanonicalNextActionV1 (Doctor producer, DoctorRecovery stop) and renders the line family from that stop. Rendered bytes are unchanged.

What: runnable and git-environment states bind no recovery (the selector never invents one), so they keep the "run the recommended first command" line. If the projection cannot be built, a shared mapping gives the same family.

How: focused test covers each recovery state, a negative control for runnable states, and the shared fallback. cargo xtask precommit and doctor lib/CLI smoke tests pass locally (two pre-existing unreadable-dir tests fail only because the sandbox runs as root).

Advances #6986 (doctor slice only; pilot delegation and inventory remain).


Generated by Claude Code

…al decision (#6986)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Em12HpuY7UcKeXeTmsjfBS
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven EffortlessSteven self-assigned this Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 56 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 4c0f796f-5597-449d-92bb-0ccbd6ab3360
📥 Commits

Reviewing files that changed from the base of the PR and between d226446 and 0f1bce9.

📒 Files selected for processing: 4
  • changelog.d/6986-doctor-canonical-next-action.md
  • crates/ripr/src/cli/commands/doctor.rs
  • crates/ripr/src/domain/mod.rs
  • crates/ripr/src/output/doctor.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Member Author

In-session proof on head 0f1bce9: cargo xtask precommit passes (all checks listed pass, incl. changelog fragments, public-api, output-contracts). cargo test -p ripr --lib safe_next_action_line passes; cargo test -p ripr --test cli_smoke doctor 40/40 pass; --lib doctor 163 pass, 2 fail (a_symlink_into_an_unreadable_directory_is_not_reported_as_a_file, an_unreadable_root_is_not_reported_as_missing), both unreadable-directory permission tests that the sandbox's root user bypasses (not run against main). Adding merge-ready to start hosted CI.


Generated by Claude Code

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs one verification check before upstream.

Verification questions

  • Confirm doctor producer claims NextActionDiffSource::Committed { base: None, head: None } which is unusual; this could imply canonical_select misclassifies or rejects doctor-recovery route, triggering the defensive fallback. Acceptable because renderer matches the same family, but verify select_canonical_next_action accepts these nulls.

Refuted

  • Test could not distinguish old (duplicated matches! ladders) from new (canonical decision) behavior because old strings were inlined and not exported.; refuted because: The three recovery strings and the runnable fallback are now public-in-crate constants (SAFE_NEXT_ACTION_RUN_FIRST_LINE and the &str literals in safe_next_action_recovery_line) and the test does assert_eq against them; the canonical projection's Doctor producer + DoctorRecovery{check_name} is also asserted, which the old code did not produce. New vs old is distinguishable.
  • Doctor domain re-export of NextActionDoctorRecovery may leak a pub(crate) item beyond the ripr crate boundary and break the canonical next-action contract surface.; refuted because: Checked crates/ripr/src/domain/mod.rs: NextActionDoctorRecovery is re-exported under pub(crate) alongside the existing pub use of next_action types; it stays crate-internal. Canonical projection still uses select_canonical_next_action which owns the stop vocabulary; the new producer=Doctor stop variant is the documented extension point.

Parked follow-ups

  • Test does not cover FailedPrerequisites path that falls through to required runtime probe (no cargo_toml fail in report); an inventory or runtime-only prereq failure would route to the generic 'prerequisites' check_name and the same generic recovery line.
  • Two CLI call sites previously duplicated matches! ladders; after the refactor both call sites reduce to a single helper call (one filtered on !passed, one with unwrap_or(SAFE_NEXT_ACTION_RUN_FIRST_LINE)). Duplication is genuinely eliminated, not just hidden behind a wrapper over the same ladders.

Evidence gaps

  • cargo-test sensor is scheduled-late, not yet landed; gate should not approve before late receipt posts.
  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 03:01
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

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.

2 participants