Skip to content

fix(analysis): contain a language adapter panic as a typed failed run (#11132) - #11163

Merged
EffortlessSteven merged 4 commits into
mainfrom
claude/11132-parse-worker-containment
Oct 30, 2026
Merged

EffortlessSteven merged 4 commits into
mainfrom
claude/11132-parse-worker-containment

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven Zimmerman · project thread

Summary

  • A panic or unwind inside a language adapter (or an AST consumer it drives) no longer ends check, pilot, the LSP sidecar or the MCP server. contain_adapter_panic in analysis/pipeline.rs wraps each adapter call in diff and repo scope; a preview adapter panic becomes a Failed language run with a typed adapter_panicked reason, sibling languages' findings are kept, and the failed adapter's output is discarded whole (so it can never yield an actionable repair signal). A Rust adapter panic becomes the typed analysis failure Rust failures already were.
  • A parse-worker failure while extracting an unchanged TypeScript test file is now disclosed as the typed typescript_test_extraction_partial limitation instead of silently dropping that file's tests (which could read as a false no_static_path).
  • Native stack exhaustion is a signal, not an unwind, and is not caught; the existing per-language nesting budgets keep that class out of the parsers (not changed here).
  • Test-only fault injection (cfg(test)) drives the production paths; tests cover diff and repo pipelines, TypeScript parse worker, LSP refresh and MCP refresh.

Source-of-truth Links

Spec: RIPR-SPEC-0177
Governing issue or accepted claim: #11132 (claim comment on the issue; split from #10724)
Acceptance delta (one sentence): An adapter panic surfaces as a typed limitation per surface and the process survives, with a regression test per surface.

Proof

  • cargo fmt --check: exit 0.
  • Not established locally: the ripr lib-test target could not be compiled in the sandbox (rustc SIGKILLed by the memory cap on three attempts), so none of the new tests, clippy --all-targets or cargo xtask precommit ran locally. Hosted exact-head CI is the only execution evidence; no qualification or merge is requested yet.

Limitations and non-claims

  • Static-analysis containment only; no runtime mutation claim.
  • No release, publication, credential or permission change.

Rollback boundary

Revert this PR; tests, spec text, traceability and the changelog fragment revert with it.


Generated by Claude Code

@EffortlessSteven EffortlessSteven self-assigned this Oct 30, 2026
@coderabbitai

coderabbitai Bot commented Oct 30, 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 10 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: af1a97f9-3871-470d-8856-a51526e0a3f9
Commits

Reviewing files that changed from the base of the PR and between ea68ea0 and c122777.

Files selected for processing: 12
  • .ripr/traceability.toml
  • changelog.d/11132-adapter-panic-containment.md
  • crates/ripr/src/analysis/language/typescript/extraction_cache.rs
  • crates/ripr/src/analysis/language/typescript/mod.rs
  • crates/ripr/src/analysis/language/typescript/parse.rs
  • crates/ripr/src/analysis/language/typescript/tests.rs
  • crates/ripr/src/analysis/mod.rs
  • crates/ripr/src/analysis/pipeline.rs
  • crates/ripr/src/lsp/tests.rs
  • crates/ripr/src/mcp/server_tests.rs
  • docs/specs/RIPR-SPEC-0177-typescript-parse-depth-budget.md
  • policy/process_allowlist.d/11132-mcp-adapter-panic-test.txt
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements panic containment for language adapters (issue #11132) to prevent internal panics from crashing the entire analysis run. Preview adapters (TypeScript, JavaScript, Python, Perl) that panic are now recorded as failed runs with an 'adapter_panicked' reason, preserving findings from other languages, while Rust adapter panics are propagated as typed analysis failures. Additionally, parse-worker failures during TypeScript test extraction are now properly disclosed as 'typescript_test_extraction_partial' limitations rather than silently dropping tests. The changes include robust test-only fault injection utilities and comprehensive unit and integration tests to verify containment behavior across diff, repo, and MCP server scopes. There are no review comments to address, and the implementation looks solid.

@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.

Verification questions

  • Confirm mCP refresh containment test checks for the analysis_failed vocabulary but does not assert the adapter_panicked cause or absence of a published/committed snapshot.
  • Confirm lSP containment test has a disjunctive oracle that does not uniquely require the typed adapter_panic failure.
  • Confirm the new failure-disclosure path reports a worker error string as bounded limitation detail, potentially exposing parser-generated repository text through analysis output.
  • Confirm the LSP regression permits either an error or an Ok response containing no findings, so it does not prove the advertised typed-failure contract on every supported surface.

Refuted

  • Catch_unwind could expose partially initialized adapter state or retain findings from a panicked adapter.; refuted because: The adapter call is enclosed as a single Result-producing closure; a panic discards that Result entirely, and preview failures are represented by a Failed language run without findings.
  • The sibling-path concern requires changes to crypto, compression, or another unrelated runtime helper family.; refuted because: The changed behavior is localized to language-adapter panic containment and TypeScript parse/test-extraction failure disclosure; the reviewed sibling surfaces show no parallel helper route that changes the same invariant.
  • A failed worker could silently produce a false no_static_path result.; refuted because: Extraction failures are returned with a reason and converted into a typed extraction gap before related-test analysis.

Evidence gaps

  • The new cargo-test receipt is the remaining executable proof needed to validate the containment and recovery regressions at this exact head.
  • The strongest open objection is execution, not a demonstrated code defect: cargo-test is pending and ripr exited with code 2.
  • Exact-head regression execution is still needed because the ripr sensor failed and cargo-test was scheduled rather than completed in the supplied packet.
  • Model proof intent was rejected by deterministic validation.

Parked follow-ups

  • The cache path preserves the worker's error reason but does not expose whether a cached extraction can itself carry an extraction failure.

@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 c122777): REVIEW_INCOMPLETE

Inspected:

  • PR #11163 head c122777 (claude/11132-parse-worker-containment), base main, 12 files: crates/ripr/src/analysis/pipeline.rs (+312/-29), crates/ripr/src/analysis/language/typescript/parse.rs (+53), crates/ripr/src/analysis/language/typescript/tests.rs (+136), crates/ripr/src/analysis/language/typescript/extraction_cache.rs (+27/-5), crates/ripr/src/analysis/language/typescript/mod.rs (+15/-1), crates/ripr/src/analysis/mod.rs (+2), crates/ripr/src/lsp/tests.rs (+67), crates/ripr/src/mcp/server_tests.rs (+108), docs/specs/RIPR-SPEC-0177-typescript-parse-depth-budget.md (+11/-1), .ripr/traceability.toml (+10), changelog.d/11132-adapter-panic-containment.md (+14), policy/process_allowlist.d/11132-mcp-adapter-panic-test.txt (+1). Four commits: 948b04c2, f2262b80, 89baf439, c122777d. All source read via the GitHub API at the head SHA.
  • Prior review evidence on all three surfaces: pulls/11163/reviews has two bot reviews (gemini-code-assist[bot] on 948b04c2, 854 chars; github-actions[bot] on 89baf439, 2240 chars), pulls/11163/comments empty, issues/11163/comments one coderabbit rate-limit notice. Both bot reviews are bound to ancestor commits, so neither covers the head; the head commit c122777d is unreviewed by anyone. The github-actions[bot] review raised four verification questions and one parked follow-up, none of which has a reply or a repair on this PR, so all are still open leads rather than disposed findings. I verified each against the head source and mark them below.
  • Production path at head: contain_adapter_panic and the injected_adapter_panic harness (pipeline.rs:67-137), the four diff-scope wrappers (pipeline.rs:1436, 1587, 1596, 1604), the four repo-scope wrappers (pipeline.rs:2373, 2401, 2409, 2412), perl_run_status_for_err (pipeline.rs:3061-3066), the worktree pipeline's two branches (pipeline.rs:472, 542), the parse-worker join and its fault injector (typescript/parse.rs:312-336, 339-390), test_extraction_cached_disclosing (typescript/extraction_cache.rs:454-517), the disclosure site (typescript/mod.rs:765-782), and the limitation producer (typescript/static_limit.rs:68-91).
  • Oracle: the three new TypeScript tests (typescript/tests.rs:17211-17345), the three new pipeline tests (pipeline.rs:5863-6040), the LSP containment test (lsp/tests.rs:14264-14325), and the MCP containment test (mcp/server_tests.rs:1776-1866), plus their controls.
  • Hosted proof at the head SHA: run 41078794399 "Merge-ready request c122777". The Rust gates job (124142525974) is green — Formatting preflight, Repository policy preflight, Evidence promotion honesty, Dependency/Process/Network policy, All-features target check, Strict workspace Clippy, Golden output contracts, Fixture contracts, Verdict corpora, Base still merges cleanly, Required Rust doctests, Schema producer sweep, PR evidence all success. The four Rust tests shard N of 4 jobs (124159598531/535/678/679) were still in_progress when I checked, and the check-run for Ripr Rust Small on GitHub Hosted / Rust gates was in_progress at first poll.

Blocking:

  • None found.

The containment is placed at the right boundary and is complete across the surfaces the PR claims. contain_adapter_panic (pipeline.rs:67-84) wraps each adapter call and converts a panic into a typed Err whose reason begins with ADAPTER_PANIC_REASON_PREFIX; the adapter's Result is dropped whole, so a contained adapter can never contribute a finding, let alone an actionable one. I checked the three pipeline entry points rather than trusting the diff: run_pipeline_for_diff_text_with_language_config and run_repo_pipeline_with_oracle_policy_and_rust_config are wrapped directly, and the third entry point, run_worktree_pipeline_with_oracle_policy_and_rust_config (pipeline.rs:426), delegates to the wrapped diff pipeline on both branches — the DisclosureProbes::Skip branch the LSP uses (pipeline.rs:472) and the probe-overlap branch the MCP and CLI use (pipeline.rs:542). So the LSP sidecar and the MCP server are covered transitively, as the PR body claims. The scoped probe worker is handled separately and fails closed with a disclosure rather than propagating (pipeline.rs:551-562). panic = "abort" is not configured anywhere — the workspace [profile.release] sets only lto, strip, and codegen-units — so catch_unwind is effective in the released binary; this matters because the containment would be silently inert under an abort profile, and it is worth a regression guard because the guarantee now depends on a profile setting. The fault injection is #[cfg(test)] at every site (pipeline.rs:88-89, typescript/parse.rs:339-340), so the shipped binary carries no injection hook.

The disposition is capped at REVIEW_INCOMPLETE because the Rust test shards were still running when I finished: the new tests have not been executed on this head by anyone. The PR body states the same limitation ("the ripr lib-test target could not be compiled in the sandbox ... Hosted exact-head CI is the only execution evidence"), so there is no local execution to fall back on either. The gates that are green do not execute the changed tests.

Non-blocking:

  • CORROBORATES the prior github-actions[bot] verification questions #2 and #4: the LSP containment test's oracle is disjunctive, so it does not uniquely require the typed failure. lsp/tests.rs:14302-14314 accepts either Err(failure) whose message contains adapter_panicked, or Ok(diagnostics) with an empty findings snapshot. The test arms LanguageId::Rust, and a Rust adapter panic is a typed Err in the pipeline (pipeline.rs:1436, propagated by ?), which the LSP maps to Err(WorkspaceAnalysisFailure { kind: AnalysisError }) through workspace_analysis_error_diagnostics (lsp/diagnostics.rs) — so the Err arm is the one that fires and the Ok arm is dead for the armed case. The defect is latent rather than present: a regression that turned the typed failure into a silent empty snapshot would take the Ok arm and still pass, so the LSP surface is not bound to the advertised typed-failure contract. The LSP test does have a proper control run (the unarmed refresh must produce findings) and a recovery run, so the containment and the sidecar's survival are both proven; what is missing is the uniqueness of the typed failure. Suggest requiring the Err arm for the Rust-armed case, since that is the branch the code actually takes.
  • The MCP containment test asserts only the analysis_failed vocabulary, not the adapter_panicked cause (mcp/server_tests.rs:1845), and analysis_failed is a shared code for several failure causes (mcp/workspace.rs:33, used at workspace.rs:253 and workspace.rs:501). This partially confirms the prior bot's question #1. The causal attribution is still reasonable because the same refresh on the same fixture succeeds once the injection is disarmed, which is asserted immediately after (mcp/server_tests.rs:1853-1861), so the failure cannot be an unrelated pre-existing condition. Pinning the cause string would make it exact.
  • The new TypeScript extraction gap repurposes two documented fields. TypeScriptTestExtractionGap (typescript/types.rs:434-441) documents shape as "one of template-literal title, tagged-template .each, or test/it call in loop/callback/nested body" and snippet as "Source snippet (single-line, bounded) of the unextracted registration". The new code (typescript/mod.rs:768-777) pushes shape: "test extraction unavailable (parse worker failed)" — outside that enumeration — and snippet: reason, where reason is a worker-failure reason string rather than a source snippet. The producer then renders "the recognized test file {} registers tests the syntax-first extractor drops ({shape}: {snippet})" (typescript/static_limit.rs:85), and a worker failure does not establish that the file registers tests at all, so the disclosure overstates what is known. This is fail-safe in the disclosure direction — the limitation is still a limitation, it never claims a class, and it prevents the false no_static_path the change targets — but the wording and the two field contracts should be corrected so the producer's sentence stays true.
  • REFUTES the prior github-actions[bot] verification question #3 ("the new failure-disclosure path reports a worker error string as bounded limitation detail, potentially exposing parser-generated repository text through analysis output"). At this head the reason reaching the new disclosure is only ever one of two constants: PARSE_WORKER_UNAVAILABLE = "static limit parse_worker_unavailable: TypeScript parse worker thread could not start", optionally suffixed with the thread-spawn io::Error, and PARSE_WORKER_FAILED = "static limit parse_worker_failed: TypeScript parse worker thread failed; syntax facts unavailable" (typescript/parse.rs:55-65, parse.rs:334-335). Neither carries repository text. The parser-error formatter that does quote source text — parse_error_reason, "N parser error(s): {diagnostic}" (typescript/parse.rs:67-86) — is a different function and does not feed this path: try_extract_tests_with_expansion only propagates an Err that satisfies is_worker_failure (typescript/tests_extract.rs:169, 343). The panic payload is likewise absent from the analysis output: contain_adapter_panic discards it and substitutes a fixed message (pipeline.rs:79-84). The payload does reach stderr through the installed panic hook, which the code documents rather than hides.
  • The cargo xtask check-no-panic-family gate is not part of the hosted Rust-gate lane, and cargo xtask precommit never ran locally for this PR, so that gate is unobserved by execution. I checked the changed lines against the gate's forbidden patterns — unwrap(, expect(, panic!, todo!, unimplemented!, unreachable! (xtask/src/no_panic.rs:191-203) — and found none; unwrap_or_default() does not match unwrap(, and catch_unwind/resume_unwind are not in the family. So the gate is unexecuted but not violated by inspection. The same applies to check-traceability; the registry entry the PR adds (traceability.toml, 8 new test entries) is consistent with the file's convention, and the gate explicitly does not require it (xtask/src/main.rs:6833).

Oracle assessment (what I could establish):

  • The TypeScript and pipeline tests are genuine discriminators, not tautologies. analyze_diff_contains_a_parse_worker_panic_on_a_changed_file asserts the limitation names the file and that every resulting finding is UnsupportedSyntax, StaticUnknown, and carries actionability_category: unsupported_syntax — the fail-closed direction is pinned, not merely "no crash". analyze_diff_discloses_a_test_extraction_worker_failure has a real control run (the same workspace with no worker failure discloses nothing) and then changes the test file's bytes to defeat the content-keyed cache before arming the worker with allow = 1, so the first parse (the file's facts) succeeds and the second (the dedicated test extraction) loses its worker. That is exactly the parked follow-up from the prior bot review ("the cache path preserves the worker's error reason but does not expose whether a cached extraction can itself carry an extraction failure"), and the head commit c122777d addresses it. parse_worker_panic_is_a_typed_refusal_not_a_process_failure additionally pins that a dead worker does not poison later parses. The pipeline tests carry a control too: diff_pipeline_contains_a_preview_adapter_panic first runs unarmed and requires the Python adapter to have produced Python findings, so "no Python finding" after the injection is attributable to the containment and not to a fixture that never reached Python.
  • The TypeScript disclosure actually reaches the limitation the spec and changelog promise. typescript_test_extraction_partial is the named-limitation producer that consumes TypeScriptTestExtractionGap (typescript/static_limit.rs:68-91, typescript/types.rs:430-433), and test_extraction_partial_limitation filters on nothing but the gap itself, so the new gap shape is not dropped. The promised name in docs/specs/RIPR-SPEC-0177-typescript-parse-depth-budget.md and in changelog.d/11132-adapter-panic-containment.md is the one that will be emitted.
  • The worker-failure cache semantics are correct for the disclosure: a failure is served empty and never stored, while a successful extraction is cached by content (typescript/extraction_cache.rs:498-517), so a failure is not memoized into a false "this file registers no tests".

Not run:

  • No local build, test, lint, or cargo xtask command: this host has no Rust toolchain (cargo/rustc absent from PATH) and the working tree is shared with concurrent agents. Every conclusion is from reading source at the head SHA through the GitHub API.
  • The Rust test shards were still in_progress when I finished, so I did not observe any of the eight new tests executing. I did not observe the PR body's local experiments, which the PR itself reports as never run.
  • I did not observe the ripr binary surviving a real adapter panic end to end; the fault injection is exercised only by the new unit tests, which have not executed yet.
  • I did not verify the claim that "the installed panic hook has already reported it on stderr" in a live run; I confirmed only that the payload is not echoed into the analysis output.

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

@EffortlessSteven
EffortlessSteven merged commit 1c7fd86 into main Oct 30, 2026
59 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/11132-parse-worker-containment branch October 30, 2026 16:10
EffortlessSteven added a commit that referenced this pull request Nov 1, 2026
…rse-projection example (#11163)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
EffortlessSteven added a commit that referenced this pull request Nov 1, 2026
…edit (#11630) (#11839)

* fix(python): coarse projections of an owner result earn no exposed credit (#11630)

An == over a comparison result, remainder, class name or text length
(and len over an element-only yield/comprehension edit) is shared by the
old and new value, so it cannot discriminate the change. Gate every
sink-alignment credit branch on RIPR-SPEC-0238 rule 30, with unit,
classify and honesty-corpus coverage.

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

* fix(python): narrow coarse-projection rule to remove false demotions (#11630)

Only top-level assert operands (and assertTrue/assertFalse arguments) apply
the pin reading; string-format % is not a remainder; len() coarse shapes
restricted to a closed allow-list (set/frozenset removed).

Not verified locally: build infeasible (disk full / OOM).

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

* test(python): record replayed toolchain for py-coarse corpus truth (#11630)

Replayed with real pytest: baselines pass; sign/residue/text-length mutants
pass, exact-control mutant fails test_exact_fee.

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

* fix(python): while-let in coarse len walk (clippy)

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

* fix(python): coarse-projection walk follows comprehensions, set/dict, ternary, lambda (#11630)

An owner call under a coarse projection inside these shapes now counts as
coarse; all/any over an equality element is an asserted pin. Unfollowed
shapes still count as direct reads (demotion needs proof).

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

* test(xtask): pin RIPR-SPEC-0238 at 43 in-scope examples after the coarse-projection example (#11163)

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

* docs(changelog): fragment for Python coarse-projection exposure demotion (#11839)

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

---------

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