Repository navigation
refactor(doctor): select Safe next action via the canonical decision (#6986) - #8319
Conversation
…al decision (#6986) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Em12HpuY7UcKeXeTmsjfBS
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
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. View limit details
Comment |
|
In-session proof on head 0f1bce9: Generated by Claude Code |
There was a problem hiding this comment.
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 withunwrap_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.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Requested by Steven · project thread
Before:
ripr doctorchose its "Safe next action" line with two duplicatedmatches!ladders overDoctorFirstCommand, outside the canonical next-action decision.After: both sites call
safe_next_action_recovery_line, which builds aCanonicalNextActionV1(Doctor producer,DoctorRecoverystop) 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 precommitand 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