Skip to content

fix(browser): classify export-web-scripts capture selection failures by cause - #1240

Merged
kaoru0822-kitauji merged 1 commit into
mainfrom
fix/web-script-export-capture-selection
Oct 9, 2026
Merged

kaoru0822-kitauji merged 1 commit into
mainfrom
fix/web-script-export-capture-selection

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

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

…by cause

export_web_scripts reported a missing capture, a directory selected as
the capture, and an unreadable capture as an artifact io failure ("Script
export failed for <capture> -> <output>: ENOENT ..."), unlike its sibling
inspect_web_network_capture, which already reports these as invalid
input or access_denied.

Read the selected capture in its own step: ENOENT, ENOTDIR and EISDIR
become an invalid capture_path issue, and EACCES or EPERM becomes
access_denied. Failures while writing the export keep their existing
classification.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants