Skip to content

doctor --json: carry canonical_next_action for precise recovery (#6986) - #8376

Merged
EffortlessSteven merged 5 commits into
mainfrom
claude/6986-doctor-json-canonical-action
Oct 17, 2026
Merged

EffortlessSteven merged 5 commits into
mainfrom
claude/6986-doctor-json-canonical-action

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Before: ripr doctor chose its human "Safe next action" recovery line from the canonical next-action decision (#8319), but ripr doctor --json carried no machine-readable form of that decision, so tools had to re-infer it.

After: ripr doctor --json carries an optional canonical_next_action (stop.kind = doctor_recovery, stop.check_name = failing check) for missing root, unloadable ripr.toml, or failed prerequisites. It is omitted when the state names a runnable command and for non-analysis profiles. Additive in doctor schema 0.4, no version bump. Part of #6986.

How: the command adapter attaches the DTO from the same canonical_next_action_for_doctor decision the human line uses (no rendering-side inference). Schema, OUTPUT_SCHEMA, SPEC-0242, README, fixture, verification contract and a changelog fragment updated. Control 9 test pins human line and JSON stop.check_name agreement per recovery state, plus runnable and non-analysis negatives; an end-to-end schema test covers the real command.


Generated by Claude Code

…states (#6986)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@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!

Copy link
Copy Markdown
Member Author

Local proof (in-session, before publish):

  • cargo fmt: clean
  • cargo test -p ripr --lib doctor_json_action_and_human_line_agree_for_each_recovery_state (Control 9): pass
  • cargo test -p ripr --test doctor_json_schema (4 tests, incl. real-command recovery vs runnable): pass
  • cargo xtask check-output-contracts: pass
  • cargo xtask precommit: ran to completion, policy checks pass
  • cargo xtask goldens check: not established locally (fixture subprocess needs network for locked anyhow 1.0.100; infrastructure, not drift); hosted CI will run it.

Generated by Claude Code

@EffortlessSteven EffortlessSteven self-assigned this Oct 17, 2026
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 05:15
@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!

@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 24 minutes.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: c8ba2cd1-897a-4982-9428-0093b589fd72
📥 Commits

Reviewing files that changed from the base of the PR and between d91a25d and 9735ba9.

📒 Files selected for processing: 10
  • README.md
  • changelog.d/6986-doctor-json-canonical-next-action.md
  • crates/ripr/src/cli/commands/doctor.rs
  • crates/ripr/src/output/doctor.rs
  • crates/ripr/tests/doctor_json_schema.rs
  • docs/OUTPUT_SCHEMA.md
  • docs/specs/RIPR-SPEC-0242-canonical-next-action.md
  • schemas/ripr/doctor.schema.json
  • tests/fixtures/verification/ripr/doctor.valid.json
  • xtask/src/verification_contracts.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

…on this branch

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

Copy link
Copy Markdown
Member Author

Ripr Rust Small on GitHub Hosted / Rust gates failed at cargo xtask goldens check on 8 fixture human.txt goldens (Summary: wording). Not this PR's: main is red the same way after #8275 changed the verdict wording, and this diff touches no fixtures. The fix exists in #8351 (wording-only re-bless); I ported its 16 fixture files into dc1a2b9 so this branch's goldens check can go green, and it no-ops once #8351 merges. Hosted CI will re-run on the push.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven enabled auto-merge (squash) October 17, 2026 06:36
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 17, 2026 06:52
auto-merge was automatically disabled October 17, 2026 06:52

Pull request was converted to draft

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 06:52
@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 enabled auto-merge (squash) October 17, 2026 06:52

@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 verification checks before upstream.

Verification questions

  • Confirm fixture, schema, and xtask contract are co-edited: doctor.valid.json now models a config-fail with the DTO; schema adds $defs.canonical_next_action; xtask whitelist appends canonical_next_action. Risk is only that doctor.valid.json's subject.root and subject.item are environment-anchored (workspace path), which the goldens check tolerates per the schema fixtures convention.
  • Confirm prerequisite: ripr test --package ripr --test doctor_json_schema doctor_json_names_the_canonical_recovery_only_when_setup_needs_one to confirm end-to-end schema+recovery key behavior.
  • Confirm ripr sensor failed (exit 2) in this packet so no in-tree ripr subprocess output is evidence here; the new end-to-end test in tests/doctor_json_schema.rs and cargo-test late receipt cover it, but no local witness of ripr doctor --json round-trip is available in this lane.

Refuted

  • JSON stop.kind/line could disagree because two inference paths exist (one for human, one for machine).; refuted because: Both go through the same canonical_next_action_for_doctor(self, first, root) call; Control 9 recomputes and asserts DTO equality with the attached one.

Parked follow-ups

  • Localized goldens drift carried in branch (dc1a2b9) is a no-op once #8351 merges; hosted CI reruns on push so manual pre-merge re-bless is not requested. Not this PR's fault, parked.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@settings settings Bot removed the merge-ready label Oct 17, 2026

Copy link
Copy Markdown
Member Author

Rust gates is red on goldens check, and it isn't from this PR. The drift is 34 fixtures' human.txt, none of which this change touches. It comes from #8412 (stub route line for every probe family), which merged without re-blessing, so main fails the same check. The fix is #8418, which blesses those fixtures.

No fix goes into this branch. Once #8418 merges I'll merge main in here so CI re-runs, and auto-merge stays armed.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as draft October 17, 2026 08:14
auto-merge was automatically disabled October 17, 2026 08:14

Pull request was converted to draft

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 08:14

@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 reviewer attention before upstream: findings remain.

Confirmed findings

  • DoctorReport.attach_canonical_next_action resets the field unconditionally, but render_json is invoked after attachment in doctor_json(); ordering invariant is implicit, not pinned by a test that calls attach then asserts the field is Some only after the failing check is added. Future refactor that re-orders attach/render or re-attaches after clearing checks could silently drop the field without a control catching it.

Verification questions

  • Confirm end-to-end test in tests/doctor_json_schema.rs requires the existing fixture_root("recovery") helper which is not declared in the visible diff hunk and a doctor_json() invoker; PASS depends on those continuing to exist and on schema validation accepting the new DTO.
  • Confirm schema $defs.canonical_next_action uses additionalProperties:true, so unknown keys are tolerated - additive but invisible to schema readers; consumers must validate via per-field types not full strict schema.
  • Confirm sensor evidence gap: the ripr sensor failed (exit 2), so no local subprocess witness of ripr doctor --json against the binary exists in this lane. cargo-test is the scheduled late evidence; until it lands, the lane relies on the doc+test seam and Control 9 only. Hosted CI ripr sensor run will close it.
  • Confirm doctor_json_names_the_canonical_recovery_only_when_setup_needs_one never asserts 'recovery_route', 'action_class', or 'non_claim' content from the DTO, only stop.kind/check_name. Control 9 covers those, but the e2e is the public proof surface.

Refuted

  • The new optional canonical_next_action could leak into non-doctor --json emitters (e.g., ripr check) and break additive invariants elsewhere.; refuted because: Field is declared on DoctorReport only and emitted via render_json inside crates/ripr/src/output/doctor.rs; ripr check's --format json uses a different producer and does not embed DoctorReport; docstring explicitly states the field is omitted for non-analysis profile and when first-command names a runnable command, and Control 9 + the schema test assert omission on those states.
  • Schema version should bump to 0.5 rather than additive 0.4 since a new top-level field with required internal sub-fields is added.; refuted because: Schema is intentionally additive, no consumer breaks on unknown keys; OUTPUT_SCHEMA.md and SPEC-0242 mark it #6986 additive; fixture co-edit confirms 0.4 is the published target.

Evidence gaps

  • cargo-test is scheduled-late; ripr sensor failed (exit 2) so this lane carries no ripr-subprocess witness. Local Control 9 + xtask check-output-contracts pass per PR author comment, but cross-check goldens and a real ripr doctor --json round-trip are deferred to hosted CI.
  • Cargo-test late receipt covers Control 9 and end-to-end but local ripr subprocess witness is absent (sensor failed exit 2); hosted CI is the only witness of the real ripr doctor --json round-trip.
  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven merged commit 4dbeb07 into main Oct 17, 2026
36 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/6986-doctor-json-canonical-action branch October 17, 2026 11:02
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