[PR #1171] [MERGED] fix(artifacts): keep cancellation and the caller path in extraction refusals #2697

Closed
opened 2026-10-17 21:09:12 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1171
Author: @kaoru0822-kitauji
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/extraction-preflight-cancellation


📝 Commits (1)

  • eacf846 fix(artifacts): keep cancellation and the caller path in extraction refusals

📊 Changes

2 files changed (+41 additions, -16 deletions)

View changed files

📝 src/artifacts/extraction/ArtifactExtraction.ts (+14 -8)
📝 tests/boundary/providers/native/artifactProvider.extraction.test.ts (+27 -8)

📄 Description

Follow-up to #1161. This addresses its two post-merge review comments (r4226068955 and r4226068959).

Problem

#1161 added a format preflight to extract_artifact, so a DMG or PKG is refused before any inventory work. Two regressions came with it:

  1. Cancellation reported as unsupported. scanArtifactInventory was the first code to check the abort signal, and the preflight now runs before it. An already-cancelled extraction of a nonextractable format therefore returned unsupported_target instead of cancellation.
  2. Wrong path reported. The unsupported-format and encrypted-entry refusals reported the realpath. When the caller selected the target through a symlink, junction or other alias (which BinaryTargetResolver deliberately keeps in sourcePath), the diagnostic named a different path from the one the caller passed.

Change

  • extractArtifact checks the signal (abortIfNeeded) before the preflight, so cancellation wins over every later refusal.
  • Both AnalysisUnsupportedTargetErrors report input.inputPath. All I/O still uses the canonical path.

No schemas change.

Verification

  • artifactProvider.extraction.test.ts now extracts a DMG through a symlink alias: the refusal reports the alias path, and an already-cancelled request returns ArtifactOperationError / cancelled. Neither creates output. Both assertions fail on main.
  • All 12 test files that reference ArtifactProvider, extract_artifact or extraction: 167 passed.
  • npm run check:fast, npm run jscpd (2.49%)

No real Hopper or Ghidra verification was run, because this change does not touch those providers.

🤖 Generated with Claude Code


🔄 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/1171 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/extraction-preflight-cancellation` --- ### 📝 Commits (1) - [`eacf846`](https://github.com/morluto/rea/commit/eacf8461dad6bab11a3d5438e6db001a10f33a9b) fix(artifacts): keep cancellation and the caller path in extraction refusals ### 📊 Changes **2 files changed** (+41 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/extraction/ArtifactExtraction.ts` (+14 -8) 📝 `tests/boundary/providers/native/artifactProvider.extraction.test.ts` (+27 -8) </details> ### 📄 Description Follow-up to #1161. This addresses its two post-merge review comments (r4226068955 and r4226068959). ## Problem #1161 added a format preflight to `extract_artifact`, so a DMG or PKG is refused before any inventory work. Two regressions came with it: 1. **Cancellation reported as unsupported.** `scanArtifactInventory` was the first code to check the abort signal, and the preflight now runs before it. An already-cancelled extraction of a nonextractable format therefore returned `unsupported_target` instead of cancellation. 2. **Wrong path reported.** The unsupported-format and encrypted-entry refusals reported the `realpath`. When the caller selected the target through a symlink, junction or other alias (which `BinaryTargetResolver` deliberately keeps in `sourcePath`), the diagnostic named a different path from the one the caller passed. ## Change - `extractArtifact` checks the signal (`abortIfNeeded`) before the preflight, so cancellation wins over every later refusal. - Both `AnalysisUnsupportedTargetError`s report `input.inputPath`. All I/O still uses the canonical path. No schemas change. ## Verification - `artifactProvider.extraction.test.ts` now extracts a DMG through a symlink alias: the refusal reports the alias path, and an already-cancelled request returns `ArtifactOperationError` / `cancelled`. Neither creates output. Both assertions fail on `main`. - All 12 test files that reference `ArtifactProvider`, `extract_artifact` or extraction: 167 passed. - `npm run check:fast`, `npm run jscpd` (2.49%) No real Hopper or Ghidra verification was run, because this change does not touch those providers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:12 +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#2697
No description provided.