Skip to content

fix(python): order effect observations after completed owner calls - #10557

Merged
EffortlessSteven merged 10 commits into
mainfrom
codex/python-effect-observation-order
Oct 26, 2026
Merged

EffortlessSteven merged 10 commits into
mainfrom
codex/python-effect-observation-order

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

An assertion before an owner call on the same Python source line could incorrectly credit the call's changed effect. Native Python passes both old and new versions of the before-call tests; the analyzer previously called them exposed.

The shared effect reader now uses native assertion/compared-operand spans and completed-call offsets. Guarded field retention belongs to the assertion that actually earns credit. Assertion messages and helper argument capture cannot supply a later matching effect-channel read. Mock inspections retain their actual after-argument evaluation phase.

Candidate: 543ebb9183e2f2e1408321d9ea0c4e663f2925c4; exact integration basis: 494a2967b4be7f80ca86206217c79182c95e7798.

Source-of-truth Links

Proposal: none; bounded correctness repair of an independently reproduced shared observer defect.
Spec: RIPR-SPEC-0028, RIPR-SPEC-0260 and RIPR-SPEC-0108.
ADR: none; existing native Python fact and effect-alignment owners remain authoritative.
Plan item: statement-order continuation of the bounded composition review on #10178.
Governing issue or accepted claim: #10178, specifically the independently reproduced ordering defect in #10178 (comment).
Acceptance delta (one sentence): A credited effect-channel observation follows the completed owner call and reads its channel in the actual compared operand, while legitimate post-call direct, guarded, helper and mock observations retain credit.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): codex/python-effect-observation-order at 543ebb9.
Stack parent or prerequisite PR (if any): no stack parent; landed #10506 / 9bdfcc4 is an ancestor of the integration basis.
Proposed replacement of PR (if any; not yet accepted): none; #9868, #10181 and #10206 are already landed.
Acceptance retained from a replaced candidate (if any): none; no author's branch is replaced.
Accepted winner and losing candidate disposition (when decided): this is the selected bounded ordering repair; no rival candidate was found in the current all-state claim search.

Scope and acceptance

  • Production: native compared-operand/assertion ranges, shared effect observation ordering, exact helper call identity and per-assertion guarded retention.
  • Evidence: focused semicolon, multiline, UTF-8, duplicate-assertion, message, conjunction, helper capture and mock evaluation controls; two end-to-end fixtures; two appended honesty cases; measured weak-card inventory; specs, traceability and changelog.
  • Accept before-call guarded self-field and direct module-object observations as weakly_exposed; preserve call-then-assert discriminating positives and healthy direct-write retention.
  • No support-tier, schema, dependency, process, network, workflow or packaging change. No release, deployment or access operation.

Proof

Native Python 3.12.14 passes old/new versions of both before-call fixtures (exit 0/0), while paired call-then-assert positives distinguish old/new (exit 0/1). Actual prior analyzer 699c248cb3f3a6bc7da7905eb2a38032df33d074 falsely promotes the negatives. A retained pre-module-route executable independently reproduces the guarded false promotion, so it is not attributed to the later module-object repair.

On exact published head 543ebb9183e2f2e1408321d9ea0c4e663f2925c4, the default Rust/Python/TypeScript library test build passes. Its actual Cargo-selected executable has SHA256 cba98e57b990878991cf8b97c0e8fc54a967463af7ba4e07c2aa498297baf07f and a retained, full-restore-verified witness. Native executions pass all 1,288 Python tests, including all 12 new ordering tests, plus all three Python repair-card corpus inventory/cardinality tests. No tests were ignored. The selected tests-only predecessor exposed three intended ordering/retention/helper failures; an unsupported single-line receiver-binding assumption was separately corrected to an explicit preserved-weak control.

cargo test --locked -p ripr --lib --message-format=json --no-run
<Cargo-selected libtest> analysis::language::python::effect_order_tests:: --nocapture
<Cargo-selected libtest> analysis::language::python:: --nocapture
<Cargo-selected libtest> output::gap_decision_ledger::tests::python_repair_card_corpus --nocapture

Actual default-feature CLI producer 088ca415f7545438f45eab1df26d705fb60ecf2f (production Python implementation byte-identical to this joined head), SHA256 2bd8888f02b561eda65d372634251fd73495b72b6b7f8904bec17e98632b0209, matches all 37 retained controls and ten additional message/post-message/mock cases. The independent reviewer also executes ten distinct stdout/stderr/file/context-manager/imported-helper controls with native Python contrasts; all match. Both new JSON, compact-human and full-human fixture outputs are native-generated. Native inventory measurement found (10,27,30,1), exactly two additional orthogonal weak cards, before changing the pinned literal.

