Repository navigation
fix(rust): a self-closed if statement lends no branch value to its predicate - #11939
Conversation
…edicate (#10880) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PResvVn1d7d3d4PYtRgdri
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PResvVn1d7d3d4PYtRgdri
…ess affected goldens (#10880) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PResvVn1d7d3d4PYtRgdri
|
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 59 minutes. View limit details
|
Review of record, head db6103aAngles and what I checked:
Findings: none blocking. Open and out of scope: Generated by Claude Code |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PResvVn1d7d3d4PYtRgdri
|
Head moved to 5a49a80: merged main (it took cache 1.125 / 0.132), so this PR now takes 1.126 / 0.133. Generated by Claude Code |
…; refresh version-pinned snapshots (#10880) The first guard also dropped the returned-value sink for differing arms (let r = if c { 1 } else { 0 }; r.min(cap)) and closure predicates, which runtime controls pin. Narrowed to arms that repeat the first arm's statement. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PResvVn1d7d3d4PYtRgdri
Review of record update, head 74b87a9The hosted Rust-only lane and the 4-shard run failed on 5a49a80, and the failures were real: my first guard (withhold the sink when the predicate line closes its own block) also dropped the sink for Changed on this head (production implementation and its unit tests; superseding the earlier review's correctness dimension):
Evidence on this head: lane suite ( No blocking findings known on this head. Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
Independent review (fresh-context reviewer, head 74b87a9): REVIEW_INCOMPLETE
Two distinct things are wrong at this head, and they need different owners. The required hosted lane is red, but every red I can see is inherited from main rather than produced by this candidate. Separately, the candidate itself carries a rule that is broader than the rule it documents, and a vocabulary change that collides with two other open PRs.
Inspected:
- Head
74b87a90d70212f4bbe8aed8f1040023f31b177c("fix(rust): a self-closed if statement lends no branch value to its predicate"), merge base912d98a5c1ef4ab7e44982712ed4235c3a5dd209, PR base tipa7431a52d9(the base the hosted user-text step checked out). Contribution is 123 files, +1,240/-N by the admission gate's count; the merge-base diff iscrates/ripr/src/analysis/classify/flow.rs+81/-0,crates/ripr/src/analysis/seam_cache.rs+12/-6, one new fixturefixtures/rust_closed_if_statement_tail/,crates/ripr/src/app/navigation.rs+2/-2,docs/OUTPUT_SCHEMA.md+2/-2, three version-pinned snapshots, 51 re-blessedexpected/human.txtgoldens, 52 fixtureexpected/CHANGELOG.mdledgers, and one changelog fragment. - The rule itself:
crates/ripr/src/analysis/classify/flow.rs:1020-1045(inline_arms_repeat_the_first) and its single call site atflow.rs:1063-1070, which returnsNonefromnext_branch_valuewhen the helper fires. Read the surrounding contract atflow.rs:1058-1062and the pre-existing neighbourchain_repeats_adjacent_valueatflow.rs:994-1018. - The wording change at
crates/ripr/src/app/navigation.rs(the "judges the whole seam" / "the whole spot" check-vs-repair disagreement note) and the re-blessed goldens that carry it, read at this head againstmaina69bf0214f7bd7e0537a1cdd07e95608e5a366e8. - Hosted state at this head, read through GraphQL
statusCheckRollupand the job logs:Admit PR CandidateSUCCESS (run 41258265303);Ripr Rust Small on GitHub Hosted / Rust gatesFAILURE (run 41258265281, job 124706144336, first failing step 16 "Repository policy preflight",xtask: check-policy-all: 1 gate(s) failed: check-process-policy);Rust-only feature laneFAILURE (run 41258265303, job 124705957310, first failing step 9 "Test --no-default-features --features lang-rust");Ripr Rust Small ResultFAILURE. - The user-text merge-base matcher at
xtask/src/policy/user_text.rs(banned_terms_in_line,strip_stage_vocabulary,evaluate_delta) and the corpus SPEC refresh rule, read at the merge base the hosted gate used.
Blocking:
- Candidate-attributable. The implemented predicate is broader than the rule it documents. The doc comment at
flow.rs:1058-1062states the case as "a one-lineifwhose arms hold the same statement". The implementation atflow.rs:1043-1044isarms.split_first().is_some_and(|(first, rest)| !first.is_empty() && rest.contains(first)), which asks only whether the first arm's text appears again among the later arms. A one-line three-arm form such asif c { r = 1; } else if d { r = 1; } else { r = 2; }yields arms["r = 1", "r = 1", "r = 2"], so the helper fires andnext_branch_valuereturnsNoneeven though the predicate genuinely decides the value the next line reads (ris2when neithercnordholds). The effect is that a real observed effect is not traced, so the change looks unnoticed and the tool can report a gap and propose a repair for behaviour a test already covers. That is the actionable-repair direction, not the conservative one. The added unit test (differing_inline_arms_and_closures_keep_the_adjacent_value) only pins the two-arm differing case; no three-arm case is exercised, and the fixturerust_closed_if_statement_tailis a two-arm case. - Candidate-attributable, but not a code defect: the change set is two claims in one. Besides the analyzer rule, this PR rewords the check/repair disagreement note from "seam" to "spot" in
navigation.rsand re-blesses the 50 goldens that carry it. That vocabulary is now claimed three different ways in open PRs for the same refusal family: this PR uses "the whole spot"; #11357 (a163c5c29) uses "nothing to start a repair from", "several gaps bind this finding" and "the limit on how many gaps ripr analyzes"; #11856 (3191d94c1) uses "no spot to start a repair from", "several spots bind this finding" and "the spot budget left".maintoday uses "no gap to start a repair from" and "the whole seam". One vocabulary has to be chosen before any of these land, otherwise the re-blessed goldens will fight each other and every one of them will need re-blessing again. The deciding criterion should be the glossary the user-text matcher enforces (docs/USER_TEXT_GLOSSARY.md). - Required hosted lane is red, and the reds are inherited, not produced here. (a)
check-process-policyfails because the allowlist row forcrates/ripr/src/output/first_pr/run_chain.rsno longer matches:mainwidened the import at line 21 to a groupeduse std::process::{Child, Command, ExitStatus, Stdio};, so the literaluse std::process::Commandthe row pinned is gone; the siblingCommand::newrow still matches line 368. #11995 (f51951cba) drops that orphaned row. This PR touches neither that file nor the policy ledger. (b) The feature lane failslsp::backend::list_actionable_items_tests::list_actionable_items_names_gaps_the_actionable_profile_hides(crates/ripr/src/lsp/backend.rs:12892, an order-sensitive assertion over the withheldstatic_unknowngroup order) plus the two cli_smoke testscheck_worktree_drill_in_commands_reach_the_uncommitted_findingandselector_location_misses_explain_syntax_and_preserve_retry_scope. Those three are themainreds that #12014 repairs with test-only changes; this PR touches neither the LSP nor the selector hints. Because the required lane is not green at this head, this review cannot beREVIEW_READY.
Non-blocking:
- Efficiency: acceptable, and slightly better than the code it sits next to.
inline_arms_repeat_the_firstscans exactly one line per probe, masking comments and strings into a singleStringand pushing&strslices for the arms, so there is no per-arm allocation and no extra I/O, process spawning or cache effect. The addedfunction.body.lines().nth(start_index)atflow.rs:1063-1067is one more prefix walk over the function body per probe, on a path that already walks that body twice (chain_repeats_adjacent_valuecollects the whole body into aVecof&stratflow.rs:995). The increase is a constant factor on an existing O(probes x body-lines) path, not a new complexity class, and nothing grows without bound. No memory-growth or newly-reachable-waste concern. - The admission gate passed, but note what it counts: the cap is 160 files and 3,000 changed lines measured after subtracting paths the base commit declares generated in
.gitattributes, and that file declaresfixtures/**/expected/** linguist-generated. The 51 re-blessed goldens therefore do not count against the cap, which is why a 50-golden re-bless can be admitted as a 1,240-line candidate. That is the repository's own rule, not a defect, but it means the gate number materially understates the review surface here. - The fixture
expected/CHANGELOG.mdledgers record the reason as "RIPR-SPEC-0108: plain wording 'spot' for 'seam' in the check/repair disagreement note (#10880)", and the same issue number#10880is cited in the analyzer rule's own comment atflow.rs:1060. One issue number covering two unrelated claims makes the ledger hard to audit against the code; worth separating before landing. seam_cache.rsreads as a ~125-line deletion when you diff this head againstmain, but that is branch-behind drift; the merge-base contribution is +12/-6 and is a schema-version bump only.- Comparing this head against
mainfor the wording change is misleading:mainalready reworded one arm of the same refusal family ("no gap ID ... no gap to start a repair from"), so a merge will need a re-bless on top of whatever vocabulary is chosen.
Not run:
- No Rust toolchain is installed on this host (
rustc,cargoandrustupare all absent), so there was no local build, nocargo xtask precommit, no local test run, and no local golden re-bless. Every Rust-level statement above comes from the hosted job logs at this exact head or from reading source at this exact SHA. - I did not execute the user-text merge-base matcher locally. I reproduced its rules (
strip_identifiers,strip_stage_vocabulary, per-file delta against the merge base) and computed the delta for all 51 changed goldens: no violations, which is consistent with that hosted step passing at this head. The 1,626-file re-bless in #11357 is where that matcher does fire; it does not fire here. - I did not run a mutation, runtime or property experiment against the three-arm shape in finding 1; that case is argued from the source, and confirming it needs a build this host cannot do.
…wording and its fixture out of this change (#10880) The independent review found the first-arm-repeats test also fired for if c { r = 1 } else if d { r = 1 } else { r = 2 }, where the condition does decide r. All inline arms must now agree. The wording change collided with two other open PRs, so it and the goldens it re-blessed are dropped here. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PResvVn1d7d3d4PYtRgdri
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PResvVn1d7d3d4PYtRgdri
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PResvVn1d7d3d4PYtRgdri
EffortlessSteven
left a comment
There was a problem hiding this comment.
Independent review (fresh-context reviewer, head cafddb7): REPAIR_REQUIRED
Inspected:
- Head
cafddb7e125b431868893a3eb16fcc19eb94373b("Merge main into claude/project-thread-58r3x9"), a merge of the current main tip99b2e4d08e5dbed103d661e89cf1c6fabb6a7b62. That tip is also the merge base, so the contribution is exactly 17 paths:crates/ripr/src/analysis/classify/flow.rs(M),crates/ripr/src/analysis/seam_cache.rs(M),crates/ripr/tests/lsp_lifecycle/gap_corpus_currentness.rs(M),xtask/src/tests/rust_corpus_projection.rs(M),docs/OUTPUT_SCHEMA.md(M), fourfixtures/boundary_gap/.../unchanged-after-attempt/*.json(M),.ripr/traceability.d/10880-closed-if-statement-tail.toml(A),changelog.d/10880-closed-if-statement-tail.md(A), and the corpus casetrap-closed-if-identical-arms(A x 5). - The rule at this head:
crates/ripr/src/analysis/classify/flow.rs:1022-1047(inline_arms_all_agree) and its single call site atflow.rs:1066-1070, against the neighbourchain_repeats_adjacent_valueatflow.rs:994-1017. Theflow.rsblob is40fd6f7489, byte-identical to the blob atd185c79d2, so the rule has not moved since the previous review. - The new corpus case in full:
cases/trap-closed-if-identical-arms.json,subjects/authored-closed-if-identical-arms/src/lib.rs.txt,expected/rows/trap-closed-if-identical-arms.json; and the cache side,crates/ripr/src/analysis/seam_cache.rs:602-608with the sharded and compact constants, the corpus-projection pin and the currentness pin. - Hosted state at this head via GraphQL
statusCheckRollup, andbranchProtectionRulesonmain.
Blocking:
- Candidate-attributable, and not raised in the earlier review: this PR and #12002 both claim cache generation
1.126for two different semantic transitions, from the same base1.125. The cache schema version is the mechanism that stops a persisted verdict earned under the old rule from being served under the new one; the earlier review for #12002 called the bump "the repository's established cache-version discipline". At this headcrates/ripr/src/analysis/seam_cache.rs:602-608readsCACHE_SCHEMA_VERSION = "1.126", noted as "a predicate on a self-closedifstatement takes no branch-value sink from the next line (#10880)"; #12002's head5ab40c5fccarries the same constant at the same line, noted as "those prelude globs keep assertion credit only whenCargo.lockpins an audited version of the crate (RIPR-SPEC-0369)". The twoseam_cache.rsblobs differ (903c6c2d1here,31aca082fthere) against a common base blob4bd263ce4, so the two candidates conflict textually at that hunk. The consequence is concrete, not cosmetic: if both land under1.126, a cache directory written by a build of one rule set is read by a build of the other, because the generation number is what is supposed to separate them. The fix is cheap and the deciding criterion is order: whichever PR lands second re-bumps to1.127, updates its transition note and re-proves the bump. This PR also bumps the sharded and compact families (0.132->0.133) that #12002 leaves alone, so the candidates disagree about the cache surface as well as the number. - The required hosted check is absent at this head, so the candidate cannot be
REVIEW_READY.Ripr Rust Small Result-- the only required status check onmain-- is not present in this head's contexts, and every Rust lane (rust-coverage,rust-tests-junit,future-clippy,msrv,cargo-deny,ci-result,Rust-only feature lane,source-identity) reportsSKIPPED. This is absence, not red:.github/workflows/routed-rust.ymltriggers onpull_request: types: [labeled]and its route fires only on amerge-readylabel-addition event, and this head was pushed after the label was applied (it is a merge of main, not a push of the labelled commit). The remedy is mechanical -- remove and re-apply themerge-readylabel so the labelled event re-fires atcafddb7e1. I record this as a proof gap, not a candidate defect; the candidate cannot be promoted until a hosted Rust lane has actually run at this head.
Non-blocking:
- Earlier finding 1 (the predicate was broader than the rule it documented) -- REPAIRED. The earlier review observed
arms.split_first().is_some_and(|(first, rest)| !first.is_empty() && rest.contains(first))and showed thatif c { r = 1; } else if d { r = 1; } else { r = 2; }wrongly fired the rule. At this headflow.rs:1044-1046requiresrest.iter().all(|arm| arm == first)with!rest.is_empty(), so a differing last arm no longer fires, and the new testthree_identical_inline_arms_lose_the_sink_and_a_differing_last_arm_keeps_it(flow.rs:2189-2200) pins exactly the earlier counterexample in both directions: the three-identical form yields no sink, the differing-last-arm form yields one. The earlier complaint that no three-arm case was exercised is now answered by a discriminating test rather than by prose. - Earlier finding 2 (the change set was two claims in one; the "seam" to "spot" reword in
navigation.rsplus 50 re-blessed goldens collided with #11357 and #11856) -- REPAIRED.crates/ripr/src/app/navigation.rsis byte-identical to the current main tip at this head (git diff 99b2e4d0 cafddb7e1 -- crates/ripr/src/app/navigation.rsis empty), and noexpected/human.txtgolden appears in the 17-path contribution. The vocabulary conflict is gone from this candidate, and the body's "No human-output goldens or wording changes (reverted after review)" agrees with the diff. - Earlier finding 3 (the required lane was red, from inherited base reds) -- STALE in its concrete form. The two inherited reds the earlier review attributed to
mainare now carried fixed in this branch:policy/process_allowlist.d/11720-first-pr-run-chain.txtis blob2402ccd29dhere, identical to the current main tip, and theeq-divert-*/shop-tier-gold-arm-unreachedcorpus rows are likewise main-identical. Both repairs are inherited main content (carriers #11975 and #11995), not this candidate's work; what is left is the absent-lane problem under Blocking. - Earlier finding 4 (efficiency) -- STILL HOLDS, and the answer is unchanged: no material cost.
inline_arms_all_agree(flow.rs:1022-1047) masks one line into a singleStringand pushes&strslices for the arms, so the newall()predicate is O(arms) over an already-allocated vector with no per-arm allocation, no extra I/O, no process spawning and no cache effect. Thefunction.body.lines().nth(start_index)walk atflow.rs:1066-1069is a third prefix walk over a body thatchain_repeats_adjacent_valuealready collects wholesale atflow.rs:995; a constant factor on an existing O(probes x body-lines) path, not a new complexity class. Changingrest.contains(first)torest.iter().all(...)does not change growth rate. No memory-growth or newly-reachable-waste concern. - Earlier findings 5-7 -- STALE or REPAIRED. The admission-gate understatement (5) no longer bites, because the 51 re-blessed goldens that made it material are gone and the surface is 17 paths; one issue number covering two claims (6) is repaired, since only the analyzer rule and its corpus row remain under
#10880; theseam_cache.rsbranch-behind reading (7) is repaired, since the branch is now based on the current main tip. - The corpus row follows the repository's own convention.
expected/rows/trap-closed-if-identical-arms.jsoncarriestruth: "not_discriminated",ideal_verdict: "gap",observed_verdict: "limited",outcome: "abstained",findings_scored: 1-- the same shape as the merged sibling roweq-divert-match-later-arm-old-constantin the current main tip. The subject is a realistic two-arm self-closedifwhose only test callspick(5), so the case'sruntime_mutant_killmethod is consistent with the pin rather than asserted over it, and the documented contract moved in the same change (docs/OUTPUT_SCHEMA.md,1.125->1.126). - The new traceability row registers three of the five inline-arm controls.
.ripr/traceability.d/10880-closed-if-statement-tail.tomlis headed "Registers the identical inline-arm controls (#10880)" and names three of them; it omitslater_arms_that_only_agree_with_each_other_keep_the_first_sink(flow.rs:2224) and the multi-line chain controls (flow.rs:2237onward).check_traceabilitydoes not require a test to be registered -- the earlier #12005 review established that the gate accepts a partial registration -- so this is drift, not a failure, and partial registration is the repository's convention.
Not run:
- Not run:
cargo xtask precommit, the Rust lane,verdict-corpus check-all,cargo xtask fixturesandcargo xtask goldens check-- the full workspace build exceeds this single-PR review's budget, and the required hosted lane has not run at this head, so no hosted exact-head proof exists for the analyzer change or for the new corpus row. The Rust toolchain is present atC:\Users\steven\.cargo\bin(cargo 1.95.0,rustc 1.95.0, matching the repo'srust-toolchain.tomlpin); I did not use it to run the analyzer against the corpus subject, so the new row'sobserved_verdict: "limited"is read from the committed fixture, not reproduced. - Not run: a mutation, runtime or property experiment against the three-arm shape; the repair is argued from the source (
flow.rs:1044-1046) and the new test's assertions (flow.rs:2189-2200), not from executing that test here. - Not established: whether the corpus case's committed expected row is what the analyzer now produces. Nothing at this head demonstrates the row was regenerated at
cafddb7e1; the delta fromd185c79d2changed no corpus artefact.
Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head cafddb7e125b431868893a3eb16fcc19eb94373b. Not an approval.
|
Response to the cafddb7 review (REPAIR_REQUIRED):
Generated by Claude Code |
…er-attempt fixtures and receipt together (RIPR-SPEC-0369) 1.126 belongs to #11939. content_sha256 in the exposure fixtures and agent-verify.json, and the file digests the agent receipt attests to, move in one step. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmorcFfvgqr1j4EemBn
|
Review of record, head cafddb7 (REVIEW_READY) Angles: production rule ( Findings and resolutions:
Hosted: Merging with the expected head SHA. Generated by Claude Code |
Main took cache schema 1.126 (#11939); this branch stays at 1.127. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmorcFfvgqr1j4EemBn
…ked versions (RIPR-SPEC-0369) (#12002) * fix(analysis): credit verification prelude globs only for audited locked versions (RIPR-SPEC-0369) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmorcFfvgqr1j4EemBn * fix(analysis): pin test for cache 1.126 and spec wording for the unaudited-version refusal Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmorcFfvgqr1j4EemBn * test(analysis): check the spec's audited-version table against the code authority (RIPR-SPEC-0369) The const is the single authority; the spec table is verified against it so a one-sided edit fails instead of drifting. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmorcFfvgqr1j4EemBn * test(fixtures): refresh content_sha256 for the 1.126 cache schema in unchanged-after-attempt (RIPR-SPEC-0369) The cache_schema_version field is inside the hashed artifact, so bumping it changes content_sha256; the hosted cli_smoke run reported the produced value. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmorcFfvgqr1j4EemBn * fix(cache): bump the schema to 1.127 and regenerate the unchanged-after-attempt fixtures and receipt together (RIPR-SPEC-0369) 1.126 belongs to #11939. content_sha256 in the exposure fixtures and agent-verify.json, and the file digests the agent receipt attests to, move in one step. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmorcFfvgqr1j4EemBn * Judge a dropped-in prelude crate by the importing package's nearest lockfile A nested workspace with its own Cargo.lock passed the manifest check but the audited-version check read the outer lock. Look the lock up from the importing directory instead, with a test where inner and outer locks disagree both ways. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmorcFfvgqr1j4EemBn * Fix comment indentation left by the main merge Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmorcFfvgqr1j4EemBn --------- Co-authored-by: Claude <noreply@anthropic.com>
Governing issue or accepted claim: #10880
Acceptance delta (one sentence): A one-line
ifwhose arms hold the same statement no longer lends the next line as a branch value, so a pin on the boundary input is no longer credited when the condition decides nothing observable.Change
classify/flow.rs:next_branch_valuereturns no branch value when every inline{ .. }arm on the predicate line is identical (inline_arms_all_agree). Differing arms, closures, absorbing tails and open-brace headers keep the adjacency rule.flow.rscover three tails (r + 0,r * 2,r.max(0)), a three-arm form with a differing last arm, and the controls that must keep the adjacent value.trap-closed-if-identical-arms(previously read credited at labeling; nowlimited,propagation_unknown).Not in this PR
No human-output goldens or wording changes (reverted after review). Hosted reds inherited from main (
check-process-policy, LSP action order, two cli_smoke tests, Rust corpus drift on eq-divert/shop-tier rows) have fixes of record from the coordinator; this branch will merge main once they land.🤖 Generated with Claude Code
https://claude.ai/code/session_01PResvVn1d7d3d4PYtRgdri