[PR #6018] [CLOSED] fix(wasm): preserve caller cancellation reason during active WABT inspection (#6002) #7123

Closed
opened 2026-11-01 21:45:33 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6018
Author: @Totopo27
Created: 10/21/2026
Status: ❌ Closed

Base: main ← Head: fix/6002-wabt-cancellation-caller-reason


📝 Commits (1)

  • ace786a fix(wasm): preserve caller cancellation reason during active WABT inspection (#6002)

📊 Changes

2 files changed (+28 additions, -1 deletions)

View changed files

📝 src/wasm/WabtFailures.test.ts (+24 -0)
📝 src/wasm/WabtFailures.ts (+4 -1)

📄 Description

Summary

Fixes #6002.

Active WABT command cancellation through WabtArtifactProvider.inspect returned AnalysisCancelledError, but its direct cause was the internal OwnedCommandFailure wrapper rather than the supplied caller abort reason, even though the command owner already captured and retained cancellation.reason. classifyWabtFailure now unwraps and preserves cause.cancellation?.reason as the direct error cause on the cancelled branch.

Problem and expected behavior

When an active WABT command is cancelled via an AbortSignal, OwnedCommand catches the abort, settles the process, and stores the caller's cancellation reason in OwnedCommandFailure.cancellation.reason. However, WabtFailures.ts constructed new AnalysisCancelledError("inspect_wasm_artifact", options) where options.cause remained the OwnedCommandFailure instance.

Expected behavior: AnalysisCancelledError.cause must reflect the caller's exact abort reason, consistent with the tool design lifecycle contract and other providers.

Change and scope

  • In src/wasm/WabtFailures.ts:
    • When cause.reason === "cancelled", pass cause: cause.cancellation?.reason to AnalysisCancelledError.
  • In src/wasm/WabtFailures.test.ts:
    • Added unit test asserting that cancelling an active WABT command preserves the exact caller cancellation reason in failure.cause.
    • Updated probe assertion to verify cause on cancelled probe commands when no caller reason was supplied.

Ordinary bugfix within WABT failure classification; maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: WABT failure classifier (src/wasm/WabtFailures.ts).
  • Contribution scope fit and linked maintainer decision: not applicable (bugfix).
  • CLI and MCP/tool-catalog contract: Unchanged schema. Cancellation continues to report code cancelled / AnalysisCancelledError.
  • Provider, bridge, target-format, or platform compatibility: Cross-platform WABT provider.
  • Evidence, artifact, provenance, or reconstruction contract: Preserves lifecycle cancellation provenance without changing artifact evidence.
  • Target selection, authority, upstream behavior, and cleanup details: Read-only inspection; no process mutation.
  • Generated metadata, package, or installation impact: None.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: src/wasm/WabtFailures.test.ts.
  • Executed: npm run test:local -- src/wasm/WabtFailures.test.ts — 15 passed clean.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:local -- src/wasm/WabtFailures.test.ts — 15 passed.
  • npm run check:fast (typecheck & lint via Turbo) — 2 successful, 0 errors.
  • npx oxfmt --check src/wasm/WabtFailures.ts src/wasm/WabtFailures.test.ts — clean formatting.

Compatibility, safety, and release

  • Breaking changes or migration steps: None.
  • Real Hopper/Ghidra, browser, or OS coverage: Cross-platform pure TypeScript failure classification.
  • Package or release metadata impact: None.
  • Security, privacy, process, or containment review: Safe error classification unwrapping.

Author readiness

Human owner: @Totopo27

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6018 **Author:** [@Totopo27](https://github.com/Totopo27) **Created:** 10/21/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/6002-wabt-cancellation-caller-reason` --- ### 📝 Commits (1) - [`ace786a`](https://github.com/morluto/rea/commit/ace786a05e6c8b58669c236d889bd0d80db7154b) fix(wasm): preserve caller cancellation reason during active WABT inspection (#6002) ### 📊 Changes **2 files changed** (+28 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/wasm/WabtFailures.test.ts` (+24 -0) 📝 `src/wasm/WabtFailures.ts` (+4 -1) </details> ### 📄 Description ## Summary Fixes #6002. Active WABT command cancellation through `WabtArtifactProvider.inspect` returned `AnalysisCancelledError`, but its direct cause was the internal `OwnedCommandFailure` wrapper rather than the supplied caller abort reason, even though the command owner already captured and retained `cancellation.reason`. `classifyWabtFailure` now unwraps and preserves `cause.cancellation?.reason` as the direct error cause on the cancelled branch. ## Problem and expected behavior When an active WABT command is cancelled via an `AbortSignal`, `OwnedCommand` catches the abort, settles the process, and stores the caller's cancellation reason in `OwnedCommandFailure.cancellation.reason`. However, `WabtFailures.ts` constructed `new AnalysisCancelledError("inspect_wasm_artifact", options)` where `options.cause` remained the `OwnedCommandFailure` instance. Expected behavior: `AnalysisCancelledError.cause` must reflect the caller's exact abort reason, consistent with the tool design lifecycle contract and other providers. ## Change and scope - In `src/wasm/WabtFailures.ts`: - When `cause.reason === "cancelled"`, pass `cause: cause.cancellation?.reason` to `AnalysisCancelledError`. - In `src/wasm/WabtFailures.test.ts`: - Added unit test asserting that cancelling an active WABT command preserves the exact caller cancellation reason in `failure.cause`. - Updated probe assertion to verify `cause` on cancelled probe commands when no caller reason was supplied. Ordinary bugfix within WABT failure classification; maintainer scope decision is not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: WABT failure classifier (`src/wasm/WabtFailures.ts`). - Contribution scope fit and linked maintainer decision: not applicable (bugfix). - CLI and MCP/tool-catalog contract: Unchanged schema. Cancellation continues to report code `cancelled` / `AnalysisCancelledError`. - Provider, bridge, target-format, or platform compatibility: Cross-platform WABT provider. - Evidence, artifact, provenance, or reconstruction contract: Preserves lifecycle cancellation provenance without changing artifact evidence. - Target selection, authority, upstream behavior, and cleanup details: Read-only inspection; no process mutation. - Generated metadata, package, or installation impact: None. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `src/wasm/WabtFailures.test.ts`. - Executed: `npm run test:local -- src/wasm/WabtFailures.test.ts` — 15 passed clean. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:local -- src/wasm/WabtFailures.test.ts` — 15 passed. - `npm run check:fast` (typecheck & lint via Turbo) — 2 successful, 0 errors. - `npx oxfmt --check src/wasm/WabtFailures.ts src/wasm/WabtFailures.test.ts` — clean formatting. ## Compatibility, safety, and release - Breaking changes or migration steps: None. - Real Hopper/Ghidra, browser, or OS coverage: Cross-platform pure TypeScript failure classification. - Package or release metadata impact: None. - Security, privacy, process, or containment review: Safe error classification unwrapping. ## Author readiness Human owner: @Totopo27 - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:45:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7123
No description provided.