Fixture contracts and evidence-promotion honesty pass (519 pure cases; one pinned external case explicitly not run). A deliberately exposed mutant of the new guarded golden fails both non-promotion and expected-class assertions, and its isolated checkout is restored clean. Spec, traceability, changelog, support-tier and architecture gates pass. Check-fast passes all 15 selected gates, including strict workspace/all-target Clippy; its independently checked selector contains 31 changed paths (CLI help parity is inapplicable). Precommit passes, including full golden comparison: 663 fixture subjects and 1,708 surface comparisons, zero drift. Its native CLI producer reports exact543 and has SHA256 26d5b28162fa69ad7226b2b023c2a9a8c15b97ca713dd5ee1bee925817534297. Exact-head bounded source/oracle review has no new material source finding. Required hosted qualification passed on the unchanged head; the final inspection below binds the original native reports.

Limitations and rollback

This preserves existing bounded owner/call admission and the documented namespace conservatism. A helper comparing a pre-call captured field with an implicit-None owner result still falsely promotes through the separate legacy method-name/result branch; fixing that requires result-propagation semantics and is outside this effect-reader repair. Native before/after controls and a real returned-field positive distinguish that residual from this fix. General helper effects/object flow, dynamic __dict__/vars masks and unresolved single-line receiver binding are not newly supported. The #10009 privacy hold is untouched. This does not close the broader #10178 issue by implication.

Revert this PR's code, its two fixtures/corpus rows and its inventory increment together. No migration or external side effect requires rollback.

Traceability and CI economics

RIPR-SPEC-0028/0260 → effect_order_tests and both before-call fixtures → native Python facts/shared effect reader → JSON/human weak findings → RIPR-SPEC-0108 non-promotion and repair-card inventory. Existing output/schema and static vocabulary remain unchanged. CI economics: n/a; no workflow, gate, required-lane or artifact producer configuration changes.

Integration currentness

Later main de58cae6d3fef20fb2e05729d2e8d9153d590f67 was inspected: Python changes add a separate removed-__eq__-guard path and narrow star-import binding, with no new assertion constructors or effect-reader changes. Its conflict-free combined tree is a520ea6baab145e53dc625ddfa18d7bc2734c2c0. The native PR merge preview remains eb18f5630b7e431299e2ed6a19ba490e183f1205, tree e6db411e255ca20669741b5185b964339c90e7d3, parents 87e1d20294341a4aea25d72cc72e3206ab994fbe and the reviewed head; #10506 is present and both traceability additions are preserved.

Landed #10513 changes hosted receipt shape, not the product prerequisite. The old preview contains a coherent caller/gates pair executing the full unpartitioned suite; the newer caller selects four partitions and requires its verifier. Single-command testing remains explicitly supported. No route label or behind-only restack is introduced. The one normal qualification request will be bound to its actual checkout, controller and complete route-specific receipts; a mismatch or missing shard/verifier on a selected four-way route blocks merge.

Final qualification

Required qualification 40266634215, attempt 1 completed successfully on actual checkout eb18f5630b7e431299e2ed6a19ba490e183f1205. The reusable controller is rust-gates.yml at that same object. The original unpartitioned native nextest terminal report records 21,815 passed, 5 skipped, including explicit PASS rows for all 12 ordering tests and all three Python repair-card inventory/cardinality tests. Rust doctests record two passed and one ignored; the repo-policy doctest target has zero subjects. Policy, honesty, all-features checking, strict Clippy, golden outputs, fixture contracts, capabilities, verdict corpora, PR evidence and schema sweep passed. The Rust-only feature lane and optional Windows subset also passed.

The original native gate and Result logs were directly inspected. The JUnit artifact metadata identifies ripr-rust-small-github-nextest-1, artifact 12628770824, SHA256 e72de1f045bc5f49ef2c599084f7ac3f0400e6fd43f2a25c964fc7803b7489a6, created by this head/run/attempt; separate XML-content parsing is not claimed. Execution counts and named test outcomes above come from the native terminal report.

