Repository navigation
fix(python): None never equals a number in shared literal equality (main red) - #11918
Conversation
#11842 made literals_equal return None for any decimal-vs-unreadable pair, which stopped the guard gate from treating None != 0 as definitely true and failed compare_literal_values_fails_open_on_undecoded_literals on main. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoTceRbARsa5PtgeVZ
|
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 47 minutes. View limit details
|
|
Independent bounded source review of 1d0547d: no material correctness finding in this repair. boundary.rs:2104–2111 adds symmetric decimal-versus-None inequality only after both operands are recognized; unknown identifiers remain unknown, preceding bool/number behavior and later string handling are unchanged. The two assertions at 2239–2244 discriminate removal of either new branch, and the existing guard_activation.rs regression exercises the failing None != 0 consumer. Ordering continues to refuse cross-kind comparisons. Optional strengthening: consumer-level 0 != None, None == 0 and None < 0 controls would pin symmetry and operator separation directly. These are not identified blockers. This is source review, not independent execution or formal PR approval. The author's 1,712 passing Python tests remain author-reported; required run 41245211953 was still running when inspected. Preserve current-candidate qualification and the existing #11830 owner's integrate-then-requalify sequence; this comment does not establish acceptance of either combined tree. |
EffortlessSteven
left a comment
There was a problem hiding this comment.
Independent review (fresh-context reviewer, head 1d0547d): REPAIR_REQUIRED
Inspected:
crates/ripr/src/analysis/language/python/boundary.rsat head1d0547d7and basefa621a32. The whole production change is two arms added at:2108-2109; the test change is three assertions added toboundary.rs::literals_equal_tests::python_bool_numeric_equality_and_inequality.- The surrounding literal-equality model in the same file:
literals_equal(:2089-2134),bool_as_decimal/canonical_decimaluse in the two leading matches (:2090-2103,:2104-2112), andprovably_unequalwith itskind()model (:871-899). crates/ripr/src/analysis/language/python/guard_activation.rsat the head:compare_literal_values(:1199-1247), its readability pre-checkguard_literal_is_readable(:1249-1255), theeval_comparisoncall site (:1115-1118), and the module doc (:19-20).- The pre-existing oracle the change targets:
guard_activation.rs::tests::compare_literal_values_fails_open_on_undecoded_literalsat base:1419-1437, whose line:1436assertscompare_literal_values("None", "!=", "0") == Some(true). That file is not modified by this change, so the oracle is pre-existing and independent of the candidate. docs/specs/RIPR-SPEC-0260-python-guarded-arm-activation.md: the equality clause (:77-79), the ordering clause (:80-85), the exclusion rule (:36-40), and the Non-Goals clause (:176-178)..ripr/traceability.tomlbehavior entryid = "RIPR-SPEC-0260"(:18756-18858): itstestslist and itscodelist.- Every
None-related comparison underfixtures/(:*.py). - Hosted proof for this exact head, grouped by workflow run.
Blocking:
-
The candidate makes a mixed-kind inequality decide credit, and the governing spec clause that pins that behavior is not narrowed.
The governing text is
docs/specs/RIPR-SPEC-0260-python-guarded-arm-activation.md:176-178(Non-Goals): "This spec does not change the predicate boundary rule, the boundary rule's own literal equality (its mixed-kind inequality stays conservative for credit), or any non-Python adapter."The repo's own definition of "mixed kind" is in the file the candidate edits.
boundary.rs:871-899(provably_unequal) states: "Both literals are of one comparable kind and differ. Mixed kinds (Truevs1), escaped or prefixed strings and anything unparsed are unknown, never 'unequal'." Itskind()mapsNonetoKind::Singleton(:882-884) and a decimal toKind::Number(:885-887), and its final comparison (:894-899) requires equal discriminants, soprovably_unequal("None", "0")is false: a mixed-kind pair is unknown.The candidate adds exactly that mixed-kind pair as a definite inequality:
// `None` is a singleton that never equals a number, so the pair is // definitely unequal; any other unreadable side stays unknown. (Some(_), None) if right == "None" => return Some(false), (None, Some(_)) if left == "None" => return Some(false),
At the base, the same pair fell into
(Some(_), None) | (None, Some(_)) => return None, i.e. unknown. At the head,literals_equal("None", "0")isSome(false).That definite answer reaches a credit decision, not only a helper result.
compare_literal_valuesmaps==straight toliterals_equal(guard_activation.rs:1210-1212),eval_comparisonfeeds it into the guard walk (:1115-1118), and the spec's own exclusion rule (:36-40) is "when every strong related call provably fails at least one guarding comparison, the changed line never executes under an observed input. The finding fails closed toweakly_exposed". Concretely: with the candidate, a guardx == 0where the strong related call bindsx = Noneis now known-false, so the row provably fails the guard and the guarded arm is excluded and downgraded toweakly_exposed. At the base the same comparison was unknown, failed open, and the pre-gate verdict was kept. So the candidate lets a mixed-kind inequality decide credit -- the precise thing the clause says does not happen. The module doc that owns the conservative rule was not updated either (guard_activation.rs:19-20: "Equality follows Python semantics (True == 1), since a wrong exclusion is a wrong actionable signal").The Python semantics behind the new rule are correct --
Noneis a keyword singleton and never equals a number -- so this is not a semantic error in the change, and the analyzer becomes more accurate. It is a contract gap: the spec states an invariant the code now breaks, and the change records the new rule nowhere.Repair direction, not a prescription: narrow the Non-Goals clause at
RIPR-SPEC-0260:176-178to name theNone-versus-number exception and to say explicitly what stays conservative (the PR body already lists the other cross-kind pairs as deliberately "not established"), and register the rule and its tests in.ripr/traceability.toml. The traceability entry forRIPR-SPEC-0260already listscrates/ripr/src/analysis/language/python/boundary.rsundercodeandguard_activation.rs::tests::compare_literal_values_equates_bool_like_pythonundertests(:18772) -- the bool-versus-number equivalent -- but neitherboundary.rs::literals_equal_tests::*norguard_activation.rs::tests::compare_literal_values_fails_open_on_undecoded_literals, the two tests that actually carry this rule, is registered anywhere, and this change adds no entry.
Non-blocking:
-
The changelog fragment's filename names the wrong work item. The file is
changelog.d/11907-python-none-vs-number.md, but this PR is #11918 and its governing issue is #11842; #11907 is an unrelated pull request ("fix(ci): retry routed-rust runner inventory query before recording failure (#8858)", which shipschangelog.d/8858-runner-inventory-retry.md). The repo's documented convention is "Name the file<pr-or-issue>-<short-slug>.md" (xtask/src/policy/changelog_fragments.rs:60). The gate does not check the filename number -- it validates the kebab-case stem, the<!-- section: Fixed -->line, and that the entry text cites a reference, and the fragment body does cite#11842correctly -- so this passes CI while pointing a future fold at the wrong item. -
The new rule is expressed as a literal-text comparison in the decimal match while the singleton knowledge already lives in
provably_unequal'skind()(boundary.rs:882-884). The two owners now disagree about cross-kind pairs:provably_unequalrefuses all of them, the new arms make one definite, and the PR body lists the remaining cross-kind pairs as deliberately "not established". They do not conflict at runtime today, because the decimal match short-circuits beforeprovably_unequalfor this pair, but the duplication is a drift risk. Carrying the exception in the existing kind model would keep one owner for "what is provably unequal". -
Checked and cleared. No fixture under
fixtures/compares aNone-resolving operand against a number: the elevenNonehits in the fixture inputs are allrec.last == None, a same-singleton pair whose resolution is unaffected by the new arms, so no corpus row's expected output depends on the changed pair. No spec other than RIPR-SPEC-0260 governs this behavior -- a search ofdocs/specs/fornever equals,singleton,None ==andNone !=returns no clause authorizing a definiteNone-versus-number answer. The change also repairs a real main-red without touching its oracle: at the base,literals_equal("None", "0")returnedNone, socompare_literal_values("None", "!=", "0")returnedNonewhile the pre-existing base assertion atguard_activation.rs:1436expectsSome(true); that is the source-verified basis for the PR body's "main red" claim, which the hosted log has not yet confirmed.
Not run:
- No Rust toolchain on this reviewer host (
rustc,cargo,rustupare absent from PATH), socargo test -p ripr --lib python::,cargo xtask precommit, andcargo xtask check-traceabilitywere not executed locally. The base-red finding above is a source-level reading of the base and head blobs, not a run. - Hosted proof at this exact head, grouped by workflow run. The current run (41245211953 and siblings, 21:47:24) has
Admit PR CandidateSUCCESS,Rust-only feature laneSUCCESS,cargo-denyanddependency-reviewSUCCESS, andpaste-ubuntu/macos/windows-latestSUCCESS, butRipr Rust Small on GitHub Hosted / Rust gatesis still IN_PROGRESS andwindows-advisory-subsetis still IN_PROGRESS, so the head is not fully qualified at review time. The basefa621a32also showsRust gatesIN_PROGRESS (run 41243698941, 21:27:50), so there is no completed base lane to compare against yet; the base red is established by source, not by a hosted log. - The change does not state which lane it expects to turn the base red green, so this review cannot confirm that the
rust-tests-junitfailure named in the PR body is the only base-red symptom at this head.
Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head 1d0547d7b75622f11c333965a716761ad26d2bd1. Not an approval.
There was a problem hiding this comment.
Evidence gaps
- Execution evidence for the changed Rust behavior remains incomplete in the supplied packet.
- Model proof intent was rejected by deterministic validation.
- The named integration regression test is not included in the changed diff, and the supplied ripr receipt failed while the cargo-test receipt remained pending.
- The claimed regression proof lacks an available completed sensor receipt in this review packet.
|
Additional independently retained failure evidence for the existing #11918 owner; no competing fix or takeover. The same
The guard consumer file is identical across frozen main0f88, actual mainfa621 and these compositions. The shared literal-equality fallback from #11842 explains the same None-versus-number result; this is not a claim that I ran a standalone-main baseline. Your symmetric recognized-decimal/None repair is the existing ownership boundary. I am preserving its qualification/landing sequence, not modifying your branch. Affected candidate convergence records will name #11918 as the shared integration prerequisite and will not turn optional review-workflow success into a passing native aggregate. Root will inspect the landed repair and actual new merge composition before final qualification/landing judgments. |
…t the shared equality The shared literals_equal leaves a decimal against None unknown so the boundary rule never awards credit from it (RIPR-SPEC-0260 non-goals). The exclusion gate states the Python answer itself, as it did before #11842. Registers the guard oracle test in traceability and renames the changelog fragment to the governing work item. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoTceRbARsa5PtgeVZ
|
Repair pushed as b75ec4e for the REPAIR_REQUIRED review on 1d0547d. The shared Generated by Claude Code |
|
Correction to my source review 6549704689: it was too narrow to establish contract alignment. Review 5725183185 identified that shared literal equality also feeds predicate-boundary credit, conflicting with SPEC0260's conservative boundary non-goal. My earlier no-material-finding statement applies only to the inspected literal-comparison semantics and missed that consumer/scope issue. The owner has superseded 1d0547d with b75ec4e, moving the exception into guard-local equality and restoring shared behavior. The old review and reported execution are not qualification of this successor. Preserve the new candidate's independent contract review and required run 41247837150 before integration, then requalify #11830's combined source. |
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm the added assertions cover symmetry, equality direction, None equality, ordering, and the shared-boundary invariant.
- Confirm the repair claim is backed by focused assertions for symmetry, equality, None identity, ordering, and shared-boundary behavior.
Evidence gaps
- Independent execution evidence is absent because cargo-test has no receipt and ripr failed.
- Model proof intent was rejected by deterministic validation.
- Execution evidence for the changed Rust behavior is incomplete in the supplied review packet.
- Execution proof for the changed Rust behavior is incomplete in the supplied packet.
- Completed execution evidence for the changed Rust behavior is unavailable in this packet.
- Execution proof for the changed Rust behavior is not independently available in this packet.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmpeo8ydZsx1WCCHnVU
Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
…ale test-merge; picks up #11918 main-red repair)
Governing issue or accepted claim: #11842 regression on main (guard gate
None != 0)Acceptance delta (one sentence): The Python guard gate again answers
None != 0as definitely true, socompare_literal_values_fails_open_on_undecoded_literalspasses on main, without changing the shared literal equality the boundary rule uses for credit.Diagnosis
#11842 replaced the guard-local
guard_literals_equalwith the shared three-valuedliterals_equal, which returns unknown for a decimal against a non-decimal.None != 0becameNone, failing the guard oracle atguard_activation.rs:1436on every PR carrying main (confirmed on #11830, #11517, #11919, #11915).Change (head b75ec4e)
guard_activation.rs:guard_literals_equalstatesNoneagainst a decimal asSome(false)and defers everything else toliterals_equal; module doc names the exception.boundary.rsuntouched: RIPR-SPEC-0260's non-goal (the boundary rule's mixed-kind inequality stays conservative for credit) still holds. This replaces the first revision (1d0547d), which changed the shared helper and was reviewed REPAIR_REQUIRED for exactly that.Nonesymmetric and==/!=,None == None, ordering still unknown, andliterals_equal("None", "0")stays unknown..ripr/traceability.toml; changelog fragment renamed to the governing item.Proof
cargo test -p ripr --lib python::1712 passed locally on this head;cargo fmt --checkclean.cargo xtask check-traceabilitywas not completed locally; the hosted gate decides.Not established
Other cross-kind pairs stay unknown.
Rollback
Revert the commit.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SvmPmoTceRbARsa5PtgeVZ