Skip to content

fix(python): demote self.attr truthiness swaps in compound conditions - #11931

Merged
EffortlessSteven merged 2 commits into
mainfrom
cursor/python-truthiness-swap-self-attr-7b98
Oct 31, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
cursor/python-truthiness-swap-self-attr-7b98

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Summary

Extend the #9186 Python truthiness-swap allow-list so a single differing and/or operand can demote exposed to weakly_exposed, including self.<attr> when class __init__ assigns that attribute once from a constructor literal.

Governing issue or accepted claim: #11890
Advances #11890
Acceptance delta (one sentence): A self.port / self.port is not None swap inside a compound condition demotes when every strong constructor call is a readable literal (None/8080), names discriminator self.port == 0, and stays exposed for a falsy constructor argument, a later self.port write, two swapped operands, an unknown constructor keyword, or a missing required constructor argument.

Swarm / Source Boundary

This PR targets EffortlessMetrics/ripr-swarm, the normal development trunk for trusted same-repo ripr work. Confirm the change belongs here:

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Proposal:
Spec: RIPR-SPEC-0028 (Python preview static facts); #9186 truthiness-swap closed allow-list
ADR:
Plan item:
Governing issue or accepted claim: #11890
Acceptance delta (one sentence): Compound single-operand truthiness swaps, including self.<attr> bound once from __init__ constructor literals, demote with a named falsy-value discriminator; unreadable constructions (unknown keywords, missing required args) fail open.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): cursor/python-truthiness-swap-self-attr-7b98
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): n/a

Scope

Only crates/ripr/src/analysis/language/python/truthiness_swap.rs (production helpers and mod tests). Both pick steps landed: (a) top-level and/or with exactly one differing parse_test operand; (b) self.<attr> via a unique __init__ self.x = param write, reading inline Class(...).method() constructor literals including omitted defaults.

Scope Classification

This PR is scoped by:

  • One production behavior

Production delta:

  • python_truthiness_swap_evidence now engages on a compound condition when joiners match and exactly one operand is a swapped single-operand test.
  • self.<attr> is a tested name only when the class __init__ assigns it once from a parameter and nothing else in the class writes it.
  • Constructor values come from the inline receiver Addr("h", 8080).authority(), including the __init__ default when omitted.
  • Class constructor calls are recognized callees so Addr(...) does not fail-open the existing indirect-reach check.
  • bind_init_param validates keyword names against __init__, rejects duplicates and positional-after-keyword, and requires every required parameter to be bound exactly once before reading the target.

Evidence/support delta:

  • Discriminating tests in truthiness_swap.rs mod tests: Addr None/8080 demotes with self.port == 0; Addr("h", 0) stays exposed; a later self.port = 0 write stays exposed; two differing operands stay exposed; a bare-parameter compound demotes; Addr("h", extra=1) stays exposed; Addr(port=8080) without required host stays exposed; keyword-order Addr(port=8080, host="h") still demotes.
  • Red-before: the original three positive tests failed as Exposed / parse_test None on 7118be7310; the unknown-keyword and missing-required tests failed as WeaklyExposed on 78bd148089; they pass after.

Single acceptance criterion:

  • The issue's Addr repro classifies weakly_exposed with discriminator self.port == 0, and the named fail-open controls stay not-demoted.