Current main 071a0e997a868bcaa2e21aca211d0f3e91294d57 combines cleanly with the reviewed head, tree d26560bf6861165394758180baae0c53c71832e7. Later changes preserve the reviewed Python assertion/effect surfaces and both traceability additions. The final snapshot has no unresolved inline threads or new material conversation finding, and all 58 check runs are terminal success/skipped with successful status contexts. The documented general-propagation and dynamic-mask residuals remain outside this bounded acceptance.

@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 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 187 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: ff82d4be-8899-42f1-8988-502f0639a013
Commits

Reviewing files that changed from the base of the PR and between adad2be and 543ebb9.

Files selected for processing: 31
  • .ripr/traceability.toml
  • changelog.d/10178-python-effect-observation-order.md
  • crates/ripr/src/analysis/language/python.rs
  • crates/ripr/src/analysis/language/python/effect_alignment.rs
  • crates/ripr/src/analysis/language/python/effect_order_tests.rs
  • crates/ripr/src/analysis/language/python/helper_assertions.rs
  • crates/ripr/src/analysis/language/python/oracles.rs
  • crates/ripr/src/analysis/language/python/owners_tests.rs
  • crates/ripr/src/analysis/language/python/sink_alignment.rs
  • crates/ripr/src/output/gap_decision_ledger.rs
  • docs/specs/RIPR-SPEC-0028-python-preview-static-facts.md
  • docs/specs/RIPR-SPEC-0260-python-guarded-arm-activation.md
  • fixtures/evidence-promotion-honesty-corpus/corpus.json
  • fixtures/python_effect_order_guarded_before_call/SPEC.md
  • fixtures/python_effect_order_guarded_before_call/diff.patch
  • fixtures/python_effect_order_guarded_before_call/expected/CHANGELOG.md
  • fixtures/python_effect_order_guarded_before_call/expected/check.json
  • fixtures/python_effect_order_guarded_before_call/expected/human-full.txt
  • fixtures/python_effect_order_guarded_before_call/expected/human.txt
  • fixtures/python_effect_order_guarded_before_call/input/ripr.toml
  • fixtures/python_effect_order_guarded_before_call/input/shapes/noter.py
  • fixtures/python_effect_order_guarded_before_call/input/tests/test_noter.py
  • fixtures/python_effect_order_module_before_call/SPEC.md
  • fixtures/python_effect_order_module_before_call/diff.patch
  • fixtures/python_effect_order_module_before_call/expected/CHANGELOG.md
  • fixtures/python_effect_order_module_before_call/expected/check.json
  • fixtures/python_effect_order_module_before_call/expected/human-full.txt
  • fixtures/python_effect_order_module_before_call/expected/human.txt
  • fixtures/python_effect_order_module_before_call/input/ripr.toml
  • fixtures/python_effect_order_module_before_call/input/shop/route.py
  • fixtures/python_effect_order_module_before_call/input/tests/test_route.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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.

Exact-head bounded source/oracle review: 543ebb9183e2f2e1408321d9ea0c4e663f2925c4, tree 7759fee542d5677e70e85e7f018c8e924e805a60, review basis 494a2967b4be7f80ca86206217c79182c95e7798.

I inspected the complete 31-path change, native assertion facts and their test-relative normalization, helper replacement identity, every effect-alignment consumer, guarded retention, mock evaluation phase, both fixture surfaces, literal honesty assertions, inventory and public specification. Separate read-only review binds this same head in artifact SHA256 a82b13c341695a480cb2e0189dfe6ee1ad3baae9b851dd3e1400680b7eb0637d. No new material source finding remains.

The actual native default-feature test producer on this head passes all 1,288 Python tests (including the 12 ordering tests) and three ledger inventory/cardinality tests, with zero ignored tests. Its executable SHA256 is cba98e57b990878991cf8b97c0e8fc54a967463af7ba4e07c2aa498297baf07f; the original and full-restore-verified witness are retained. Prior executable controls reproduce the wrong promotion, and native Python distinguishes before-call 0/0 negatives from after-call 0/1 positives. Current production CLI controls cover 37 retained cases, ten message/mock cases and ten independently exercised stdout/stderr/file/context/helper cases. The final direct helper-consumer false/true pair closes the earlier masked test-oracle gap.

The inherited helper owner-result false promotion remains explicitly bounded: actual699 and current088 binaries reproduce it through the method-name branch; genuine returned-field discriminators remain exposed. General propagation/dynamic-mask precision and #10009 private held work are outside this repair. No platform, package, access, process, network or release surface changes.

