Repository navigation
fix(grip): bind snapshot discrimination to the owner result on return seams (#8121) - #8318
Conversation
… seams (#8121) A snapshot admitted by kind for a return_value seam now discriminates only when it names the owner call or a plain local last bound to it, so an unrelated committed snapshot no longer grades a changed return strongly. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XsvDqL1Ui8moGnvSX29qJj
|
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 58 minutes. View limit details
Comment |
…8121) Comparisons (==, !=, <=, >=, =>) and non-place left-hand sides such as 'if count == 0 {' no longer withdraw snapshot credit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XsvDqL1Ui8moGnvSX29qJj
EffortlessSteven
left a comment
There was a problem hiding this comment.
Exact-head source review of 6d28eddd2ca8f34aa9b556b69c8969b7432a1cfc: REPAIR_REQUIRED.
The final ownership search found this existing PR, so it retains the writer and candidate. No competing PR is being opened. The original counterexample remains under #3161 and the #8121 residual.
Three remaining source defects affect the stated preservation/refusal contract:
- At
snapshot_owner_binding.rs:24-29, any textual owner call or any free identifier anywhere in the macro is accepted. Neither path establishes that the eager value operand is the owner's result. An owner call behind control transfer or an opaque macro is sufficient; a block that merely reads a captured owner binding and yields an unrelated value is also sufficient. The initializer check at lines 119-122 has the same containing-a-call problem. Parse and validate the actual value expression, and retain macro/call provenance authority before awarding discrimination. - At lines 107-130, owner binding state changes only for a local binding or recognized assignment to that name. Passing or aliasing an interior-mutable result and later changing it through the alias leaves the original binding credited, even though a snapshot can then be independent of the changed return. Reuse the shared binding/use authority to withhold credit after unsupported escape, aliasing or opaque intervening use.
- At lines 85-87, the entire assertion line is discarded before binding analysis. A genuine completed
letimmediately before the snapshot on that same line loses its existing credit, with or without whitespace after the semicolon. Use statement/token offsets so a preceding completed binding is admitted and a later binding remains refused.
Please keep Draft through a joined repair and refresh the affected independent oracle/provenance/adjacency controls before qualification. This review is anchored to the published source above; it does not establish a build, CLI result or hosted qualification for this PR.
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- crates/ripr/tests/snapshot_return_admission.rs:131 — No negative test exercises a rebound through a wrapping macro/closure (e.g., a
vec![make_count(2)]index read or a closure-captured re-bind). Add one control assertingassert_weakfor a macro-internal owner call that escapes name binding, so a future refactor that broadenscall_text_contains_named_callto skip macros stays honest.
Verification questions
- Confirm boolean short-circuit RHS like
let count = make_count(2) \|\| other;makescountcarry an unrelated value but still passes the direct-owner test; name binding assumes let RHS == owner. - Confirm macro/closure rebinding routes are not covered:
let _f = \|\| { let count = make_count(2); }; let count = 7; insta::assert_snapshot!(count);resets scope, but a later closure-invocation re-bind inside a different block would survive the linear top-level scan.
Refuted
- Helper duplicates text-parsing vs. owner_result_binding and should be unified into a shared seam-binding helper.; refuted because: owner_result_binding targets a different shape (receiver-style field seams); the new helper is the first ReturnValue+Snapshot binding path and reuses both super-helpers (call_text_contains_named_call, strip_comments_and_strings). Unification is parked for a second consumer, not this PR.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
PR #8275 (RIPR-SPEC-0122) converted the bounded human render to plain language but missed these 8 fixtures. Each diff is wording-only: Summary/State/Static exposure/Hidden schema tokens become plain words with identical class counts; check.json and human-full.txt are byte-identical. Blessed via cargo xtask goldens bless with reason citing #8165/RIPR-SPEC-0122. Windows-only ts_repair_packet quoting drift intentionally not blessed.
|
Claiming this PR for review and merge convergence (newest-first backlog lane). Backlog-oldest-first thread: please skip #8318. Generated by Claude Code |
Block scope, pattern binders (if let/while let/for/match arm/closure) and a non-call initializer no longer carry owner-result credit to a snapshot. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XJQ3eTmHZCPmLwyb77Hexw
|
Independent Sonnet review of 6d28edd found three real false-positive gaps in
Added 3 negative integration tests (inner block, Generated by Claude Code |
…aw owner credit (#8121) Also aligns the cli_smoke preview triage State oracle with the compact bounded renderer from #8275 (red on main). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XJQ3eTmHZCPmLwyb77Hexw
|
Second independent re-review of f7a327d found no panics but three more false-positive paths: Local proof at 4ed885d: 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! |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- No test exercises a snapshot whose oracle text uses whitespace/newline between let binding and snapshot (e.g. let count\n =\n make_count(2);); initializer_is_owner_call tolerates whitespace via trim_start but a multi-line initializer may not be matched.
Verification questions
- Confirm unit tests in snapshot_owner_binding.rs cover assignment_target, initializer_is_owner_call, and pattern binder classification but do NOT exercise name_is_direct_owner_result scope/brace tracking end-to-end.
- Confirm macro/closure rebind paths (vec![make_count(2)], closure-captured re-bind) lack a negative integration test; the text-based binder detector relies on over-matching withdrawing credit but is not exercised on these shapes.
- Confirm boolean short-circuit RHS like
let count = make_count(2) \|\| other;is not covered by a negative test; initializer_is_owner_call will match the first owner_name occurrence but\|\|short-circuit means count carriesother's value at runtime. - Confirm integration tests do not exercise several remaining owner-Result paths the spec calls out: helper-derivation under-credits (acknowledged non-goal), macro-internal owner rebinds (
vec![make_count(2)]), short-circuit RHS likemake_count(2) \|\| other, and closure-captured re-bind in a later block.
Refuted
- A rebound by macro or closure that re-binds
countto a fresh owner call later in the test would over-credit an unrelated snapshot.; refuted because:name_is_direct_owner_resultwalks top-level statements up tooracle_line; a macro/closure owner call invoked later than the assertion does not change the binding at the assertion site, so the gate still rejects an unrelated snapshot. Even if a future refactor broadens call detection, the fail-closed direction means the worst case is under-credit, never over-credit.
Parked follow-ups
- Reused prior reviewer concern (graphite-app comment on snapshot_return_admission.rs:131): macro-internal owner call rebinds escape linear name binding and are not yet covered by a negative control test. Acceptable as a parked trace-bundle gap since direction is fail-closed.
- Trace-bundle rebind via macro/closure that re-binds
countto a fresh owner call across a function/macro boundary is not directly asserted; gate is fail-closed so impact is under-credit, not over-credit. Parked follow-up rather than a finding.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
Diagnostic Status Update: PR #8318
|
…' into claude/great-fermat-dayr32
|
Failing check: Not this PR's: I reproduced Action: I merged #8351's branch ( 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! |
|
Failing check: A fresh run for the same head (39012701950) started at 07:12:49, and its route job already passed. No code change or empty commit is needed; I will read the new run's result. The earlier Generated by Claude Code |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- Scope tracking in
name_is_direct_owner_resultwalkstest.body.lines()with brace counting but ignores Rust string/char literal scoping across lines; a multi-line string literal containing}will desync depth. No real-world test triggers this in the integration suite, but a maliciously crafted fixture could. assignment_targetdoes not exclude<<=/>>=properly. The current rule says<=/>=compare,<<=/>>=assign. But foratpointing at the second=,is_comparison_anglelooks atbytes[at-1]which is=, not</>, so the second=of<<=falls into thenot matches!(bytes[at+1], Some(b'=')\|Some(b'>'))branch andbytes.get(at-1) == Some(b'<')branch — let-checked. Actually fine. Real issue:assignment_targetaccepts any place whose=is preceded by+,-, etc. trimmed.let _ = count += 1;parses fine. But the assertionbytes[at] == b'='followed by checkingat-1for=/!excludes==/!=correctly. Leave alone. Use this slot for the wrapped-initializer gap instead. (crates/ripr/src/analysis/test_grip_evidence/snapshot_owner_binding.rs:230).
Verification questions
- Confirm snapshot_observes_owner_result fast-path accepts any in-string owner_call text and any free identifier, then defers binding decisions to name_is_direct_owner_result; sibling free_identifiers excludes field paths, qualifiers, callees, macros so
vec![make_count(2)].xandSelf::make_countdo not over-match. - Confirm multi-line initializer
let count =\n make_count(2);is rejected: split_once('=') splits on first '=' but the statement accumulator concatenates lines with spaces, so the trailing space preserves the call. However no integration test exercises this shape. - Confirm macro escape
let count = vec![make_count(2)][0];orlet count = (\|\| make_count(2))();is treated as owner result because the call text appears and the initializer starts with a bracketed expression whose top-level call follows; current initializer_is_owner_call will acceptvec![make_count(2)]only if first identifier is the owner, otherwise reject. Need explicit negative test. - Confirm free identifier extraction drops callee/macro forms but treats
assert!(count)inside the oracle text as a free identifiercount, which then triggers scope tracking. If the snapshot line is past the let, this works; but a snapshot that containsassert!(count)inline before the let binding still extractscountand may mis-bind when owner_name shadows.
Refuted
- snapshot_owner_binding is wired in for SeamKind::FieldConstruction or for non-Snapshot oracles, regressing unrelated admission.; refuted because: test_grip_evidence.rs:2120-2126 gates with seam.kind()==ReturnValue and OracleKind::Snapshot; field seam admission path passes through unchanged because it is a separate call site.
Evidence gaps
- Author and re-reviewer report three iterative false-positive repairs (block-scope depth, pattern binders, statement split) plus three more (else-if-let, later arm, same-line rebind) on this PR; integration coverage and precommit proof at 4ed885d / e9fb0af, but the lane cannot verify these locally (build/clippy/test heavy gates skipped, ripr sensor failed exit-2).
- 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! |
|
Failing check: Fix already exists and is included: Generated by Claude Code |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- Static string/comment stripping in strip_oracle_text and strip_comments_and_strings is line-based; a multi-line string literal containing a
}could desync brace counting in name_is_direct_owner_result. Over-match withdraws credit, so the worst case is under-credit, which matches the spec.
Parked follow-ups
- Prior reviewer concerns about
vec![make_count(2)]macro escape, closure-captured rebind, multi-line let initializer, and multi-line string desync were not directly covered by tests added in this head.
Summary
return_valueseam now discriminates only when it names the owner call or a plain, non-mutlocal last bound to a direct owner call before the assertion.other = 2) no longer grades a changedmake_count(2)returnstrongly_gripped / discriminate=yes / already_observed.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Spec:
docs/specs/RIPR-SPEC-0005-repo-seam-inventory.mdGoverning issue or accepted claim: #8121 (residual comment 6227801705; follows the field-seam admission in #8251)
Acceptance delta (one sentence): a snapshot of an unrelated value cannot close a changed return seam.
Candidate Relationships
Candidate branch:
claude/great-fermat-dayr32Stack parent or prerequisite PR (if any): none (#8251 already merged)
Scope
oracle_discriminates_seam_in_testplus a smallsnapshot_owner_bindingmodule (text/line-based, fail-closed). It is a static name-binding check and does not read snapshot bytes.Scope Classification
Production delta: return-value + Snapshot oracle requires owner-result binding.
Evidence/support delta:
crates/ripr/tests/snapshot_return_admission.rs(5 tests), spec paragraph, traceability, changelog fragment.Single acceptance criterion: unrelated snapshot stays
weakly_gripped; direct owner snapshot and independent exact assertions keep their grade.Non-goals: full snapshot identity/settings/projection binding (rest of #8121), field seams, non-snapshot oracles, honesty-corpus golden addition.
Support-tier Impact
Policy Impact
Proof
Result: RED without the fix (2 of 5 new tests fail: unrelated snapshot, rebound name; the 3 positives pass). With the fix: 5/5 pass, 6/6 field-admission tests unchanged, 427
test_grip_evidencelib tests pass,precommitexit 0. Not run locally: full workspace tests,fixtures/goldens check/dogfoodbeyond what precommit selects, hosted CI.Claim Boundary
May claim: an unrelated snapshot no longer over-credits a return seam in repo grading. Must not claim: snapshot bytes/settings/projection are verified; a snapshot of a value derived through a helper (not a direct owner call or binding) now under-credits by design.
Rollback
Revert this commit; no schema, workflow or dependency changes.
Spec-Test-Code Traceability
crates/ripr/tests/snapshot_return_admission.rscrates/ripr/src/analysis/test_grip_evidence/snapshot_owner_binding.rs,test_grip_evidence.rsStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Refs #8121 (issue stays open for its remaining acceptance).
Generated by Claude Code