Non-goals:

  • Nested classes, cls.attr, locals holding the receiver, non-literal constructor arguments, *args/**kwargs __init__, or golden/corpus refresh.
  • Edits to classify/*, python.rs, boundary.rs, or other fenced paths.

Support-tier Impact

  • none

Claim/proof notes:

  • Preview Python adapter only; does not claim runtime mutation kill/survive.

Policy Impact

  • none

Proof

cargo test -p ripr --lib -- analysis::language::python::truthiness_swap
cargo test -p ripr --lib -- truthiness_swap
cargo clippy -p ripr --lib -- -D warnings
cargo clippy -p ripr --tests -- -D warnings
cargo xtask precommit

Result, failures, or skipped proof:

Claim Boundary

What may be claimed after this PR? A readable Python truthiness swap of one compound operand, including self.<attr> with a unique __init__ assignment and inline constructor literals, can demote to weakly_exposed with a named falsy-value discriminator.

What must not be claimed yet? That every attribute-in-compound shape is demoted; unreadable constructions, extra writes, receivers built elsewhere, unknown constructor keywords, missing required constructor args, and two swapped operands remain fail-open exposed. No golden/corpus refresh. Hosted qualification is still missing at publication.

Rollback

Revert the commits on this branch. Behavior returns to the #9186 bare-parameter, single-operand allow-list.

Spec-Test-Code Traceability

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

n/a — ordinary analyzer PR, no workflow or lane change.

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • Errors are reported with actionable context.

Gates

Local: cargo fmt --check (via precommit), cargo clippy -p ripr --lib --tests -- -D warnings, cargo xtask precommit. Hosted matrix is the remaining qualification.

Exact candidate SHA: 1486238 (GitHub PR head is authoritative after push).

Open in Web Open in Cursor 

Extend the #9186 truthiness-swap allow-list so a single differing
and/or operand can engage, including self.<attr> when class __init__
assigns that attribute once from a constructor literal. Unreadable
constructions, extra writes, and two swapped operands stay fail-open.

Governing issue: #11890

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
@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 31, 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 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 149 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: d032b05a-1d1f-4ac0-aa31-9e7bb741ea09
Commits

Reviewing files that changed from the base of the PR and between fa621a3 and 1486238.

Files selected for processing: 1
  • crates/ripr/src/analysis/language/python/truthiness_swap.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@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 source review of 78bd1480893f87cc1af95584c07240c00c0e4356 (author COMMENT; not an approval).

Reviewed surface: crates/ripr/src/analysis/language/python/truthiness_swap.rs only. Semantic owner is the #9186 truthiness-swap allow-list. Production still fail-closes unless joiners match, exactly one operand parses as a swapped single-operand test, and either the name is an unrebound owner parameter or self.<attr> with a unique __init__ self.x = param write and inline Class(...).method() constructor literals. A second class write, Addr("h", 0), two swapped operands, and receivers built elsewhere stay not-demoted.

Oracle: the Addr None/8080 case failed as Exposed on 7118be7310 and now demotes with discriminator self.port == 0. Existing #9186 classify controls still pass. No fenced paths, goldens, or corpus files were edited.

Gemini quota and CodeRabbit rate-limit comments are missing provider evidence, not a clean review.

Disposition: REVIEW_INCOMPLETE — source/oracle review is current for this SHA; hosted required checks are not yet terminal. Hosted green is not itself 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.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • Constructor binding does not validate keyword arguments against the init signature before using them.
  • bind_init_param accepts arbitrary keyword names and binds positional arguments only from params, so Addr(port=8080, host="h") can be misbound: host is not associated with the host parameter when it appears as a keyword, while positional indexing still advances only for positional segments. Validate keyword names against init_params and ensure every required parameter is bound exactly once before reading the target. (crates/ripr/src/analysis/language/python/truthiness_swap.rs:610).

Verification questions

  • Confirm negative controls cover falsy constructor input, later attribute writes, and two differing operands, but do not independently prove the unreadable-construction fail-open claim.
  • Confirm constructor parameter parsing rejects annotated parameters, so a valid def __init__(self, port: int = None) mapping fails open instead of demoting.
  • Confirm the failed ripr run may hide a source-route or analyzer regression; its exit code alone does not identify whether the failure is caused by this diff.

Parked follow-ups

  • The self-attribute extension is placed in the existing truthiness-swap evidence module, but it duplicates Python source parsing that is already split across no_behavior and boundary helpers, increasing maintenance risk.

Evidence gaps

  • The new focused cargo-test receipt was absent in the shared packet, and ripr failed with exit code 2.
  • Current-head executable proof remains unconfirmed in this packet.
  • Model proof intent was rejected by deterministic validation.
  • The current evidence packet does not establish terminal current-SHA proof: ripr failed with exit code 2 and the scheduled cargo-test receipt is absent.

Validate constructor keywords against __init__ and require every required
parameter exactly once, so an extra kwarg or missing host cannot demote a
self.attr truthiness swap.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>

@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 source review of 14862384a6808ce1d5b14b0847ecde539daabac7 (author COMMENT; not an approval).

Reviewed surface: crates/ripr/src/analysis/language/python/truthiness_swap.rs only. Semantic owner is the #9186 truthiness-swap allow-list. ub-review’s confirmed finding was valid: bind_init_param could demote on Addr("h", extra=1) and Addr(port=8080) because unknown keywords were accepted and missing required parameters were ignored. The repair fail-closes unless every keyword is an __init__ parameter, every required parameter is bound exactly once, and there is no positional-after-keyword. Keyword-order Addr(port=8080, host="h") still demotes.

Oracle: those two constructions classified WeaklyExposed on 78bd148089 and now stay not-demoted. Addr None/8080 still demotes with discriminator self.port == 0. Existing #9186 classify controls still pass. No fenced paths, goldens, or corpus files were edited.

Verification questions: unreadable-construction fail-open is now covered by unknown-keyword and missing-required tests. Annotated __init__ parameters remain fail-open via the existing identifier-only header parser (closed allow-list, not a promotion). The ub-review packet’s missing cargo-test receipt and ripr exit 2 are instrument/packet gaps, not a source-route defect on this SHA; local cargo test -p ripr --lib -- truthiness_swap passed.

Parked follow-up (duplicate parsing vs no_behavior/boundary) stays out of scope: those files are fenced.

Disposition: REVIEW_INCOMPLETE — source/oracle review is current for this SHA; hosted required checks are not yet terminal. Hosted green is not itself merge clearance.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Addressing the ub-review finding on constructor binding (bind_init_param).

Valid defect, repaired on 14862384a6808ce1d5b14b0847ecde539daabac7. The cited example Addr(port=8080, host="h") already bound correctly (keywords are looked up by name). The real fail-open was: unknown keywords were accepted, and a missing required parameter did not block reading a later keyword/default. Addr("h", extra=1) and Addr(port=8080) classified WeaklyExposed on 78bd148089. bind_init_param now refuses unknown names, duplicates, positional-after-keyword, and any required parameter that is not bound exactly once. Discriminating tests fail-before on that SHA and pass after; keyword-order literals still demote.

Verification questions:

  • Unreadable construction: covered by the unknown-keyword and missing-required tests (plus existing falsy-arg / rewrite / two-operand controls).
  • Annotated __init__ parameters (port: int = None): the closed header parser already fail-opens; that is conservative, not a false demotion.
  • ripr exit 2 / missing cargo-test receipt: packet/instrument gap in that review, not a source defect. Local cargo test -p ripr --lib -- truthiness_swap and cargo xtask precommit passed on this head.

Parked follow-up about sharing parse helpers with no_behavior/boundary is out of scope (those paths are fenced).

@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 review (fresh-context reviewer, head 1486238): REPAIR_REQUIRED

Inspected:

  • PR #11931 "fix(python): demote self.attr truthiness swaps in compound conditions", head 14862384a6808ce1d5b14b0847ecde539daabac7, base fa621a32eaf4c3dc6c17119021ea943641696aef, DRAFT, no labels, mergeable_state: blocked. One changed file: crates/ripr/src/analysis/language/python/truthiness_swap.rs (+823/-38). Diff computed by fetching the file at base and head and diffing them (the head SHA is not in the local clone).
  • Semantic owner: truthiness_swap.rs, the #9186 truthiness-swap allow-list. New helpers at head include identifier :102 (now accepts a self. prefix), split_boolean_condition :121, swapped_operand :200, self_attr_name :230, distinguishing_example :273, python_truthiness_swap_evidence :287, once_init_attr_mapping :383, class_body_lines/init_block (indent-based), init_params :485, assignment_span :517, line_writes_self_attr :547, exact_init_assign :556, constructor_attr_input :563, inline_constructor_arglist, bind_init_param :637; owner_reached_indirectly :873 and calls_unrecognized_callee :958 gained extra_callees.
  • Production path verified, not assumed: crates/ripr/src/analysis/language/python/boundary.rs:159 python_boundary_evidence -> :167 predicate_condition (:1112) -> :175 python_truthiness_swap_evidence. predicate_condition yields the full compound text for if self.port is not None and self.port != 80:, relational_operators skips !=, and outside (truthiness_swap.rs:698) matches the compound as one literal span, so the compound path is reachable in production, not only through the unit helper.
  • Oracle read: nine new test functions - split_boolean_condition_keeps_top_level_and_or_operands :1120, self_attr_compound_truthiness_swap_with_constructor_literals_is_weakly_exposed :1442, ..._stays_exposed_on_a_falsy_constructor_argument :1455, ..._stays_exposed_when_the_attr_is_rewritten :1470, compound_truthiness_swap_stays_exposed_when_two_operands_differ :1494, bare_parameter_compound_truthiness_swap_with_unseparated_calls_is_weakly_exposed :1522, ..._stays_exposed_on_an_unknown_constructor_keyword :1552, ..._stays_exposed_when_a_required_constructor_arg_is_missing :1569, self_attr_compound_keyword_constructor_literals_are_weakly_exposed :1585 - plus the extended parse_test matrix. They reach the analyzer through classify_swap :1364 -> classify_change_with_source, with addr_finding :1413 and discriminator_names_self_port_zero :1424.
  • Governing issue #11890 (open): its repro (src/addr.py + tests/test_addr.py, ports None and 8080) matches the fixture constants ADDR_SOURCE/ADDR_TESTS :1391+, so the fixture is faithful to the reported case.
  • Governing spec: docs/specs/RIPR-SPEC-0028-python-preview-static-facts.md, section "Predicate Swap Amendment (2026-10-30, #9186)" at :1558-1581.
  • Convention precedent from merged history: b9436fc61 (PR #11201, the #9186 implementation of this same rule) and siblings 586a0d8a6 (#11210), 12496bda9 (#11383), 862ea14d8 (#11674).

Blocking:

  1. The change ships outside the governing spec's closed allow-list, and none of the artifacts the repo ships with such a change are present. docs/specs/RIPR-SPEC-0028-python-preview-static-facts.md:1558-1581 states the demotion applies to "one single-operand test of an owner parameter" and that "the rule is a closed allow-list that keeps the existing verdict on anything unrecognized". This head widens the rule twice - to compound and/or conditions with one differing operand (truthiness_swap.rs:121-228), and to self.<attr> operands bound once from __init__ (:383-635). Both shapes are outside the spec's enumerated allow-list, so by the spec's own words the verdict should stay exposed; after this change it becomes weakly_exposed. Issue #11890 records the old scope in the same terms ("compound conditions, attribute operands ... fail open"), so the spec now misdescribes shipped behavior.
    The repo's precedent for this exact rule settles what "in the same change" means. Merged commit b9436fc61 ("fix(python): a predicate swap no observed input separates is not exposed (#9186) (#11201)") landed in one squash: RIPR-SPEC-0028...md +25/-0, .ripr/traceability.toml +23/-0, changelog.d/python-truthiness-swap-9186.md +7/-0, four fixtures/evidence-promotion-honesty-corpus/cases/python_truthiness_swap_*.json cases and four fixtures/python_truthiness_swap_* workspaces with pinned expected/check.json and expected/human.txt. The nearest siblings do the same: 586a0d8a6 (#11210) spec +12/-0, traceability +7/-0, changelog fragment; 12496bda9 (#11383) spec +16/-1, traceability +6/-0, fragment; 862ea14d8 (#11674) spec +1/-1, traceability +2/-0, fragment. This head changes exactly one file.
    Concretely: .ripr/traceability.toml:3847-3853 registers all seven existing truthiness_swap.rs::tests::* tests for RIPR-SPEC-0028 and :3854-3864 eleven classify/tests.rs::truthiness_swap_* tests, but none of the nine tests this head adds is registered; and the four fixtures/python_truthiness_swap_* workspaces registered at .ripr/traceability.toml:4098-4101 have no counterpart pinning the new compound / self.<attr> shape. cargo xtask check-traceability would not fail - it checks spec-to-behavior coverage (xtask/src/main.rs:6804-6810) - so this is a contract-parity gap the gates cannot see.
    Repair: add the dated spec amendment section as b9436fc61 did, register the new tests in the RIPR-SPEC-0028 behavior entry, add a changelog.d/ fragment, and extend the fixture and evidence-promotion corpus set to the new demotion shape.

Non-blocking:

  1. Earlier ub-review finding (review 5725290527, older head 78bd1480) that bind_init_param accepted unknown keyword names and ignored missing required parameters is REPAIRED here. bind_init_param (truthiness_swap.rs:637-692) now rejects a keyword that is not an __init__ parameter (:665-668), a duplicate binding (:669-671), and positional-after-keyword (:662-664), and requires every required parameter to be bound or defaulted (:677-682). The tests at :1552 and :1569 pin both halves.
  2. ub-review's question about annotated __init__ parameters still HOLDS and is benign; I checked it directly: init_params (:485-515) uses identifier(name).filter(|plain| plain == name)?, and identifier (:102-119) rejects an annotated parameter because : is not an identifier character, so it fails closed and is not demoted. Closed allow-list, not a promotion.
  3. ub-review's parked follow-up (the extension duplicates Python source parsing already split across no_behavior and boundary) still HOLDS and is stronger now. About 350 lines of hand-rolled Python text analysis land in truthiness_swap.rs - class_body_lines/init_block recover the class body and __init__ by indentation, init_params re-parses the signature, assignment_span re-implements assignment detection - while the repo already owns an AST parse at crates/ripr/src/analysis/language/python/source_facts.rs:595-606 (parse_module_result), which sibling PR #11932 in this same wave uses. A second, textual authority for "what is this class's __init__" now exists. Argument splitting does reuse no_behavior::{split_top_level_args, call_segment_keyword_name, matching_call_paren}, so the duplication is partial.
  4. The "exactly one write to self.<attr>" invariant is textual, so a setattr(self, "port", 0) call, a self.__dict__["port"] = 0 write, and a statement that removes the attribute are not seen as writes by line_writes_self_attr (:547-554) or assignment_span (:517-545). A class that rebinds the attribute that way would still be treated as bound once from the constructor and could demote on a value it can actually change. Narrow, and in the false-confidence direction: a follow-up, not a block.
  5. Oracle strength is good; I could not construct a self-confirming assertion. The positive test (:1442) asserts ExposureClass::WeaklyExposed AND a discriminator naming self.port == 0; the five fail-open controls (:1455 falsy constructor argument, :1470 later self.port write, :1494 two differing operands, :1552 unknown keyword, :1569 missing required argument) each assert assert_ne!(finding.class, ExposureClass::WeaklyExposed). One weakness: discriminator_names_self_port_zero (:1424-1439) also accepts self.port = 0 and searches activation.missing_discriminators, evidence and missing; the implementation produces the == 0 form via distinguishing_example (:273-282), so the loose branch is not exercised, but the test would also pass on an observed value rather than a named discriminator.
  6. The compound demotion is sound as I read it: with exactly one differing operand and the remaining operands textually identical, the compound's truth value can differ only if the differing operand's truth value differs, which is exactly the condition checked at truthiness_swap.rs:339-347.
  7. The earlier author self-review (5725328182, this same head) has correct factual claims - I independently re-verified the bind_init_param repair - and its REVIEW_INCOMPLETE disposition is right as far as hosted evidence goes, but it does not mention the spec, traceability and fixture parity gap above.
  8. docs/CHANGELOG_POLICY.md asks for "one fragment file under changelog.d/ per PR" and lists user-visible output changes among the include-criteria; this head has none.

Hosted evidence for this head:

  • The PR is a DRAFT with no labels, so the Rust lanes never routed: msrv, source-identity, vscode, rust-coverage, rust-tests-junit, future-clippy, cargo-deny, dependency-review, macos-advisory, windows-advisory, windows-advisory-subset, Perl and release proof and Rust-only feature lane are all skipped - unobserved, not green, and a draft can never be REVIEW_READY.
  • Green: GitGuardian Security Checks, workflow policy and wheel applicability. CodeRabbit neutral. build and inspect Linux x64 wheel and ub-review were in_progress at review time.
  • No red appeared on this head, so the known main-red analysis::language::python::guard_activation::tests::compare_literal_values_fails_open_on_undecoded_literals is not attributed here. Base fa621a32... carries no comparable Rust check-run of its own, so there was no base lane to compare against.

Not run:

  • No Rust toolchain on this host - rustc, cargo and rustup are absent from PATH - so I could not run cargo test -p ripr --lib -- analysis::language::python::truthiness_swap, cargo clippy -p ripr --lib -- -D warnings, cargo xtask precommit, cargo xtask check-traceability, cargo xtask fixtures or cargo xtask goldens check. Every gate result in the PR body is a producer claim I could not reproduce, including the red-before witnesses the body attributes to 7118be7310 and 78bd148089.
  • I could not execute the nine new tests, so the demote / stay-exposed assertions are verified by reading the code path only.
  • I did not run the combined-tree (current main merged into this head) compile check that docs/LEARNINGS.md 2026-10-08 (#7150) asks for before merge: no toolchain, and this pass is read-only.
  • The change was read from REST pulls/11931/files and from the file fetched at base and head; gh pr diff under-reports merge-commit PRs and GraphQL PullRequestChangedFile carries no patch field.

Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head 14862384a6808ce1d5b14b0847ecde539daabac7. Not an approval.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Independent review 5725372423 (head 14862384a6808ce1d5b14b0847ecde539daabac7): the blocking spec/traceability/fixture/changelog demand is out of scope for this candidate, not a source defect in truthiness_swap.rs.

Fence. Governing issue #11890 / wave pick ITEM 8 authorizes exactly crates/ripr/src/analysis/language/python/truthiness_swap.rs (and its tests). Explicitly fenced: specs/*, .ripr/traceability.toml, corpus.json, goldens, classify/*. The pick also says stop if any Python corpus golden changes. The #9186 squash (b9436fc61) could land spec + traceability + corpus + fixtures because it introduced the rule and those files were free; this leaf is a bounded allow-list extension under an active wave fence. Editing those paths here would be a claim-boundary violation, not a repair.

What this PR does claim. Advances #11890 (not Closes). Discriminating tests in truthiness_swap.rs pin compound single-operand swaps and self.<attr> constructor literals, plus fail-open controls. check-traceability does not require registering newly added tests (the review already notes that). Production still fail-closes on unrecognized shapes; the spec’s “closed allow-list” sentence remains true of anything this head does not newly enumerate. The spec text is now incomplete relative to shipped behavior; that is residual contract-parity work for a successor that owns RIPR-SPEC-0028 / traceability / honesty-corpus, not a reason to revert the analyzer change or to cross the fence.

Changelog. docs/CHANGELOG_POLICY.md would allow a fragment for user-visible classification. It is not in the fenced list, but it also does not unblock the review’s actual ask (spec + corpus + fixtures). Left as residual with the spec amendment.

Non-blocking items (agree):

  1. bind_init_param repair on this SHA — already landed.
  2. Annotated __init__ fail-open — closed parser, not a promotion.
  3. Textual class/__init__ parse vs source_facts AST — parked; source_facts / no_behavior / boundary are fenced (and fix(python): withhold probe for legacy object-only class header edits (#11888) #11932 is a sibling).
  4. setattr / __dict__ writes — true closed-allow-list hole, residual, false-confidence direction.
  5. Loose self.port = 0 oracle branch — unused; implementation emits == 0.
  6. Compound soundness — agree.
  7. Missing changelog fragment — residual as above.

Hosted required Ripr Rust Small Result is still unrequested (Draft, no merge-ready). Skipped draft lanes are unobserved, not green.

@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 self-attribute route reaches constructor values only through an inline Class(...).method() receiver; receivers built elsewhere remain unreadable and therefore fail open.

Parked follow-ups

  • The implementation uses a hand-written Python parser subset rather than reusing an existing AST boundary, increasing maintenance and scope risk.

Evidence gaps

  • No completed cargo-test receipt is available for the changed truthiness-swap module, and the ripr sensor failed with exit code 2.
  • Model proof intent was rejected by deterministic validation.
  • The focused cargo-test receipt is absent, leaving execution of the changed-behavior oracle unconfirmed in this packet.
  • Focused executable evidence for the repaired head is not present in the shared packet: ripr failed with exit code 2 and cargo-test has no receipt.
  • The advertised focused cargo-test proof is not present in the supplied packet, and the ripr sensor failed with exit code 2.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

ub-review 5725385391 verification (head 14862384a6808ce1d5b14b0847ecde539daabac7): confirmed fail-open for a receiver built elsewhere.

constructor_attr_input reads constructor values only through inline_constructor_arglist (truthiness_swap.rs). That helper requires the unique method call to be immediately ClassName(...).method(...): the byte before the method name is ., the byte before that is ), the matching ( is preceded by the class name as a whole identifier. addr.authority() / Addr("h", 8080); addr.authority() fail that shape, so constructor_attr_input returns None and python_truthiness_swap_evidence fail-opens (?). No confirmed finding on this head.

Packet gaps (missing cargo-test receipt, ripr exit 2) remain instrument/packet evidence, not a source-route defect. Local cargo test -p ripr --lib -- truthiness_swap passed on this SHA. Parked AST-reuse follow-up stays fenced.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 31, 2026 23:11
@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!

@EffortlessSteven

Copy link
Copy Markdown
Member Author

merge-ready

Head frozen at 14862384a6808ce1d5b14b0847ecde539daabac7. PR is Ready. Label merge-ready applied to request hosted Ripr Rust Small Result qualification. No inline review threads to resolve. Do not merge from this comment — qualification is requested, not landed.

@EffortlessSteven
EffortlessSteven merged commit b347e5e into main Oct 31, 2026
49 checks passed
@EffortlessSteven
EffortlessSteven deleted the cursor/python-truthiness-swap-self-attr-7b98 branch October 31, 2026 23:12
EffortlessSteven added a commit that referenced this pull request Nov 1, 2026
…ss swaps (#11890) (#11998)

#11931 landed the compound and self.<attr> truthiness-swap demotion with its
tests in truthiness_swap.rs only. This adds the RIPR-SPEC-0028 amendment, the
traceability rows for its eight tests and the changelog fragment. The issue
repro (self.port and ... -> self.port is not None and ...) re-checked on
current main reads weakly_exposed.


Claude-Session: https://claude.ai/code/session_018waZYroArgiNqfVvpNJa8b

Co-authored-by: Claude <noreply@anthropic.com>
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