The observed GitHub merge subject eb18f5630b7e431299e2ed6a19ba490e183f1205 has parents 87e1d20294341a4aea25d72cc72e3206ab994fbe and the reviewed head, tree e6db411e255ca20669741b5185b964339c90e7d3, matching the local merge preview. It includes #10506 and preserves both upstream and candidate traceability lists for SPEC0028/0108/0260. This is source compatibility evidence; required hosted execution still has its own subject and receipts.

Disposition: source/oracle review passed within the stated boundary. Final REVIEW_READY awaits completed local gates, current required hosted qualification, and a refreshed conversation/check/merge-subject inventory. This author COMMENT is not a GitHub approval or merge clearance.

@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.

Verification questions

  • Confirm the ordering controls cover native assertions, helper calls, mock argument evaluation, messages, discarded conjuncts, UTF-8 offsets, and same-line/multiline statement order across instance and module effects.
  • Confirm the repair does not broaden unresolved receiver binding, dynamic dict/vars masking, or general Python object-flow semantics; those cases remain conservative or unsupported.

Refuted

  • The change could exploit unsafe/native behavior or disclose secrets through malformed Python input.; refuted because: No unsafe or native execution path was added; the unsafe-review sensor found no new gaps, and parser ranges are consumed as bounded static-analysis metadata.
  • The changed observer logic can retain a stale active-view or backing-store length across source mutation.; refuted because: The diff only reads immutable Rust source strings and parser TextRanges to order Python statements; it contains no buffer resize, detach, transfer, view mutation, or cached-length reuse across mutation.
  • A JS-backed value could cross a worker, async, GC, detach, or transfer boundary because the diff touches unsafe/native-risk classification.; refuted because: The touched paths are static Python parsing/alignment logic and contain no JS-backed value or asynchronous ownership operation. Unsafe-review also reported no new gaps.
  • The shared effect reader must duplicate ordering logic across native assertions, helper assertions, and sink alignment.; refuted because: Rejected: source and operand spans are collected upstream and the shared EffectReads observer owns the admission rule, avoiding divergent copies.

Evidence gaps

  • The bounded fix leaves general helper/object-flow semantics unresolved, so proof should verify both the new ordering controls and the documented residual behavior.
  • Available evidence does not include the scheduled cargo-test result, and the ripr sensor failed with exit code 2, so repository-level execution remains a verification gap rather than a worker-boundary defect.
  • Model proof intent was rejected by deterministic validation.

Parked follow-ups

  • The helper path is explicitly narrowed by helper_derived ordering logic, but the separate legacy owner-result branch remains outside this repair and can still promote a captured pre-call field.
  • The helper-capture pre-call case remains exposed through the separate legacy owner-result branch, so the shared effect-reader fix is not a complete helper-order repair.
  • The helper owner-result path can still promote a helper comparison whose owner result is implicitly None.

Copy link
Copy Markdown
Member Author

Response to the github-actions review submitted at 03:44:48 UTC:

The exact543 native default-feature producer passes all 1,288 Python tests, including the 12 ordering controls, and all three ledger inventory/cardinality tests, with no ignored tests. The controls cover native assertions, exact helper call identity, mock argument evaluation, assertion/unittest messages, discarded conjuncts, UTF-8 offsets, semicolon and multiline forms for guarded instance and direct module effects. Independent native Python/CLI controls also cover stdout, stderr, files, context entry/exit and imported helpers. Check-fast (15 selected gates, strict workspace/all-target Clippy) and precommit now pass; full goldens cover 663 fixtures / 1,708 surfaces with zero drift.

The scope limit is explicit rather than a claim that every unresolved case fails closed. Unresolved single-line receiver construction stays weak. Dynamic dict/vars masks include inherited false promotions already documented in #10178; they are not repaired or newly claimed conservative here. Actual699 and current088 executables both expose the helper captured-field/implicit-None case through the separate owner-result branch (native old/new0/0), while real returned-field and after-argument positives discriminate0/1 and stay exposed. The final native direct EffectReads false/true pair verifies the bounded field-order consumer independently of that dominating legacy branch.

