Skip to content

fix(tests): repair main's three red Rust test shards (explain --format json hints, withheld group order) - #12014

Closed
EffortlessSteven wants to merge 1 commit into
mainfrom
claude/main-red-explain-format-json-tests
Closed

EffortlessSteven wants to merge 1 commit into
mainfrom
claude/main-red-explain-format-json-tests

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #11844 (explain hints now name --format json); main red on Rust test shards 1, 2 and 4, observed on #11995 run 41257707273.
Acceptance delta (one sentence): the three tests check_worktree_drill_in_commands_reach_the_uncommitted_finding, selector_location_misses_explain_syntax_and_preserve_retry_scope and list_actionable_items_names_gaps_the_actionable_profile_hides pass on main again.

Scope

Test expectations only; no production change.

  • cli_smoke.rs: the unmatched-explain recovery names the documented --format json spelling (fix(explain): suggest check --format json in selector hints (#11570 item 4) #11844), while the context recovery still names --json. The drill-in test now carries the expected listing per recovery; the selector-recovery test accepts either spelling for the same scoped listing.
  • lsp/backend.rs: the withheld static_unknown group order is :94 then :98; the test pinned the reverse. Observed deterministically (same on the hosted shard and locally).
  • Changelog fragment.

Proof

Each test run alone on origin/main + this change: pass (cargo test -p ripr --test cli_smoke worktree_drill_in, ... selector_location_misses, cargo test -p ripr --lib list_actionable_items: 13 passed). All three failed before.

What this does not prove: other shards; hosted exact-head result.

Rollback

Revert this PR.


Generated by Claude Code

…withheld group order)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzVRdKSJ5BS2kgG3bNK
@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 Nov 1, 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 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 149 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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 1e570587-1265-4cd5-963e-1dce88d4d0e9
Commits

Reviewing files that changed from the base of the PR and between a69bf02 and cad7409.

Files selected for processing: 3
  • changelog.d/main-red-explain-format-json-tests.md
  • crates/ripr/src/lsp/backend.rs
  • crates/ripr/tests/cli_smoke.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@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 cLI recovery expectations are route-specific: unmatched explain accepts the documented --format json spelling, while context recovery retains --json; both still require the same scoped listing.
  • Confirm the LSP change only reverses the pinned withheld static_unknown group order and adjusts the explanatory comment; no production ordering logic is changed.
  • Confirm the LSP change alters only a test expectation and its explanatory comment; it does not alter production ordering logic.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • The PR claims focused tests pass, but the packet records ripr failure and lacks a cargo-test receipt; the broader acceptance claim remains unverified in this review context.
  • The available evidence does not prove the claim that these changes turned all Rust shards green, and the ripr sensor failed with exit code 2.

@EffortlessSteven EffortlessSteven left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent review (fresh-context reviewer, head cad7409): REVIEW_INCOMPLETE

Inspected:

  • Subject: PR #12014, head cad740904c6cb9040164600e2dc3264a18b58192, base a69bf0214f7bd7e0537a1cdd07e95608e5a366e8 (current main tip), 3 paths, one commit, not a draft. Governed by issue #11844.
  • Contribution was measured as the candidate's own delta: git merge-base(head, main tip) is exactly the main tip a69bf0214, so this candidate is one commit ahead of main with nothing outstanding from an earlier base. The 3-path file list is far below the silent 300-path cap of the compare API and of pulls/<n>/files, so nothing was truncated; I confirmed the paths by recursive git diff.
  • Both source edits sit inside #[cfg(test)] code: crates/ripr/src/lsp/backend.rs (module list_actionable_items_tests) and crates/ripr/tests/cli_smoke.rs; the third path is a changelog fragment. There is no production change in this PR.

What the candidate changes, and whether it matches its own stated acceptance:

  • crates/ripr/src/lsp/backend.rs - the expectation for withheld_unknown_findings in list_actionable_items_names_gaps_the_actionable_profile_hides changes from ["probe:pricing:98:predicate", "probe:pricing:94:predicate"] to ["probe:pricing:94:predicate", "probe:pricing:98:predicate"].
  • crates/ripr/tests/cli_smoke.rs - check_worktree_drill_in_commands_reach_the_uncommitted_finding is split so the unmatched-explain recovery must name the --format json spelling while the selector-less explain/context recoveries must name the --json spelling; selector_location_misses_explain_syntax_and_preserve_retry_scope now accepts either spelling of the scoped listing.
  • This matches the stated acceptance: the three tests that fail on main pass again.

Resolving the LSP canonical-group ordering question (the open item from the prior pass):

  • The production sort owner is crates/ripr/src/lsp/diagnostics.rs, canonical_group_members (lines 135-230). It buckets findings by canonical-gap key, by overlap signature and by site-missing label into a BTreeMap<usize, Vec<usize>> keyed by a union-find root index, and returns grouped.into_values(), that is ascending root index. A bucket's root is its lowest-indexed member, so the group order is the order of each group's lowest-indexed member in snapshot.findings, not a string "canonical-group key" order.
  • crates/ripr/src/lsp/backend.rs consumes that owner for withheld_unknown_findings, filtering by primary visibility in the Actionable profile and then by finding_is_withheld_unknown. In the fixture, probe:pricing:94:predicate is index 3 and stands in its own group (root 3); probe:pricing:98:predicate is a member of the canonical group rooted at index 4 (probe:pricing:96:predicate). Ascending root order therefore places :94 before :98.
  • The old expectation was inverted against the production owner; the production sort is not defective and the test expectation was stale. The old inline comment ("the mixed canonical group sorts before the raw finding's own group") describes a string-keyed raw:<id> bucket scheme that no longer exists: gap-less findings with no overlap signature are not bucketed at all in the current implementation.
  • Hosted execution confirms this independently. #12018's Rust-only feature lane (job 124728408186) ran the Rust tests at head 547296003, which is main-based and does not contain this fix. Its log shows left: ["probe:pricing:94:predicate", "probe:pricing:98:predicate"] against right: ["probe:pricing:98:predicate", "probe:pricing:94:predicate"]. The candidate's new expectation is the value the production actually emits.

The --format json / --json split is likewise confirmed against production owners, not only against the test: explain's unmatched-selector path uses explain_navigation_list_command -> explain_list_command (crates/ripr/src/app/explain.rs:138-145), which rewrites the trailing " --json" to " --format json", while context's unmatched-selector path uses navigation.list_command() (crates/ripr/src/app/context.rs:157), and crates/ripr/src/app/navigation.rs:461-463 is format!("{} --json", self.list_prefix) - the --json alias, not rewritten. The hosted log for the same #12018 lane shows the explain recovery printing ripr check --root ... --base HEAD --worktree --format json, the mismatch that makes the base test red.

Blocking:

  • None attributable to this candidate. The three repaired assertions are stale expectations against unchanged production, the hosted base-side evidence above confirms the production behaviour the new expectations encode, and the red lane on this head is not this PR's doing.

Non-blocking:

  • The relaxed selector assertion drops the only pin on the context spelling. selector_location_misses_explain_syntax_and_preserve_retry_scope loops over explain and context and now accepts expected_listing or its --format json twin. The scope (--root/--diff) is still pinned, which is what the test is named for, but no test now asserts that the context unmatched recovery names --json specifically: the drill-in test pins the explain spelling and the selector test accepts both. Branching the assertion on command would keep the per-command discrimination at no extra cost.
  • The production asymmetry the candidate now pins is itself worth naming. The same command emits two spellings of the same retry invocation depending on whether the selector was unmatched or absent, and explain_list_command is applied on the explain path but not on the context path. The candidate encodes that difference as expected behaviour - faithful to the current tree, but #11844's direction ("explain hints name --format json") reads better as "every user-facing hint names --format json", in which case the context path is the unfinished half and this test will change again.
  • The group order is not a documented contract. The order the candidate pins is a function of each finding's position in snapshot.findings, so a producer-side reordering of that vector changes the observable order without changing grouping semantics. A comment recording that the order is position-derived would stop the next reader from re-deriving the string-key theory the old comment carried.
  • Efficiency. I found nothing to flag: this candidate changes test expectations only - no production work, no allocation, no extra pass, no re-parse. Because it has no production change, it also lowers no runtime cost; the per-document clone of the canonical root noted in the sibling review for #11963 remains, out of scope here.

Hosted evidence at this exact head:

  • The required status check Ripr Rust Small Result is present and red (run 41263263919, job 124722672346, failing at "Summarize routed result"), and Ripr Rust Small on GitHub Hosted / Rust gates (job 124720833652) fails at step 16, "Repository policy preflight", reporting that the use std::process::Command allowlist entry for crates/ripr/src/output/first_pr/run_chain.rs is orphaned: its max_count=1 pattern is not found in any tracked file.
  • That red is base-attributable. Verified from source: at the main tip a69bf0214, crates/ripr/src/output/first_pr/run_chain.rs contains no std::process::Command (git search exits 1), while policy/process_allowlist.d/11720-first-pr-run-chain.txt:2 still declares that entry. This candidate touches neither file. The identical preflight failure is present on #12017 and #12018 at the same base. Repair carrier #11975.
  • Because the preflight fails first, the job's "Required Rust tests" step (step 30) was SKIPPED on this head. The three tests this candidate repairs have therefore never executed at this head. The hosted evidence that main is red on them comes from the main-based head 547296003 described above, not from this candidate's own head.
  • This is therefore not REVIEW_READY (required check red; the Rust lane that would exercise the repaired assertions was skipped before it could run) and not REPAIR_REQUIRED (no candidate-attributable defect): REVIEW_INCOMPLETE.

Not run:

  • The Rust toolchain on this host is not on PATH: rustc, cargo and rustup are all absent from PATH. Nothing was built, tested, linted, or cargo xtask-run locally - not precommit, not check-workflows, not cargo fmt --check - and the three repaired tests could not be executed here. Every Rust-level statement above comes from hosted job logs or from source read at the reviewed SHA cad740904.
  • The candidate's own head has no executed Rust test: the policy preflight fails before the test step, so the repaired assertions are unexecuted here. Their behaviour is inferred from the production source plus the main-based hosted run at 547296003, not observed on this head.

Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head cad740904c6cb9040164600e2dc3264a18b58192. Not an approval.

Copy link
Copy Markdown
Member Author

The fixes this duplicates landed in #11995 (squash 99b2e4d). Closing as superseded.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants