Repository navigation
fix(analysis): contain a language adapter panic as a typed failed run (#11132) - #11163
Conversation
…#11132) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVmM4CaHprjJ7fB7t4P
|
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 10 minutes. View limit details
Comment |
There was a problem hiding this comment.
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.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVmM4CaHprjJ7fB7t4P
…11132) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVmM4CaHprjJ7fB7t4P
There was a problem hiding this comment.
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.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVmM4CaHprjJ7fB7t4P
EffortlessSteven
left a comment
There was a problem hiding this comment.
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/reviewshas two bot reviews (gemini-code-assist[bot]on948b04c2, 854 chars;github-actions[bot]on89baf439, 2240 chars),pulls/11163/commentsempty,issues/11163/commentsone coderabbit rate-limit notice. Both bot reviews are bound to ancestor commits, so neither covers the head; the head commitc122777dis unreviewed by anyone. Thegithub-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_panicand theinjected_adapter_panicharness (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 gatesjob (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 allsuccess. The fourRust tests shard N of 4jobs (124159598531/535/678/679) were stillin_progresswhen I checked, and the check-run forRipr Rust Small on GitHub Hosted / Rust gateswasin_progressat 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-14314accepts eitherErr(failure)whose message containsadapter_panicked, orOk(diagnostics)with an empty findings snapshot. The test armsLanguageId::Rust, and a Rust adapter panic is a typedErrin the pipeline (pipeline.rs:1436, propagated by?), which the LSP maps toErr(WorkspaceAnalysisFailure { kind: AnalysisError })throughworkspace_analysis_error_diagnostics(lsp/diagnostics.rs) — so theErrarm is the one that fires and theOkarm 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 theOkarm 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 theErrarm for the Rust-armed case, since that is the branch the code actually takes. - The MCP containment test asserts only the
analysis_failedvocabulary, not theadapter_panickedcause (mcp/server_tests.rs:1845), andanalysis_failedis a shared code for several failure causes (mcp/workspace.rs:33, used atworkspace.rs:253andworkspace.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) documentsshapeas "one oftemplate-literal title,tagged-template .each, ortest/it call in loop/callback/nested body" andsnippetas "Source snippet (single-line, bounded) of the unextracted registration". The new code (typescript/mod.rs:768-777) pushesshape: "test extraction unavailable (parse worker failed)"— outside that enumeration — andsnippet: reason, wherereasonis 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 falseno_static_paththe 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 thereasonreaching 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-spawnio::Error, andPARSE_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_expansiononly propagates anErrthat satisfiesis_worker_failure(typescript/tests_extract.rs:169,343). The panic payload is likewise absent from the analysis output:contain_adapter_panicdiscards 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-familygate is not part of the hosted Rust-gate lane, andcargo xtask precommitnever 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 matchunwrap(, andcatch_unwind/resume_unwindare not in the family. So the gate is unexecuted but not violated by inspection. The same applies tocheck-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_fileasserts the limitation names the file and that every resulting finding isUnsupportedSyntax,StaticUnknown, and carriesactionability_category: unsupported_syntax— the fail-closed direction is pinned, not merely "no crash".analyze_diff_discloses_a_test_extraction_worker_failurehas 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 withallow = 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 commitc122777daddresses it.parse_worker_panic_is_a_typed_refusal_not_a_process_failureadditionally pins that a dead worker does not poison later parses. The pipeline tests carry a control too:diff_pipeline_contains_a_preview_adapter_panicfirst 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_partialis the named-limitation producer that consumesTypeScriptTestExtractionGap(typescript/static_limit.rs:68-91,typescript/types.rs:430-433), andtest_extraction_partial_limitationfilters on nothing but the gap itself, so the new gap shape is not dropped. The promised name indocs/specs/RIPR-SPEC-0177-typescript-parse-depth-budget.mdand inchangelog.d/11132-adapter-panic-containment.mdis 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 xtaskcommand: this host has no Rust toolchain (cargo/rustcabsent 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_progresswhen 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
riprbinary 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.
…rse-projection example (#11163) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
…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>
Requested by Steven Zimmerman · project thread
Summary
check,pilot, the LSP sidecar or the MCP server.contain_adapter_panicinanalysis/pipeline.rswraps each adapter call in diff and repo scope; a preview adapter panic becomes aFailedlanguage run with a typedadapter_panickedreason, 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.typescript_test_extraction_partiallimitation instead of silently dropping that file's tests (which could read as a falseno_static_path).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.riprlib-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-targetsorcargo xtask precommitran locally. Hosted exact-head CI is the only execution evidence; no qualification or merge is requested yet.Limitations and non-claims
Rollback boundary
Revert this PR; tests, spec text, traceability and the changelog fragment revert with it.
Generated by Claude Code