Skip to content

fix(typescript): stop repair packets borrowing an assertion that cannot see the change - #3942

Merged
EffortlessSteven merged 5 commits into
mainfrom
claude/language-quality-kairya
Sep 24, 2026
Merged

EffortlessSteven merged 5 commits into
mainfrom
claude/language-quality-kairya

Conversation

@claude

@claude claude Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steven · project thread

Summary

Before: in a JS/TS repo where parseLimit gains throw new TypeError('invalid limit') and the only related test is expect(parseLimit('10')).toBe(10), ripr check reported repair packet ready: true ("complete … delegatable") and the repair action said "add or strengthen the focused assertion expect(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's toBeGreaterThan(50) as the target expect(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 discriminator amount == threshold in the related test, shaped like expect(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_seam filter 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 the expected placeholder 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 ratelimit repro went from 2 ready packets to 0, and pricing/grades stayed at 0.

Swarm / Source Boundary

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

Source-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

  • TypeScript preview oracle metadata and repair-packet projection wording.

Scope Classification

  • One production behavior

Production delta:

  • collect_oracle_metadata_evidence_lines takes the probe family and skips assertions whose kind cannot observe it.
  • typescript_gap_record_for builds assertion_shape as expect(<borrowed call>).toBe(expected) / .toThrow(expected).
  • actionable_repair_route leads with the missing discriminator.

Evidence/support delta:

  • New negative fixture ts_repair_packet_wrong_family_oracle.

Single acceptance criterion:

  • A TS error-path change whose only related oracle is an exact-value assertion does not emit repair_packet_ready: true.

Non-goals:

  • The other TS findings from the walkthrough (predicate changes credited exposed whenever any strong assertion exists, heuristic same-file links rating untested functions weakly_exposed, class-instance receivers set up in beforeEach getting no_static_path). Each moves goldens and is a separate claim.

Decisions (overrule on review)

  • Placeholder instead of a literal. Considered emitting a new typescript_oracle_matcher evidence 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). expected matches the Rust shapes (assert_eq!(price(threshold), expected)).
  • Filter at the producer, not in the projection. The metadata lines are also read by LSP and gap-ledger surfaces, and a wrong-family "observed/expected" pair is wrong everywhere, so the fix sits where the lines are made.
  • Side effect accepted: typescript_broad_tothrow and typescript_tothrow_exact_oracle (predicate probes whose only assertion is toThrow) 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

  • none

Policy Impact

  • none

Proof

cargo test -p ripr --lib -- typescript preview          # 441 passed
cargo test -p xtask -- typescript_preview_repair_loop typescript_preview_false_actionable   # 4 passed
cargo xtask goldens check                                # pass
cargo clippy -p ripr --all-targets -- -D warnings       # pass
cargo xtask precommit                                    # exit 0
  • oracle_metadata_is_not_borrowed_from_a_wrong_family_assertion fails 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_literal pins expect(applyDiscount(100, 100)).toBe(expected).
  • Goldens reblessed with reasons: 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.
  • Hosted: Rust gates green on af9a94e.
  • ub-review (advisory) reported that its own artifact-verifier sensor exited 2 and that its model proof intent failed validation. Both are inside the reviewer; artifact-verifier is not defined in this repository and the finding itself says no blocker is implied. Its one substantive challenge (the expected placeholder) it refuted itself. CodeRabbit skipped the PR (bot author), so external review is missing, not clean.
  • Not run: full workspace tests, the LSP editor path, and actually running jest.

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

  • Spec: RIPR-SPEC-0087, RIPR-SPEC-0104
  • Tests: analysis/language/typescript/tests.rs, output/typescript_packet_projection.rs, output/preview_actionability.rs
  • Code: typescript/oracle.rs, typescript/classifier.rs, output/typescript_packet_projection.rs, output/preview_actionability.rs
  • Golden outputs: listed above

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.

CI Economics

n/a

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code or tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_018QP9k41E538Xgytw8QCSfM

…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
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 9a0250e4-1cc1-4d05-8fc0-775ab724331f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

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

@claude
claude Bot requested a review from EffortlessSteven September 23, 2026 04:47

@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

  • 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.
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review September 24, 2026 10:50
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@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 verification checks before upstream.

Verification questions

  • Confirm typescript_target_assertion_shape only branches on ErrorPath vs _. Probe families like Mutation or SideEffect will 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_route precedence now puts the discriminator first when both discriminator and shape are present. With no discriminator, the new arm add 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 (ratelimit 2 → 0, pricing/grades stayed 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 precommit and 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.
@EffortlessSteven
EffortlessSteven merged commit fe2e2a9 into main Sep 24, 2026
22 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/language-quality-kairya branch September 24, 2026 14:12
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants