Skip to content

fix(rust): close getter-spelled and chain-built twin false credit, compare same-line rewrites (#7135, #10657) - #10668

Merged
EffortlessSteven merged 5 commits into
mainfrom
claude/project-thread-lpb3vw
Oct 26, 2026
Merged

EffortlessSteven merged 5 commits into
mainfrom
claude/project-thread-lpb3vw

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Before: a twin comparison whose sides differed only by a getter-spelled read-only use (c.add(20); d.add(20); let _ = d.history().len(); assert_eq!(c.history(), d.history())), or where one side was built through the owner in its own let (let d = Bag::new().add(20).clone()), still earned exposed on main. A rewrite on the same line as the assertion was over-refused.

After: both false credits are refused, and same-line rewrites keep their credit. Block conditions are deliberately not part of the history: guard text cannot prove two twins diverge (if ready vs if ready == true), so twins that differ only by guards stay refused, as on main.

How: owner_fed carries each binding's read getter, so only_field_reads_between excludes getter-spelled read-only uses. binding_built_through_owner refuses when a compared side is built through the owner in its own let, using only the declaration live at the read. The history window ends at the assert offset on the read line. Spec RIPR-SPEC-0228 states the limits (textual comparison, chained sides refuse whatever their arguments, struct-literal "compared up to the first brace"), and all 6 tests in collection_read_non_discriminating.rs are registered in traceability.

Swarm / Source Boundary

  • swarm-only CI, runner, routing, source-of-truth, or agent-operating surface

Source-of-truth Links

Governing issue or accepted claim: #10657
Acceptance delta (one sentence): getter-spelled and chain-built twin comparisons no longer earn exposed, and the same-line, traceability and spec edges from #7135 are closed.

Validation

  • cargo test -p ripr --test collection_read_non_discriminating: 6 pass on the head merged with main (e4b0aaf); on main the getter and chain cases fail.
  • cargo test -p ripr --lib classify (1885 pass), cargo clippy -p ripr --all-targets -- -D warnings, cargo fmt --check, check-evidence-promotion-honesty and goldens check passed on 772112c.
  • Fixtures are static-analysis inputs; no native wrong-owner executions were run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fp8NXWwUjH6mmCimsKAPes

…n-built sides, compare guards and same-line rewrites (#7135, #10657)

Getter-spelled read-only uses (d.history().len()) no longer count as driving
history, a side built through the owner in its own let refuses the comparison,
block conditions attach to the driving statements they guard, and the history
window now ends at the assert on the read line.

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

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 197 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: e4886495-45b1-4357-9ce5-7c568ead92c3
Commits

Reviewing files that changed from the base of the PR and between e4b0aaf and 5f043a5.

Files selected for processing: 5
  • .ripr/traceability.d/7135-twin-collection-read-followup.toml
  • changelog.d/10657-twin-history-edges.md
  • crates/ripr/src/analysis/classify/reveal.rs
  • crates/ripr/tests/collection_read_non_discriminating.rs
  • docs/specs/RIPR-SPEC-0228-rust-field-write-observation.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@devin-ai-integration devin-ai-integration 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.

Devin Review found 4 potential issues.

Devin Review

…t the read (#10657)

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

@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

  • Getter metadata is propagated per binding, but the history comparison passes that getter into only_field_reads_between for every statement, so a direct field read and a getter-spelled read are treated alike even when their observable values differ.

Verification questions

  • Confirm the new guard fixtures are static-analysis inputs, not executable Rust tests, so undefined helper functions do not demonstrate runtime discriminator behavior.
  • Confirm the aggregate case table checks the expected exposed status for eight scenarios in one test, rather than yielding one independently named regression test per behavior.

Refuted

  • The traceability file registers the aggregate test but omits two existing named tests in the changed integration file.
  • Chain-built sides should retain argument-sensitive credit.; refuted because: The implementation intentionally refuses all owner-built chained sides because their statement history is not recoverable; this conservative boundary is specified in RIPR-SPEC-0228 and does not create a false positive credit.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • The ripr sensor failed with exit code 2, and the completed cargo-test receipt is not present in the supplied evidence, so the PR's claimed regression suite cannot be independently confirmed here.

Copy link
Copy Markdown
Member Author

Affected source-disposition review, /root/review_guard_history_disposition, exact head 8d1a2dc versus base dc38b8c. This is an unexecuted source lead, not a reproduced regression. The disposition in discussion4376621504 documents equivalent if ready / if ready == true guards, but the cited general arithmetic-text limitation does not establish this particular guarded output preexisted. Base reveal.rs histories omit guard headers; candidate histories include the differing guard text, apparently turning identical twin histories into unequal histories and bypassing their refusal.

Please use the existing owner/reviewer lane to establish the same-case delta before final clearance: a compilable multiline Bag { items: Vec } with add(x) pushing x, tested against owner mutation push(x + 1). Two bags get the same initial push guarded respectively by if ready and if ready == true, then both call add(20) and assert their items equal. Test ready=true and ready=false separately. Pair with same-spelling guards (negative) and an independent literal expected vec![20] (discriminating positive). Run each case in a separate analyzer input so the genuine positive cannot mask a false promotion; use identical fixture/diff bytes through exact base/candidate producers and native original/wrong-owner selected-test executions.

Existing job40313930888/121543181701 records a focused HEAD pass but explicitly not red/green proof; guard intent was rejected/unsupported and red-green work deferred with zero matching receipts. Thus that packet does not settle this specific comparison. If new promotion is confirmed, conservatively repair admission and register a discriminating honesty case; if refuted, preserve the raw comparison and update the disposition. No duplicate native experiment, source/lifecycle change or qualification request was started by this review. Shared #10663/#10660 prerequisite and author custody remain intact.

Sources:

/// abstracted. Different arguments, call counts, seeding or constructors make
/// the histories differ. A constructor that cannot be found, or that names
/// another compared binding (`let d = c.clone()`), is treated as equivalent:
/// no independence is established.
fn equivalent_owner_histories(
test: &TestSummary,
bindings: &std::collections::BTreeSet<&str>,
path: &str,
read_line: usize,
) -> bool {
let masked = mask_comments_and_strings(&test.body);
let skipped = read_line.saturating_sub(test.start_line);
let offset: usize = masked
.split_inclusive('\n')
.take(skipped)
.map(str::len)
.sum();
let (Some(before_masked), Some(before)) = (masked.get(..offset), test.body.get(..offset))
else {
return true;
};
let mut statements = Vec::new();
let mut start = 0;
for (at, ch) in before_masked.char_indices() {
if matches!(ch, ';' | '{' | '}') {
statements.push((start, at));
start = at + 1;
}
}
statements.push((start, before_masked.len()));
let ident = |ch: char| ch.is_alphanumeric() || ch == '_';
let mentions = |text: &str, name: &str| {
text.match_indices(name).any(|(at, found)| {
!text[..at]
.chars()
.next_back()
.is_some_and(|ch| ident(ch) || ch == '.')
&& !text[at + found.len()..].starts_with(ident)
})
};
let abstracted = |text: &str, name: &str| {
let mut out = String::new();
let mut last = 0;
for (at, found) in text.match_indices(name) {
let end = at + found.len();
if !text[..at].chars().next_back().is_some_and(ident) && !text[end..].starts_with(ident)
{
out.push_str(&text[last..at]);
out.push('$');
last = end;
}
}
out.push_str(&text[last..]);
out.split_whitespace().collect::<Vec<_>>().join(" ")
};
let mut histories: Vec<Vec<String>> = Vec::new();
for binding in bindings {
let mut history = Vec::new();
let mut constructed = false;
for &(from, to) in &statements {
let (Some(code), Some(text)) = (before_masked.get(from..to), before.get(from..to))
else {
return true;
};
// `c . items.len()` is the same field access as `c.items.len()`.
let (code, text) = (tighten_dots(code), tighten_dots(text));
let (code, text) = (code.as_str(), text.as_str());
let trimmed = code.trim_start();
let declared = trimmed
.strip_prefix("let ")
.map(|rest| rest.trim_start())
.map(|rest| rest.strip_prefix("mut ").map_or(rest, str::trim_start))
.is_some_and(|rest| {
rest.strip_prefix(binding)
.is_some_and(|after| !after.starts_with(ident))
});
if declared {
let Some((_, rhs)) = text.split_once('=') else {
return true;
};
if bindings
.iter()
.any(|other| other != binding && mentions(rhs, other))
{
return true;
}
constructed = true;
history.push(format!("let {}", abstracted(rhs, binding)));
} else if mentions(code, binding) && {
let stripped = strip_sibling_field_reads(code, binding, path);
!only_field_reads_between(&stripped, 0, stripped.len(), binding, None, path)
} {
history.push(abstracted(text, binding));
}
}
if !constructed {
return true;
}
histories.push(history);
}
histories.windows(2).all(|pair| pair[0] == pair[1])
and
let mut histories: Vec<Vec<String>> = Vec::new();
for (binding, getter) in bindings {
let mut history = Vec::new();
let mut constructed = false;
// Guards (`if f1 {`) of the blocks the statement sits in: part of the
// statement's meaning once the block contributes to the history.
let mut guards: Vec<(String, bool)> = Vec::new();
for &(from, to, terminator) in &statements {
let (Some(code), Some(text)) = (before_masked.get(from..to), before.get(from..to))
else {
return true;
};
// `c . items.len()` is the same field access as `c.items.len()`.
let (code, text) = (tighten_dots(code), tighten_dots(text));
let (code, text) = (code.as_str(), text.as_str());
let trimmed = code.trim_start();
let declared = trimmed
.strip_prefix("let ")
.map(|rest| rest.trim_start())
.map(|rest| rest.strip_prefix("mut ").map_or(rest, str::trim_start))
.is_some_and(|rest| {
rest.strip_prefix(binding)
.is_some_and(|after| !after.starts_with(ident))
});
let mut entry = None;
if declared {
let Some((_, rhs)) = text.split_once('=') else {
return true;
};
if bindings
.keys()
.any(|other| other != binding && mentions(rhs, other))
{
return true;
}
constructed = true;
entry = Some(format!("let {}", abstracted(rhs, binding)));
} else if mentions(code, binding) && {
let stripped = strip_sibling_field_reads(code, binding, path);
!only_field_reads_between(&stripped, 0, stripped.len(), binding, *getter, path)
} {
entry = Some(abstracted(text, binding));
}
if let Some(entry) = entry {
for (guard, added) in &mut guards {
if !*added {
history.push(format!("if {guard}"));
*added = true;
}
}
history.push(entry);
}
match terminator {
'{' => guards.push((abstracted(text, binding), false)),
'}' => {
guards.pop();
}
_ => {}
}
}
if !constructed {
return true;
}
histories.push(history);
}
histories.windows(2).all(|pair| pair[0] == pair[1])

…erences stay refused (#10657)

Guard text cannot prove two twins diverge (`if ready` vs `if ready == true`),
so the comparison returns to refusing a pair that matches except for guards.

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

Copy link
Copy Markdown
Member Author

Source-disposition lead confirmed from the code and repaired in 772112c. Base histories dropped guard headers, so a pair matching except for its guards was refused; 8d1a2dc attached guard text and turned if ready / if ready == true twins into "different" histories, a new promotion path. Guard text cannot prove divergence, so block conditions are out of the history again: guard-only differences stay refused (same as base).

Tests (run through check_workspace, one analyzer input per case in twin_history_edges_getter_chain_guard_and_same_line): equivalent_spelled_guards_stay_refused (reviewer's shape, expects not exposed), different_guards_stay_refused, same_guard_twins_stay_refused. The independent literal-seed positive stays covered by independent_seeded_twin_keeps_credit in the main table. I did not run native wrong-owner executions: these fixtures are static-analysis inputs. Spec RIPR-SPEC-0228 and the changelog now say guards are not history. Getter, chain and same-line changes are unchanged; 6 integration tests, 1885 classify lib tests and clippy pass locally.

The github-actions finding about the getter being passed for every statement: the getter only widens which read-only uses are excluded, and getter_reads_field already requires the getter to return the compared field, so a getter read and a direct read of that field are the same value. Traceability lists all 6 tests across both fragments.


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

Verification questions

  • Confirm the new aggregate test exercises static-analysis fixtures only; it does not compile or execute the undefined guard helpers, so it cannot provide runtime discrimination proof.
  • Confirm the new aggregate test exercises nine named analyzer scenarios but is represented as one Rust test, reducing failure localization and independent evidence granularity.

Refuted

  • The new guard fixtures fail to prove runtime discriminator behavior because they reference undefined helpers.; refuted because: They are intentionally static-analysis inputs: the analyzer parses the source, and these cases test the classification rule rather than compiling/running a Rust test.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • The PR's validation claims are not yet backed by a completed cargo-test receipt in this packet; the only Rust sensor receipt, ripr, failed with exit code 2.
  • The change remains sensitive to ad hoc text parsing around declarations, calls, and same-line statements; the available evidence does not include a completed cargo-test receipt, so broader syntax and regression coverage is not independently demonstrated here.

Copy link
Copy Markdown
Member Author

Successor source reconciliation at 772112c, reviewer /root/review_guard_history_disposition: acknowledged repair6416248309 is verified in source. Removing guard capture/history insertion restores refusal for guard-only differences; equivalent_spelled_guards_stay_refused and the updated differing-guards expectation agree. The prior code-level finding is repaired, not being asserted unchanged.

Remaining requested proof is narrow: ready=false companion plus identical isolated fixture bytes through base dc38b8c, old candidate8d1a2dc and repaired772112c5, with native original/wrong-owner outcomes and the discriminating positive. The owner explicitly reports native wrong-owner runs were not executed. Current advisory40324463502/job121577468093 records a focused HEAD pass but red-green deferred with zero receipts and explicitly not current-head qualification; do not relabel that as the missing comparison. Please finish this in the existing lane without another broad campaign, and reconcile the PR title/body still saying differing guards retain credit.

Shared prerequisite update: #10663/#10660 is now delivered on main at e4b0aaf, exact qualified tree and22038 tests verified. This removes that prerequisite only; ensure the actual next qualification subject contains it and preserve current findings, author custody and admission constraints. No source, native experiment, CI or lifecycle change was performed by this audit.

@EffortlessSteven EffortlessSteven changed the title fix(rust): close getter-spelled and chain-built twin false credit, compare guards and same-line rewrites (#7135, #10657) fix(rust): close getter-spelled and chain-built twin false credit, compare same-line rewrites (#7135, #10657) Oct 26, 2026

@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 the aggregate test covers nine analyzer scenarios, but one failed case reports only a scenario name rather than an independently named Rust regression test.

Refuted

  • The PR body and title overclaim that differing guards keep credit, but the implemented policy, specification, changelog, and test expectation all say differing guards stay refused.
  • The guard fixtures must compile and run to prove the classifier behavior.; refuted because: These are intentionally static-analysis source fixtures parsed by check_workspace; they do not require runtime helper definitions. This addresses classification behavior, not native runtime discrimination.
  • The aggregate test cannot demonstrate behavior changes against the old implementation.; refuted because: The scenario table exercises the changed classification routes and encodes both false and true outcomes, so it is a suitable red/green oracle if executed on base and HEAD; execution qualification still awaits a completed receipt.
  • The new guard cases demonstrate executable runtime discriminator behavior.; refuted because: False premise: these are static-analysis fixtures by design; undefined helpers are never compiled or executed, so the test proves classification behavior only.
  • The PR title/body claim that differing guards retain credit, but the changed implementation and spec now keep guard-only twins refused.

Parked follow-ups

  • The new behavior is covered by one aggregate Rust test with nine analyzer cases rather than independently named regression tests, limiting failure localization.

Evidence gaps

  • Focused Rust validation is scheduled late and the existing ripr sensor failed with exit code 2, so this packet does not yet contain a successful completed cargo-test receipt.
  • Model proof intent was rejected by deterministic validation.
  • A completed current-head cargo-test receipt is not present in the packet; the available ripr sensor failed with exit code 2.
  • Current-head cargo-test proof is not available in this packet.

Copy link
Copy Markdown
Member Author

Run 40332209195 on 6b73c12 failed at check-static-language: my own guard comment used the word "proven" (reveal.rs:798). Not the analyzer change. Reworded in 5f043a5; cargo xtask check-static-language and the full cargo xtask precommit pass locally on that head, and merge-ready is re-applied for a fresh run. Title and body now describe guards as refused (not credited).


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.

Confirmed findings

  • binding_built_through_owner searches every 'let ' occurrence and only filters the binding token, so a declaration in a nested or unrelated lexical context can be treated as the live binding and suppress credit.

Verification questions

  • Confirm the aggregate test provides weaker failure localization than separately named Rust tests because one failing scenario only identifies its label in the aggregated mismatch vector.
  • Confirm the aggregate regression test covers the requested getter, chain, same-line, guard, and later-shadowing cases but reports scenario names rather than independently named Rust tests.
  • Confirm the aggregate test covers nine named analyzer scenarios but registers only one Rust test, limiting independent failure localization.

Refuted

  • The new guard cases cannot serve as classifier tests because their helper identifiers are undefined.; refuted because: The fixtures are intentionally parsed as static-analysis source by check_workspace and are not compiled or executed; prior thread evidence explicitly confirms that design.
  • The changed guard fixtures must compile and run to validate classifier behavior.; refuted because: They are intentionally parsed as static-analysis fixtures by check_workspace; they are not executable Rust runtime discriminators, and the spec now states the textual guard limitation.
  • A chained owner-built side should retain argument-sensitive exposure credit.; refuted because: This is an intentional conservative boundary: chain histories are not recoverable, so all chain-built sides are refused; the prior thread explicitly records this decision and the specification states it.

Evidence gaps

  • The available packet lacks a completed cargo-test receipt, leaving executable qualification pending.
  • Current execution qualification is incomplete because cargo-test has no completed receipt and ripr failed with exit code 2.
  • The packet has no completed cargo-test receipt; ripr failed with exit code 2, so changed Rust behavior is not currently execution-qualified.
  • The test oracle is suitable for static-analysis red/green qualification, but current packet evidence does not show a completed HEAD execution or an old/base execution establishing behavior deltas.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Review of record, head 5f043a5 (contains main at e4b0aaf with #10663/#10660).

Angles: correctness (window end, live-declaration scan, getter exclusion), tests (6 integration cases incl. negatives; 1885 classify lib tests), spec (RIPR-SPEC-0228 limits stated), perf/security (no new IO or allocation hot path), static-language and traceability gates.

Findings and resolutions:

  • Devin: later shadowing erases credit → fixed (8d1a2dc), pinned by chained_let_after_the_read_is_not_evidence.
  • Reviewer lead: guard text attached to history opened a new promotion path → repaired (772112c): guards are out of the history, guard-only differences stay refused; equivalent_spelled_guards_stay_refused pins it.
  • Devin: chained arguments lose credit, equivalent guard spellings, static fixtures → answered on their threads; documented limits, fail-closed direction.
  • github-actions: nested-scope let can be taken as the live declaration → over-refusal only (missed credit, fail closed); not changed.
  • CI: run 40332209195 failed on my "proven" wording in a comment (check-static-language) → reworded in 5f043a5.

Evidence on this head: Ripr Rust Small Result success (run 40336714330), all 4 test shards and Rust gates green, no unresolved threads, mergeable clean. No native wrong-owner executions were run; fixtures are static-analysis inputs. Nothing blocking, so I'm squash-merging at this sha.


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