The sensor exit2 and rejected model proof intent are instrument/missing-evidence results, not a passing scheduled cargo test or an observed source regression. No sensor retry is requested. The retained native source-bound proof addresses the bounded questions; required repository qualification is still pending and will be obtained through the installed Ready/merge-ready flow before any merge. The exact-head source review and explicit residual are in review5647070586 and the PR body. No unsafe/native execution, worker, backing-store mutation or access surface was added.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 26, 2026 03:57
@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!

@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: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@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 current-head source/oracle inspection: 543ebb9183e2f2e1408321d9ea0c4e663f2925c4 (basis 494a2967b4be7f80ca86206217c79182c95e7798). No new actionable source or test-oracle finding.

  • EffectReads::of computes completion after the matching closing parenthesis from argument slices in the exact test body; owners_tests::test_assertions normalizes native assertion/operand byte ranges into that same body for synchronous and asynchronous tests.
  • oracles retains the actual compared operands selected by the oracle gate. Message expressions and discarded weaker conjuncts cannot provide a later channel read. Helper replacement uses the exact call range, preserving distinct assertions on one physical line.
  • EffectReads::observed_by checks the credited operand's order and guarded retention interval. The sole production consumer in sink_alignment passes that assertion's range, operands and helper origin together. Mock inspections retain their separate after-argument evaluation phase.
  • The twelve ordering tests challenge same-line before/after pairs, multiline/UTF-8 offsets, duplicate assertions, masking, helper capture, native/unittest messages, discarded conjuncts and mock evaluation. The helper test directly checks effect-consumer false/true results, so the known legacy owner-result branch cannot mask that oracle. Both new fixture honesty entries independently require one weak finding, non-promotion and no repair packet.

Later-main Python changes inspected through 1afad6261f1b593324647defc07d5b48715d1a08 do not alter these constructors, normalization, helper replacement or effect consumers. Parallel fact extraction transfers owned String/TextRange fields; the Rc remains local to alignment. The combined tree merges cleanly. No restack or source correction is indicated.

Observed: exact committed source/tests, both fixture output contracts, honesty entries, complete changed-path inventory and later-main diff. Existing qualification run 40266634215, attempt 1 passed policy, honesty, dependency, process, network and all-features checks and is continuing. Its workflow reference and admission checkout bind eb18f5630b7e431299e2ed6a19ba490e183f1205, which includes #10506; this is the coherent unpartitioned nextest route.

Residual: general object flow, dynamic masking and the documented inherited implicit-None helper owner-result promotion remain outside this effect-channel repair. Earlier local execution counts are reported evidence; this pass did not rerun them. Final disposition remains REVIEW_INCOMPLETE pending the existing hosted run's terminal reports and final conversation/head refresh.

@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.

Final disposition: REVIEW_READY for 543ebb9183e2f2e1408321d9ea0c4e663f2925c4.

The independent source/oracle inspection remains current: completed-call offsets and native compared-operand spans govern the actual credited assertion; helper capture, message exclusion, per-assertion guarded retention and mock evaluation retain the stated boundaries. No new source correction is indicated.

Observed and independently checked: qualification 40266634215, attempt 1 checked out eb18f5630b7e431299e2ed6a19ba490e183f1205, including #10506, and used the coherent unpartitioned cargo nextest run --workspace --profile ci route. The original native report records 21,815 passed, 5 skipped across 188 binaries, with explicit PASS rows for all 12 ordering tests and all 3 ledger inventory/cardinality tests. Doctests record 2 passed and 1 ignored. The actual workflow preserves native test status and requires a fresh nonempty JUnit report. Artifact 12628770824 is bound to this head/run/attempt; separate XML parsing is not claimed.

Policy, honesty, all-features check, strict Clippy, golden outputs, fixtures, capabilities, verdict corpora, PR evidence, schema sweep and the required Result all passed. The Rust-only lane and optional Windows subset passed. Original gate and Result terminal logs were inspected, including admitted candidate/current request and successful selected-job inputs.

The refreshed conversation inventory has no unresolved inline thread or new material finding. All current check runs are terminal success/skipped and status contexts succeed. Main 071a0e997a868bcaa2e21aca211d0f3e91294d57 combines cleanly as tree d26560bf6861165394758180baae0c53c71832e7; later main preserves the reviewed Python surfaces and upstream/candidate traceability.

The inherited implicit-None owner-result promotion, general helper/object flow and dynamic masks remain documented residuals outside this effect-reader acceptance. This author COMMENT records the technical disposition; normal protected expected-head squash remains the integration transaction.

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.

1 participant