Repository navigation
fix(typescript): stop repair packets borrowing an assertion that cannot see the change - #3942
Conversation
…ot see the change
A TypeScript error-path change (a new `throw`) whose only related test pinned
a success value (`expect(parseLimit('10')).toBe(10)`) flipped to
`repair_packet_ready: true`, and its repair action told the user to "add or
strengthen" that existing assertion, which cannot detect the throw.
- Oracle metadata evidence is only borrowed from assertions whose kind can
observe the changed probe family (the RIPR-SPEC-0104 mapping the classifier
already uses), so G-C fails closed for wrong-family oracles.
- The projected assertion shape keeps the borrowed call but uses an
`expected` placeholder instead of re-using a weaker matcher's literal under
`toBe` (it rendered `toBeGreaterThan(50)` as `toBe(50)`).
- The repair action leads with the missing discriminator.
New negative fixture ts_repair_packet_wrong_family_oracle; goldens for
ts_repair_packet_complete, typescript_broad_tothrow and
typescript_tothrow_exact_oracle reblessed (wording and metadata only; class,
category and readiness unchanged).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018QP9k41E538Xgytw8QCSfM
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- artifact-verifier failed (exit 2) but it is not a planned sensor for the PR's correctness lane and the diff is source-general TS preview repair-packet projection only; no public blocker implied, but the receipt is missing for the gate.
Refuted
- Placeholding 'expected' under toBe is a fabricated assertion and risks user-trust or downstream diff churn; refuted because: Shape is documented as a placeholder and matches the Rust shapes; CHANGELOG/corpora reblessed with explicit reason; no new evidence line is emitted; readiness/classification/category unchanged.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
Forward-only merge of main (532d379) for PR #3942; no rebase. Conflict resolutions: - crates/ripr/src/analysis/language/typescript/tests.rs: both sides had appended complete test groups at the same end-of-file anchor. Union kept: the PR's wrong-family oracle metadata tests (both sides of the guard) and main's F5-9 related-test reference tests (#3977). Append-only, no edits to either side's bodies. - fixtures/{ts_repair_packet_complete,typescript_broad_tothrow, typescript_tothrow_exact_oracle}/expected/CHANGELOG.md: both sides had appended a pending rebless entry. main's landed entry stays under the existing (2) heading; the PR's entry is appended under a new (3) heading per next_pending_heading first-unused-number semantics, keeping headings unique and both rebless reasons recorded.
…-0084 base contract The wrong-family fixture golden was blessed before main landed #4002 (RIPR-SPEC-0084): the tool now omits the inapplicable top-level base and records base_revision null for --diff envelopes. Verified before blessing: findings, counts and input_identity byte-identical; only base/base_revision changed (formatting_only drift class). Reblessed with the same spec reason main used for the other TS fixtures.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm
typescript_target_assertion_shapeonly branches onErrorPathvs_. Probe families likeMutationorSideEffectwill fall into the_ => toBe(expected)arm and produce a fabricated shape that does not match the family's expected matcher. The current diff does not assert behavior for non-ErrorPath, non-ReturnValue families. - Confirm
actionable_repair_routeprecedence now puts the discriminator first when both discriminator and shape are present. With no discriminator, the new armadd the focused assertion`` is reached. There is no test pinning this fallback path — old wording (add or strengthen the focused assertion) is gone and the new shape-only path is asserted only by `actionable_repair_route_leads_with_the_missing_discriminator`. - Confirm repro claim in PR body (
ratelimit2 → 0,pricing/gradesstayed at 0) is asserted without showing the corpus keys, pre/post fix JSON, or any receipt the lane can audit. Listed only because the opposition lane cannot independently confirm the walkthrough numbers; not a blocker because the new negative fixture plus the matching control test prove the predicate of the claim.
Refuted
- assertion_shape borrowing the observed call expression risks fabricating user-paste-able assertions even after the family filter.; refuted because: Borrowed observed expression is family-matched, so the resulting shape names an actually-callable signature that observes the family. Wording 'shaped like' plus 'expected' placeholder match Rust shapes and CHANGELOG reblessed reason documents the illustrative intent. Residual mitigated; not a boundary defect.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- PR body and proof block claim
cargo xtask precommitand clippy passed, but no receipt in the seeded thread; artifact-verifier sensor exited 2 and the reviewer noted model proof intent failed deterministic validation. The cited proof is self-attested by the author; an external proof run is not visible in this packet.
# Conflicts: # crates/ripr/src/analysis/language/typescript/tests.rs
…boundary rules Merge-interaction rebless after union with #3953: a guard without a comparison is weakly_exposed with no invented discriminator (line 3 predicate exposed -> weakly_exposed) and brace-only changed lines carry no behavior (line 5 probe removed). The fixture's error-path finding is unchanged: weakly_exposed, no wrong-family oracle borrow, repair packet stays not ready. Pinned by spec_0027_guard_without_comparison_is_not_ exposed and spec_0027_ambiguous_fallback_is_never_exposed_and_punctua tion_is_ignored on the merged tree.
The only conflict was the fixture's goldens CHANGELOG, where main (#3942) and this PR each appended "Pending — ts_repair_packet_complete (3)". Kept main's changelog and re-ran `cargo xtask goldens bless` with this PR's reason, which appended this PR's entry as (4). The auto-merged goldens pass `cargo xtask goldens check` unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
Requested by Steven · project thread
Summary
Before: in a JS/TS repo where
parseLimitgainsthrow new TypeError('invalid limit')and the only related test isexpect(parseLimit('10')).toBe(10),ripr checkreportedrepair packet ready: true("complete … delegatable") and the repair action said "add or strengthen the focused assertionexpect(parseLimit('10')).toBe(10)". That assertion already exists and cannot detect the throw. The canonical complete fixture had a second version of the same fault: it rendered the test'stoBeGreaterThan(50)as the targetexpect(result).toBe(50), which would fail against the real value (90).After: the error-path finding keeps its missing discriminator (
throws TypeError matching 'invalid limit') but no longer flips to a ready packet. Complete packets now say "add a focused assertion for the missing discriminatoramount == thresholdin the related test, shaped likeexpect(result).toBe(expected)".How: the oracle metadata lines the packet projection borrows (RIPR-SPEC-0087 G-C) were taken from the strongest related assertion regardless of family. They now pass through the same
ts_oracle_kind_matches_seamfilter the classifier already uses (RIPR-SPEC-0104), so a wrong-family oracle fails G-C closed. The assertion shape keeps the borrowed call and uses theexpectedplaceholder that Rust assertion shapes use, and the repair action leads with the discriminator.Found by walking three small TS/JS repos with the main binary (d4ba488); the
ratelimitrepro went from 2 ready packets to 0, andpricing/gradesstayed at 0.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Spec: RIPR-SPEC-0087 (G-C, F1/F2), RIPR-SPEC-0104 (family-matching oracle)
Issue: none filed; found in the language-quality walkthrough for 0.11
Scope
Scope Classification
Production delta:
collect_oracle_metadata_evidence_linestakes the probe family and skips assertions whose kind cannot observe it.typescript_gap_record_forbuildsassertion_shapeasexpect(<borrowed call>).toBe(expected)/.toThrow(expected).actionable_repair_routeleads with the missing discriminator.Evidence/support delta:
ts_repair_packet_wrong_family_oracle.Single acceptance criterion:
repair_packet_ready: true.Non-goals:
exposedwhenever any strong assertion exists, heuristic same-file links rating untested functionsweakly_exposed, class-instance receivers set up inbeforeEachgettingno_static_path). Each moves goldens and is a separate claim.Decisions (overrule on review)
typescript_oracle_matcherevidence line so the shape could quote the real matcher. Rejected: it changes ~40 TS goldens and still would not give the right expected value, because the borrowed assertion is a weaker check by construction (packets only flip for weakly-exposed findings).expectedmatches the Rust shapes (assert_eq!(price(threshold), expected)).typescript_broad_tothrowandtypescript_tothrow_exact_oracle(predicate probes whose only assertion istoThrow) lose their oracle metadata lines. That matches their classification, which already excluded those assertions for predicate probes. Class, category and readiness are unchanged.Support-tier Impact
Policy Impact
Proof
oracle_metadata_is_not_borrowed_from_a_wrong_family_assertionfails on main and passes here. Its control,oracle_metadata_is_kept_for_a_matching_family_assertion, passes on both, so the guard does not strip metadata wholesale.assertion_shape_keeps_the_call_and_drops_the_borrowed_literalpinsexpect(applyDiscount(100, 100)).toBe(expected).ts_repair_packet_complete(wording),typescript_broad_tothrow,typescript_tothrow_exact_oracle(metadata only). Corpora updated to the new strings:typescript-preview-repair-loop,evidence-promotion-honesty-corpus.artifact-verifiersensor exited 2 and that its model proof intent failed validation. Both are inside the reviewer;artifact-verifieris not defined in this repository and the finding itself says no blocker is implied. Its one substantive challenge (theexpectedplaceholder) it refuted itself. CodeRabbit skipped the PR (bot author), so external review is missing, not clean.Claim Boundary
May claim: a wrong-family oracle no longer makes a TS packet ready, and packet wording no longer invents an expected literal. Must not claim: TS predicate or heuristic-link classification is fixed.
Rollback
Revert the commit; goldens and corpora revert with it.
Spec-Test-Code Traceability
analysis/language/typescript/tests.rs,output/typescript_packet_projection.rs,output/preview_actionability.rstypescript/oracle.rs,typescript/classifier.rs,output/typescript_packet_projection.rs,output/preview_actionability.rsStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code or tests.🤖 Generated with Claude Code
https://claude.ai/code/session_018QP9k41E538Xgytw8QCSfM