Skip to content

fix(typescript): credit done-settled callbacks and old-value boundary pins (#9496) - #10145

Merged
EffortlessSteven merged 30 commits into
mainfrom
claude/project-thread-yr9dus-mocha
Oct 25, 2026
Merged

EffortlessSteven merged 30 commits into
mainfrom
claude/project-thread-yr9dus-mocha

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

  • Successor to fix(typescript): credit done-settled callbacks and old-value boundary pins (#9496) #9627, which had no required run and a stale base. Same change, main merged in (one conflict, the TypeScript spec-coverage floor).
  • Reads a callback that must call done() for a mocha test to pass as the test's own assertions (RIPR-SPEC-0246 rule 9) and keeps the boundary witness when the expectation pins the unchanged value (rule 10).
  • Moves mocha-done-callback-value and mocha-nested-describe-boundary from false actionable to credited. TypeScript false verdicts 9/351 to 7/351; floor 154.

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-0246 (rules 9, 10; examples 17, 18)
Governing issue or accepted claim: #9496
Acceptance delta (one sentence): two TypeScript false-actionable corpus rows read exposed.

Candidate Relationships

Candidate branch: claude/project-thread-yr9dus-mocha
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): replaces #9627 (same commits plus a main merge); #9627 to be closed once this merges.
Acceptance retained from a replaced candidate (if any): all of #9627's review of record.

Scope

  • classifier.rs expected_side_is_live, oracle.rs collect_done_callback_assertions, tests_extract.rs skipped-describe finder, spec, corpus rows.

Scope Classification

  • One production behavior

Production delta: rules 9 and 10 (fail closed on any shape that can skip the assertion).

Evidence/support delta: 2 rows blessed, 2 known-false entries removed, floor 154.

Single acceptance criterion: verdict-corpus check --language typescript shows the two rows ideal.

Non-goals: #9667 rows, the mocha hook credit design.

Support-tier Impact

  • none

Policy Impact

  • none

Proof

cargo xtask verdict-corpus check --language typescript   # exit 0, 7/351 false, 0 contradictions
cargo xtask precommit                                    # exit 0

Unit tests for rules 9 and 10 with 15 discriminating negatives are in the PR (inherited from #9627).

Claim Boundary

Static evidence only; no runtime mutation claim.

Rollback

Revert the squash commit and re-bless the two rows.

Static Language Check

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

Generated by Claude Code

claude and others added 26 commits October 22, 2026 08:57
…raction

A registration inside describe.skip/todo or a describe with a skip option never
runs and is not a dropped one; stop disclosing it as language_scope_unsupported.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
… pins

Rule 5 collects assertions of a callback that must call done() for a mocha test
to pass. Rule 6 keeps the boundary witness when the expectation pins the
unchanged value (fails against the changed code). Flips mocha-done-callback-value
and mocha-nested-describe-boundary.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
…entries

Removes mocha-done-callback-value and mocha-nested-describe-boundary (fixed here)
and the six rows #9591 also removes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
… suites

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
…key voids skip:true

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
…r dropped registrations

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYoh4Y4M2kQ1KXCn8TtBqE
Main landed the sibling #9496 rules (mocha hook = 7, counted loop = 8) in
RIPR-SPEC-0246 while this branch still numbered the done-callback and
boundary-pin rules 7 and 8. Union resolution: main's rules 7 and 8 keep
their numbers; the done-callback rule is renumbered to 9 and the boundary
rule to 10; acceptance examples renumber to 16 (hook), 17 (done) and
18 (boundary); corpus case citations and code comments follow. The
spec-coverage floor keeps the branch's 134 (union coverage is 137).
Local proof: cargo fmt --check; cargo clippy -p ripr --all-targets
--locked -- -D warnings (with -A unused-mut for the inherited
#[cfg(unix)]-only doctor.rs artifact identical to main); targeted tests
for rules 7, 8, 9, 10 all pass; xtask policy cascade passes;
verdict-corpus validate: 137/138 covered, above floor 134.
…d unterminated

#8990 landed the 0288 entry without its outputs closing bracket and
metrics list, so .ripr/traceability.toml fails to parse and
check-traceability fails on every open merge ref (main heads 5950c91,
ad1e3bb and 280e020 all ran red). Close the array and add the standard
unit_test_pass_rate metrics list. cargo xtask check-traceability passes
with this.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AnfxntsP9VxYNTBs5FukBi
Perl case PRs landed after #9628 measured 21, so verdict-corpus check
--language perl fails on main. Python and Rust fell; ceilings must equal
the blessed count.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AnfxntsP9VxYNTBs5FukBi
@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 24, 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 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 164 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: 5d7760c8-d92f-48ee-aa92-1dc38d787b89
Commits

Reviewing files that changed from the base of the PR and between 15d8b12 and 79b2f41.

Files selected for processing: 15
  • changelog.d/9627-ts-mocha-done-boundary-rows.md
  • crates/ripr/src/analysis/language/typescript/classifier.rs
  • crates/ripr/src/analysis/language/typescript/oracle.rs
  • crates/ripr/src/analysis/language/typescript/tests.rs
  • crates/ripr/src/analysis/language/typescript/tests/nested_callback_tests.rs
  • crates/ripr/src/analysis/language/typescript/tests_extract.rs
  • crates/ripr/src/analysis/language/typescript/tests_extract_tests.rs
  • docs/specs/RIPR-SPEC-0246-typescript-corpus-oracle-amendments.md
  • fixtures/typescript-verdict-corpus/cases/mocha-done-callback-value.json
  • fixtures/typescript-verdict-corpus/cases/mocha-nested-describe-boundary.json
  • fixtures/typescript-verdict-corpus/expected/rows/mocha-done-callback-value.json
  • fixtures/typescript-verdict-corpus/expected/rows/mocha-nested-describe-boundary.json
  • fixtures/typescript-verdict-corpus/known-false/mocha-done-callback-value.toml
  • fixtures/typescript-verdict-corpus/known-false/mocha-nested-describe-boundary.toml
  • fixtures/typescript-verdict-corpus/spec-coverage.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copy link
Copy Markdown
Member Author

Required run Ripr Rust Small on GitHub Hosted / Rust gates failed on head d91bf23 with one test: xtask reports::verdict_corpus::known_false::tests::committed_ceilings_equal_the_blessed_missed_credit. It is not this PR's: it fails identically on main, where #9628 set the Perl missed_credit_ceiling to 21 and the blessed rows now hold 23. The fix is #10140 (open, merge-ready), which re-counts all four ceilings. This PR does not change the TypeScript missed-credit count (the two moved rows were false actionable, not abstained). Once #10140 lands I will merge main into this branch and re-run the required check.


Generated by Claude Code

@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

  • Skipped describe detection does not recognize an aliased or indirect describe reference, so registrations inside such skipped suites may still be reported as partial extraction.
  • Rule 9 can credit assertions when the test's done parameter is aliased and the callback calls the alias.
  • Skipped-suite detection treats any receiver named describe as Mocha and can suppress genuine partial-extraction findings.

Verification questions

  • Confirm rule 9 tests cover many refusal shapes, but do not prove that the callback cannot complete the test through an alternate execution path before its assertions.
  • Confirm rule 9 credits assertions in any synchronous callback containing a bare done() call, even when the callee may never invoke that callback; a timeout then fails rather than allowing the test to pass, but the callback's assertions are not guaranteed to have run before settlement.

Refuted

  • The receiver-name guard is insufficient because done may occur in unrelated source text.; refuted because: The implementation intentionally over-counts strings and comments, causing refusal rather than false credit; callback parameter and declaration shadowing are separately rejected.

Evidence gaps

  • The PR body claims the TypeScript corpus check exits 0 and that precommit passes, but the shared packet records rip r failure and no completed cargo-test receipt.
  • Model proof intent was rejected by deterministic validation.
  • The required cargo-test receipt and the failed ripr diagnostic are needed to validate the new corpus rows and ceiling changes.

Copy link
Copy Markdown
Member Author

Response to the github-actions review on head 1237d72, checked against current source.

Rule 9, aliased done (refuted). collect_done_callback_assertions credits only a top-level bare done() call in a callback, and only when receiver_named_once holds (oracle.rs, AssertionContext::receiver_named_once: done appears exactly once in the whole test body). An alias (const finish = done; ... finish()) names done a second time, so the rule refuses before it looks at the callback. finish() is also not is_bare_call_of(.., "done"). Neither route credits.

Rule 9, callee may never invoke the callback (documented, fail-safe). The rule 9 doc comment and RIPR-SPEC-0246 state this: a callback the callee never invokes times out and fails the test, it never passes it. The credited assertions are the ones that must hold for the test to pass, so no false credit follows.

Skipped describe via alias or indirect reference, and any receiver named describe (accepted, low severity). callee_is_skipped_describe resolves describe by name, the same way every other active-declaration check in tests_extract.rs does (TestDeclarationRoot::matches_identifier). Two effects: an aliased skipped suite is not recognized, so it falls through to the existing partial-extraction report (conservative); a non-Mocha object named describe with .skip can suppress a partial-extraction notice for a registration inside it. That notice is an advisory gap, and the branch never grants credit or changes a verdict. Making the resolver binding-aware is a change to the shared declaration resolver, not to this PR; I will file it as a separate issue.

Evidence gaps. The ripr sensor failure and missing cargo-test receipt are runner artifacts of this lane. Local receipts on this head: cargo test -p ripr --lib analysis::language::typescript 1599 passed, 0 failed. The one other lib failure locally is the fixture-deps environment gap in seam_inventory. The CI lane failure on this head was the unrelated ETXTBSY flake in agent::artifact (#10168); the lane has been re-run.


Generated by Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AnfxntsP9VxYNTBs5FukBi

@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

  • Rule 9 credits assertions that may run after the test has already settled.
  • Skipped-describe detection can suppress unrelated active registrations.
  • Rule 9 treats any first test parameter as a Mocha-style done callback, without requiring the test framework or callback convention.
  • Skipped-suite detection resolves describe by identifier name, so an unrelated helper named describe can suppress partial-extraction findings.
  • The receiver_named_once guard counts done across the entire test body, so a second occurrence in a comment, string, sibling scope, or unrelated code prevents all rule-9 credit. This is broader than the stated callback-settlement invariant and can create false negatives; consider restricting the guard to executable references relevant to alternate settlement paths, or explicitly documenting the conservative whole-body scope. (crates/ripr/src/analysis/language/typescript/oracle.rs:190).

Verification questions

  • Confirm receiver_named_once counts identifiers in strings and comments, so a harmless mention of done can suppress valid callback assertion credit.
  • Confirm rule-9 credit is gated by whole-test-body identifier count, so an unrelated occurrence of the receiver name refuses otherwise valid callback assertions.

Refuted

  • A callback passed to a call but never invoked by the callee can make the test pass without the assertions.; refuted because: Under the documented Mocha done contract, an uncalled callback leaves the test pending until timeout, which fails rather than passes; the callback assertions therefore do not create a passing-path false credit.
  • The callback may never be invoked, so credited assertions are not necessarily part of test passage.; refuted because: Refuted by the rule-9 contract and implementation: a callback that never calls done() times out and fails rather than passing; aliased or indirect done calls are refused by the guard.
  • Rule 9 could credit assertions in a callback that the callee never invokes, making a timeout look like a passing test.; refuted because: The documented oracle treats an uninvoked callback as timing out and failing rather than passing; the implementation also requires a top-level done() settlement path. Static evidence does not prove runtime runner behavior, so this is residual rather than a confirmed defect.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Response to the second github-actions review on #10145 (rule 9 and skipped describe), checked against oracle.rs and tests_extract.rs.

Assertions run after the test settled (refuted). Only statements before the top-level done() are collected (statements.iter().take(settles_at)), and only when every earlier statement is an expression or declaration. Anything after the settle call, or behind a return, throw, if, try or loop, is not collected.

Any first test parameter read as done (no false credit). The receiver is the test callback's first parameter, but credit also needs a bare, argument-less <receiver>() call at the top level of a nested callback. A Vitest context object or a Jest fixture is not callable, so that call would throw and fail the test, never settle it. Name-based reading means such a test is refused or fails closed; it cannot turn into credit for an assertion that did not run.

receiver_named_once counts strings and comments (intended, conservative). The helper identifier_occurrences documents it: "counting any in strings and comments too (over-counting only refuses credit)". The cost is a missed advisory when done is mentioned elsewhere in the test, never a false credit. I am keeping the whole-body scope rather than parsing executable references, because a narrower count would need its own proof that a second settle path cannot hide.

Skipped describe resolved by name. Already answered above and tracked in #10169; it only affects an advisory partial-extraction notice.

No code change for this review.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Review of record — head 2670866 (main 6212bda merged in).

  • Correctness/edge cases: rule 9 collects only statements before a top-level bare done(), refuses async/generator callbacks, shadowed done, any branch/return/throw/loop before it, and any second mention of done in the test (receiver_named_once). Rule 10 keeps the boundary witness only when the expectation pins the unchanged value. Both fail closed.
  • Tests/regressions: cargo test -p ripr --lib analysis::language::typescript 1599 passed, 0 failed (local, on the pre-merge head; the CI Rust-only lane is green on this head); verdict-corpus check --language typescript exit 0, 7/351 false, 0 contradictions, floor 154; committed_ceilings_equal_the_blessed_missed_credit passes.
  • Spec/contract: RIPR-SPEC-0246 rules 9 and 10 and examples 17 and 18 match the code; no output or schema change.
  • CI: Ripr Rust Small Result success on this head, with the Rust-only lane, paste, windows subset and wheel jobs green.
  • Findings: two github-actions reviews (comments 6392202532 and earlier): none confirmed as a false-credit path; the whole-body done count and name-based describe resolution are conservative; the latter is ts: skipped-describe detection resolves describe by name, not by binding #10169. The earlier lane failure was the unrelated ETXTBSY flake (test(agent): unlinked_running_executable_renders_bare_ripr_through_production_path flakes with ETXTBSY on Linux CI #10168), re-run green.
  • Resolutions: no code change after the review of record; no open inline threads.

Generated by Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AnfxntsP9VxYNTBs5FukBi
@github-actions

Copy link
Copy Markdown
Contributor

merge-ready is set, but this PR conflicts with main (head 26708660), so GitHub creates no test-merge ref and no qualification run can start. Merge main into the branch and resolve the conflicts, then remove and re-apply merge-ready.

@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 rule 9 can credit assertions from a callback even when the test body also contains a direct done() settlement path in a form not counted by the whole-body identifier guard.
  • Confirm skipped-describe detection resolves describe by identifier name and does not recognize aliased or indirect references.

Parked follow-ups

  • Skipped-suite recognition is intentionally syntactic and name-based, leaving a known false-negative surface for unrelated describe-shaped helpers.

Evidence gaps

  • Fresh execution evidence for the changed Rust behavior and corpus acceptance remains trust-relevant because cargo-test is only scheduled-late.
  • Model proof intent was rejected by deterministic validation.
  • Skipped describe detection and its corpus relabeling are aligned with the stated acceptance delta, but the automated ripr sensor exited with code 2 and is not usable as positive proof.

Copy link
Copy Markdown
Member Author

Review of record, addendum — head 79b2f41. The review of record on 2670866 still holds for the production code; this head only merges main after #10156 landed.

  • Changes since 2670866: main merged (TypeScript floor conflict resolved by recount: 159/159 covered, floor 159).
  • Proof on this head: verdict-corpus check --language typescript exit 0, 1/352 false, 0 contradictions; cargo test -p xtask --bin xtask verdict_corpus 151 passed; Ripr Rust Small Result success.
  • Findings: the further github-actions reviews repeat points already answered (whole-body done count, name-based describe, tracked in ts: skipped-describe detection resolves describe by name, not by binding #10169). No open inline threads.

Generated by Claude Code

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