[PR #1240] [MERGED] fix(browser): classify export-web-scripts capture selection failures by cause #2743

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

📋 Pull Request Information

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

Base: main ← Head: fix/web-script-export-capture-selection


📝 Commits (1)

  • 8c5e34c fix(browser): classify export-web-scripts capture selection failures by cause

📊 Changes

2 files changed (+99 additions, -7 deletions)

View changed files

📝 src/application/WebScriptExportService.ts (+38 -3)
📝 tests/boundary/filesystem/webScriptExport.test.ts (+61 -4)

📄 Description

Problem

export_web_scripts / rea export-web-scripts reports every problem with the selected capture as an artifact I/O failure of the export:

Selected capture_path main result (CLI and MCP)
missing artifact_operation_failed / io: "Script export failed for → : ENOENT: no such file or directory, open …"
a directory same io failure (EISDIR)
unreadable (mode 000) same io failure (EACCES)

Its sibling inspect_web_network_capture already classifies the same selections correctly: invalid_request with an issue on the capture path for a missing or non-file selection, and access_denied for a permission denial (src/browser/history/CaptureFailures.ts). With export_web_scripts, a caller could not tell a wrong selection from a failed export write.

Change

WebScriptExportService reads the selected capture in its own step (readCapture):

Read failure Result
ENOENT, ENOTDIR invalid_request; issue on capture_path: "Selected capture could not be read (ENOENT): "
EISDIR invalid_request; issue on capture_path: "Selected capture is a directory, not a file: "
EACCES, EPERM access_denied with path and system_code

Cancellation still reports cancelled. Failures while publishing the export (output directory, durable writes, rollback) keep their WebScriptExportError classification. Schemas are unchanged.

Tests

  • New cases in tests/boundary/filesystem/webScriptExport.test.ts for a directory and an unreadable capture. The unreadable case is skipped on Windows and as root. Neither creates the output directory.
  • The existing "identifies a missing capture file" test now checks the path in the capture_path issue message instead of in the I/O userMessage.
  • All three fail on main and pass here. webScriptExport and webModuleArtifacts suites: 21 passed. npm run check:changed (typecheck, lint) passed.

Real CLI and MCP on macOS:

missing   → {"code":"invalid_request","details":{"issues":[{"path":["capture_path"],"reason":"invalid_value","message":"Selected capture could not be read (ENOENT): …/missing.json"}]}}
directory → {"code":"invalid_request", … "message":"Selected capture is a directory, not a file: …/plaindir"}
mode 000  → {"code":"access_denied","details":{"system_code":"EACCES", …}}

No Hopper or Ghidra verification was needed; neither provider is involved.

🤖 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/1240 **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/web-script-export-capture-selection` --- ### 📝 Commits (1) - [`8c5e34c`](https://github.com/morluto/rea/commit/8c5e34cd379392ca40f651ca5eeb6a947b44aa33) fix(browser): classify export-web-scripts capture selection failures by cause ### 📊 Changes **2 files changed** (+99 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/application/WebScriptExportService.ts` (+38 -3) 📝 `tests/boundary/filesystem/webScriptExport.test.ts` (+61 -4) </details> ### 📄 Description ## Problem `export_web_scripts` / `rea export-web-scripts` reports every problem with the selected capture as an artifact I/O failure of the export: | Selected `capture_path` | `main` result (CLI and MCP) | | --- | --- | | missing | `artifact_operation_failed` / `io`: "Script export failed for <capture> → <output>: ENOENT: no such file or directory, open …" | | a directory | same `io` failure (`EISDIR`) | | unreadable (mode 000) | same `io` failure (`EACCES`) | Its sibling `inspect_web_network_capture` already classifies the same selections correctly: `invalid_request` with an issue on the capture path for a missing or non-file selection, and `access_denied` for a permission denial (`src/browser/history/CaptureFailures.ts`). With `export_web_scripts`, a caller could not tell a wrong selection from a failed export write. ## Change `WebScriptExportService` reads the selected capture in its own step (`readCapture`): | Read failure | Result | | --- | --- | | `ENOENT`, `ENOTDIR` | `invalid_request`; issue on `capture_path`: "Selected capture could not be read (ENOENT): <path>" | | `EISDIR` | `invalid_request`; issue on `capture_path`: "Selected capture is a directory, not a file: <path>" | | `EACCES`, `EPERM` | `access_denied` with `path` and `system_code` | Cancellation still reports `cancelled`. Failures while publishing the export (output directory, durable writes, rollback) keep their `WebScriptExportError` classification. Schemas are unchanged. ## Tests - New cases in `tests/boundary/filesystem/webScriptExport.test.ts` for a directory and an unreadable capture. The unreadable case is skipped on Windows and as root. Neither creates the output directory. - The existing "identifies a missing capture file" test now checks the path in the `capture_path` issue message instead of in the I/O `userMessage`. - All three fail on `main` and pass here. `webScriptExport` and `webModuleArtifacts` suites: 21 passed. `npm run check:changed` (typecheck, lint) passed. Real CLI and MCP on macOS: ``` missing → {"code":"invalid_request","details":{"issues":[{"path":["capture_path"],"reason":"invalid_value","message":"Selected capture could not be read (ENOENT): …/missing.json"}]}} directory → {"code":"invalid_request", … "message":"Selected capture is a directory, not a file: …/plaindir"} mode 000 → {"code":"access_denied","details":{"system_code":"EACCES", …}} ``` No Hopper or Ghidra verification was needed; neither provider is involved. 🤖 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:44 +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#2743
No description provided.