Repository navigation
fix(python): require receiver identity for attribute-sink credit and qualify nested owners - #11182
Conversation
…qualify nested owners Same-value/different-receiver attribute assertions (conn.status=='active' vs Session self.status='active') no longer credit exposed; they stay weakly_exposed/orthogonal, pinned by a new adversarial fixture and an evidence-promotion-honesty must_not_promote case. Nested Python functions get qualified parent.inner owners. Refs #1267, RIPR-SPEC-0028.
|
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 53 minutes. View limit details
|
EffortlessSteven
left a comment
There was a problem hiding this comment.
Candidate review (pre-publication pass, author self-review): reviewed_head_sha: a5a2807; integration_basis: origin/main 8092849; claim_boundary: Python attribute-sink receiver identity + nested-function owners only. Inspected: sink_alignment.rs attribute_receiver_bound, owners_tests.rs recursion, new adversarial fixture golden (weakly_exposed/orthogonal), honesty-corpus must_not_promote case, repair-card inventory pin. Proof observed: 14 focused tests pass at root; fixtures/honesty/judged-panel/goldens/changelog all exit 0; independent workflow verification reproduced red (pre-fix exposed) -> green and 9 fail-closed falsification probes. Blocking findings: none for this claim. Non-blocking/residual: nested defs inside if/try in a function body still uncollected; tests/-dir vanishing, SARIF preview, .pyi/.pyw routing explicitly out of scope. Disposition: REVIEW_INCOMPLETE until hosted exact-head CI is inspected; not merge-ready yet.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
check-no-panic-family rejected the two expect calls in nested_function_owners_get_qualified_names (PR #11182 Rust gates). Classification: candidate-introduced; local check-no-panic-family now passes.
Verdict-corpus regression from nested owners: py-hostile-nested-function moved credited->limited because tests call the enclosing function, never the nested name. body_calls_owner and the name-anchor gate now relate a nested Function owner through its enclosing call, and import_binds_owner_name accepts the enclosing import from the owner's module. Decorator rows py-shapes-decorator-{log-name,loop-bound,loop-bound-slack} re-blessed: verdict unchanged (limited/abstained), classification no_static_path->static_unknown since the changed line is now owned by the decorator wrapper inner. Local: verdict-corpus python 0/348 false, 16 focused tests, fixtures/goldens/honesty/judged-panel/no-panic all pass.
|
Repair wave on head e2bf86d: (1) check-no-panic-family failure was candidate-introduced expect in the new test - fixed, local gate passes. (2) Verdict-corpus regression: nested owners broke py-hostile-nested-function (credited->limited) because tests call the enclosing function; body_calls_owner/name-anchor/import binding now reach a nested Function owner through its enclosing call from the owner's module. Decorator rows py-shapes-decorator-{log-name,loop-bound,loop-bound-slack} re-blessed with reason in commit: verdict unchanged (limited/abstained), classification no_static_path->static_unknown because the changed line is now owned by the decorator wrapper inner. Local proof: verdict-corpus python 0/348 false verdicts, 16 focused tests pass, fixtures/goldens/honesty/judged-panel/no-panic/fmt all exit 0. Disposition remains REVIEW_INCOMPLETE pending new exact-head CI. |
|
|
…sink-nested-owners # Conflicts: # crates/ripr/src/analysis/language/python/related_tests.rs # crates/ripr/src/output/gap_decision_ledger.rs
|
|
|
CI classification: shard 4 failure is analysis::diff::model::tests::added_run_start_on_a_long_run_is_bounded, a growth-ratio timing test in code this PR does not touch; it passes locally on this exact head (1 passed, 1.87s). Classified inherited/load flake, not candidate. Requesting a fresh qualification run. |
…nment Graphite review on PR #11182: rfind byte index + 1 could land inside a multibyte char before an asserted receiver and panic on slicing. Both branches now use char_indices with len_utf8; regression test covers multibyte-adjacent plain and inline-construction receivers.
|
Review refresh, head Generated by Claude Code |
There was a problem hiding this comment.
Independent review (fresh-context reviewer, head 3ea9d29): REPAIR_REQUIRED
Inspected:
- The candidate's full contribution against its merge base
228777817b: 22 files, +1292/-14 -crates/ripr/src/analysis/language/python/sink_alignment.rs(+100/-2),owners_tests.rs(+54/-5),owners_tests/tests.rs(+33),source_facts.rs(+1),crates/ripr/src/output/gap_decision_ledger.rs(+4/-1), the new fixturepython_adversarial_attribute_sink_same_value_other_receiver, the honesty-corpusmust_not_promotecase and the repair-card inventory pin. crates/ripr/src/analysis/language/python/sink_alignment.rs:1097-1117- the newattribute_receiver_boundclosure;:1118-1131-change_only_credit_okand its call at:1287;:1334-1386-asserted_attribute_receivers;:1388-1400- theper_related_testmemo helper.crates/ripr/src/analysis/language/python/related_tests.rs:3015owner_method_bound_locals,:3055setup_bound_receivers,:3078-3084instance_bound_receivers.- Hosted evidence at this exact head:
Ripr Rust Small on GitHub Hosted / Rust gatesjob 124635761162 (run 41234375661) and job 124661244573 (run 41242661579), bothfailure, both athead_sha 3ea9d29c6; and the aggregateRipr Rust Small Resultjobs, bothfailure. policy/user-text-baseline.tomlanddocs/USER_TEXT_GLOSSARY.mdat main tipa69bf0214;crates/ripr/src/app/navigation.rs:198-201;crates/ripr/src/app/task_first.rs::no_seam_inventory_reason;crates/ripr/src/analysis/language/python.rs:804.- The branch's own history, which matters for the remedy below:
8fee7632b chore(policy): raise user-text ceilings for cumulative golden countsandc45aa186f chore(policy): set user-text ceilings to latest observed counts 3283/597.
Blocking:
- The required check
Ripr Rust Small Resultis red at this head, and the cause is this candidate's own new golden. In both hosted runs at3ea9d29c6the failing step ischeck-user-text, reporting "2 plain-language term count(s) rose (delta or ceiling)". The gate's report names one file: the NEW pathfixtures/python_adversarial_attribute_sink_same_value_other_receiver/expected/human.txt, withdiscriminator+2 (lines 31 and 50) andseam+1 (line 50), both reported as "new path, 0 at the merge-base". The fixture is ADDED by this PR, so the attribution is candidate-side, not inherited. Mechanism:policy/user-text-baseline.tomlsets thegolden-humanceilingsdiscriminatormax_lines = 5 andseammax_lines = 3, with the file's own instruction "never raise one", and the gate scores each golden file's per-file delta against the merge base, so a new golden counts every banned line as an increase. The banned lines are product output:crates/ripr/src/app/task_first.rs::no_seam_inventory_reason, reached fromcrates/ripr/src/app/navigation.rs:198-201, emits "no repair start offered: the seam inventory behindripr repairandripr agent repair --phase beforecovers Rust files only, so ... has no seam to start a repair from ... add the missing discriminator to that test by hand", andcrates/ripr/src/analysis/language/python.rs:804emits the Python preview Next step "strengthen the existing related test with a field/object assertion for missing discriminator". - The remedy is plain wording, not a ceiling change - and this branch has already tried the forbidden remedy.
8fee7632bandc45aa186fraise the golden-human ceilings (to 3283 and 597 on that older cumulative baseline); those raises are not in the current head, which carries main's per-file ceilings of 5 and 3, and the gate still fails with them in place. Do not re-raise the ceilings. The wording work needs an owner: #11856 ("fix(human): plain words for the check screen's repair-start refusals") ownscrates/ripr/src/app/navigation.rsand lowers the ceilings rather than raising them, but I checked its diff and it does NOT touchcrates/ripr/src/app/task_first.rs, so it does not cover theseam inventorysentence this golden captures, and I found no open PR that rewritesanalysis/language/python.rs:804. #11357 is the broad plain-wording PR and may own the latter; I did not confirm that and I am flagging it as unestablished rather than asserting it. Until the wording lands, this candidate cannot pass the gate it fails. - Fail-fast leaves the candidate's own claim unexecuted. Because
check-user-textfails first, every later Rust context at this head isskipped:RUST_TESTS_RESULT,GOLDENS_RESULT,FIXTURES_RESULT,VERDICT_CORPUS_RESULT,CLIPPY_RESULT, and theRipr Rust Small tests on GitHub Hostedshards. The PR's single acceptance criterion - "Foreign-receiver same-value fixture isweakly_exposed/orthogonalwhile the bound-receiver inverse staysexposed, with focused tests and gates green" - therefore has no hosted execution evidence at3ea9d29c6: the new fixture's golden, the honesty-corpusmust_not_promotecase and the nested-owner unit test were never run against this tree by the hosted lane. - The PR's own acceptance record does not describe the head. The body states "Candidate head:
a5a28074f8dcfd0f7657c0b380aa58ccadff9e93"; the head is3ea9d29c6. The Proof block also listscargo xtask check-fast # ran 6 gates, pass (committed-diff selector: 0 files pre-commit)- a committed-diff selector that matched zero files did not exercise the commit under review - and it does not listcargo xtask check-user-text, the one gate that actually fails at this head.
Non-blocking:
- The analyzer change is fail-closed in the right direction.
attribute_receiver_bound(sink_alignment.rs:1097-1117) returnstruefor non-method owners, preserving prior behaviour where receiver binding is not modelled, and otherwise refuses the value-plus-attribute co-observation credit unless the asserted receiver is the owner's: it requiresunit.test,owner_class_tokenandmethod_name_tokento be present (:1101-1107), requiresasserted_attribute_receiversto find at least one dotted receiver (:1108-1111), and then accepts only when that receiver is in the owner's method-bound locals or its setup-bound receivers (:1112-1116).asserted_attribute_receivers(:1334-1386) deliberately yields acallee()marker for an inline construction, so a fresh instance cannot match a bound local. The direction is right: a same-value assertion on a foreign receiver (conn.status == 'active'against a changedself.status = 'active') no longer creditsexposed. - The new binding facts are derived from the related test's own source rather than from the finding, which is the correct input for "is this receiver bound to the owner".
- Efficiency: the new closure recomputes per-test facts per assertion.
change_only_credit_okis invoked once per alignment unit (sink_alignment.rs:1287), andattribute_receiver_boundcallsowner_method_bound_locals(test, owner, class, method)andsetup_bound_receivers(test, owner, class, method)on every invocation (:1112-1113). Each of those makes several passes over the related test's body text -match_indicesover the constructor call,assignment_countper class local,contains_attribute_callper setup receiver and per fixture - so the shape is O(findings x assertions) repeated body scans where O(findings x tests) would do. The same file already carries the remedy:per_related_testatsink_alignment.rs:1391exists precisely to "memoize a fact that depends only on the related test holding an assertion, so a test with many assertions computes it once per finding rather than once per assertion and branch", and the new code does not use it. There is a smaller redundancy too:owner_method_bound_localsreachessetup_bound_receiversthroughinstance_bound_receivers(related_tests.rs:3084), so the setup scan runs twice per invocation. The magnitude is unmeasured - no toolchain and no profile on this host - but the cost grows with the number of assertions in the related test, which is the case the memo helper was written for. - The body lists
owners_tests.rsunder "Production delta";crates/ripr/src/analysis/language/python/owners_tests.rsandowners_tests/tests.rsare test modules. A classification slip in the acceptance record, not a code defect. - Duplicate landscape: I found no other open PR claiming the Python attribute-sink receiver-identity plus nested-owner credit. #11809 ("fix(python): fixture/setup/hook that replaces the owner keeps mocked_module") and #11771 are adjacent but distinct claims.
Not run:
- The Rust toolchain on this host is not on
PATH, so nothing was compiled or executed: notcargo fmt --check, notcargo xtask precommit, notcargo xtask goldens check, notcargo xtask fixtures, notcargo xtask check-user-text, and not the new nested-owner unit test. Thecheck-user-textfailure is established from the hosted gate log, not reproduced locally. - I did not audit the whole new fixture and honesty-corpus case line by line; I read the analyzer change, the two binding helpers, the memo helper and the hosted gate output.
- The claim that the plain-wording owner for
crates/ripr/src/app/task_first.rs::no_seam_inventory_reasonandcrates/ripr/src/analysis/language/python.rs:804is #11357 is not established; I checked #11856's diff and it does not cover those two paths, and I did not diff #11357's contribution.
Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head 3ea9d29c695f511bed3a450a9cb6032842feb06c. Not an approval.
There was a problem hiding this comment.
Confirmed findings
- Nested function and async function collection are duplicated, including an out.last() dependency after push_function_owner; the helper shape permits qualification to depend on output ordering.
- The implementation has separate FunctionDef and AsyncFunctionDef recursion paths, increasing drift risk, but no behavioral defect is demonstrated.
Verification questions
- Confirm the new fixture verifies the foreign-receiver same-value case, but the reciprocal bound-receiver exposed case is not a focused regression in this diff.
- Confirm nested function owners are recursively qualified, including functions nested in methods, with a focused regression test.
- Confirm the receiver identity guard is wired into the value-plus-attribute fallback, while direct qualified observation remains a separate branch.
- Confirm nested function owners are recursively collected, but qualification currently depends on mutating out.last() after push_function_owner.
- Confirm the receiver-identity check applies only to the value-plus-attribute fallback; direct observation of the qualified sink still bypasses it.
- Confirm the positive receiver-identity branch lacks a focused local-instance inverse test in the changed test set.
Evidence gaps
- Current-head executable proof is not established: cargo-test receipt is absent, ripr failed with exit code 2, and the seeded thread records exact-head hosted failures.
- The latest seeded independent review reports exact-head hosted Rust gate failures, despite prior green-run claims.
- Model proof intent was rejected by deterministic validation.
Parked follow-ups
- The receiver-identity gate is placed on the value-plus-attribute fallback rather than the direct observation branch; this preserves prior direct-sink semantics but leaves foreign-receiver behavior outside that narrower claim.
|
Red on head a76dff8: Generated by Claude Code |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY — head ab5cdd1
Scope: the full PR diff against its merge base with main (7f2aada, so the main merge is not in the diff). I built ripr at this head and ran it on the new fixture; I did not run the lib tests (OOM on this host).
The hand-copied golden matches what the head produces. I ran ripr check --diff diff.patch --mode fast for --format human, human-full and json on python_adversarial_attribute_sink_same_value_other_receiver. The human and human-full outputs differ from expected/ only in the root path spelling that my invocation changes (root: ., /input/.); the JSON differs only in root/config_path, plus language_completeness and canonical_next_action, which xtask/src/reports/fixtures.rs strips before comparing and which the sibling golden also lacks. The only lines that differ from the sibling _other_receiver goldens are the two that quote the asserted value ("active" vs "closed"), as they should. The bless step is still CI's job, but the content is right.
CHANGELOG. The repo CHANGELOG.md is untouched; the entry is changelog.d/1267-python-attribute-sink-same-value.md. The "pending entry (34)" is the fixture's own expected/CHANGELOG.md, which bless writes.
"Discriminator (observed, advisory)". The heading lives in output/human.rs and output/human/sections.rs on main and in currentness_matrix_python_deleted_statement; this PR touches none of those and the new goldens do not contain it. It is a wording-thread item, not a blocker here.
Production change. The receiver-identity gate (attribute_receiver_bound) only narrows credit: value+attribute co-observation now needs the asserted receiver bound to the owner instance, and inline Session().status can't match. Non-method owners keep prior behavior. The multibyte test covers the char-boundary panic. Nested-function owners get qualified names and spans, with a test.
Non-blocking
body_calls_owner/import_binds_owner_name/related_test_relationnow treat a call or mention of the enclosing function as reaching its nested function. The positive test calls the nested def from its parent; there is no negative case where the parent never calls it (defined but unused, or only returned). That can credit reach it hasn't earned. Worth one more test or a follow-up issue.- The Function/AsyncFunction arms in
collect_owners_from_statementsare duplicated line for line. - Three
python-verdict-corpusrows (py-shapes-decorator-*) flipno_static_pathtostatic_unknownwithchanged_since_labeling: true. That moves toward abstention, so I consider it the honest direction, but I did not re-bless them; CI's verdict-corpus check is the first real check.
Not established: Ripr Rust Small Result at this head.
Generated by Claude Code
|
Review of record — head Angles: (1) independent exact-head review by the coordinator's reviewer, disposition REVIEW_READY at ab5cdd1, who built the head and matched the golden; (2) hosted evidence on this exact head; (3) review-thread triage.
No blocking findings. Merging with Generated by Claude Code |
Summary
conn.status == 'active'vs changedself.status = 'active') staysweakly_exposed/orthogonal, notexposed.parent.innerowners instead of attributing nested changes to the outer function.a5a28074f8dcfd0f7657c0b380aa58ccadff9e93.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Proposal: none
Spec: docs/specs/RIPR-SPEC-0028-python-adapter.md
ADR: none
Plan item: Python-excellence goal — entity-identity alignment (no wrong-receiver credit) and nested-owner attribution
Governing issue or accepted claim: #1267 (attribute-receiver identity for changed-sink exposure credit; same-value residual)
Acceptance delta (one sentence): A same-value assertion on a foreign receiver no longer credits
exposedfor a changed Python attribute sink, and nested defs are owned asparent.inner.Candidate Relationships
Candidate branch (GitHub PR head is authoritative after publication): fix/python-attribute-sink-nested-owners
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): none
Accepted winner and losing candidate disposition (when decided): none
Scope
Scope Classification
Production delta:
sink_alignment.rs: value+attribute co-observation for method owners requires the asserted receiver to be bound to the owner (attribute_receiver_bound).owners_tests.rs/source_facts.rs: recurse into function bodies, qualify nested owners.Evidence/support delta:
python_adversarial_attribute_sink_same_value_other_receiver(golden:weakly_exposed), honesty-corpusmust_not_promotecase, nested-owner unit test, repair-card inventory pin update, changelog fragment.Single acceptance criterion:
weakly_exposed/orthogonalwhile the bound-receiver inverse staysexposed, with focused tests and gates green.Non-goals:
tests/-dir subject vanishing (needs scope ruling), nested defs insideif/trywithin a function body, nested-class SymbolId,.pyi/.pywrouting, SARIF preview disclosure, wrong-receiverWeaklyExposedvsNoStaticPathreclassification.Support-tier Impact
Claim/proof notes:
killed/survivedpromotion.Policy Impact
Proof
Result, failures, or skipped proof:
exposed/changed_sink_token; post-fixweakly_exposed/orthogonal; 9 falsification probes fail closed correctly. Full single-runcargo test -p ripr --lib -- pythonnot established clean on this host (git-timeout flakes pass isolated); hosted CI owns that matrix. Candidate review before publication:REVIEW_INCOMPLETE(hosted evidence pending).Claim Boundary
May claim: the two fixes above with their fixtures/tests. Must not claim: Python excellent overall,
tests/handling, nested defs inif/try, or a clean full Python suite on this host.Rollback
Revert the squash commit; fixture, corpus case, inventory pin, and changelog fragment revert with it. No schema or public-contract change.
Spec-Test-Code Traceability
nested_function_owners_get_qualified_names, sink-alignment tests, new fixture goldencrates/ripr/src/analysis/language/python/{sink_alignment,owners_tests,source_facts}.rsfixtures/python_adversarial_attribute_sink_same_value_other_receiver/expected/Static Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a — no workflow, lane, or protection change.
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.Gates
cargo fmt --check(via workflow proof)cargo xtask check-evidence-promotion-honestycargo xtask check-python-judged-panel