Repository navigation
fix(browser): classify selected web trace file failures by cause - #1396
Conversation
trace_web_module_imports and trace_web_source_location reported a missing
or non-file manifest, source map or import map as artifact_operation_failed
("Artifact could not be read or written" / "unsafe or conflicting internal
path"). These are caller selections: report ENOENT/ENOTDIR and non-regular
files as invalid input on the selected field, and EACCES/EPERM as a host
access denial. A missing manifest-derived source file stays an artifact fault.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
TL;DR: The fix works on Linux for every bad file I tried. One case got worse. A bad path inside the manifest now blames the caller. Moving one line fixes it. What I ran The two changed test files pass on all three Nodes. That is 15 of 15 each time. The nearby web tests pass too, 124 of 124 on Node 24. Your new tests fail on base, so they do pin the change. Real files through the CLI I made each bad file for real on disk. Then I ran both
Here One case moved the wrong way Say the manifest's The cause is the order. I tried a fix. I moved Still in the plain These are still
A long path that still fits loads fine. I tried 3873 bytes. Not run
Thanks, kaoru0822-kitauji. This is a nice change. Test setup
🤖 Generated with Claude Code (Opus 5.5) 🦊 |
…luto#1396) trace_web_module_imports and trace_web_source_location reported a missing or non-file manifest, source map or import map as artifact_operation_failed ("Artifact could not be read or written" / "unsafe or conflicting internal path"). These are caller selections: report ENOENT/ENOTDIR and non-regular files as invalid input on the selected field, and EACCES/EPERM as a host access denial. A missing manifest-derived source file stays an artifact fault.
Problem
trace_web_module_importsandtrace_web_source_location(CLItrace-web-module-imports/trace-web-source-location) report a bad caller-selected file as an artifact read/write fault:mainresult (CLI and MCP)manifest_pathmissingartifact_operation_failed/io: "Artifact could not be read or written. Check file access and try again." (ENOENTonly indetails.detail)manifest_pathis a directoryartifact_operation_failed/path: "Artifact contains an unsafe or conflicting internal path. Inspect the reported path and correct the artifact before retrying."source_map.path/import_map.pathmissingiofailureiofailure (EACCES)The advice sends the caller to repair an artifact when the selection is wrong. The sibling tools already separate these cases:
inspect_web_network_capture(src/browser/history/CaptureFailures.ts) andexport_web_scripts(#1240) reportinvalid_requestwith an issue on the selected field, andaccess_deniedfor a host permission denial.Change
WebArtifactReadContextnow records whether the caller named the file (callerSelected). For a caller-selected manifest, source map or import map:ENOENT,ENOTDIRinvalid_request;invalid_valueissue on the selected field: "Selected file could not be read (ENOENT): "ArtifactReaderFailurepath)invalid_request;invalid_valueissue: "Expected a regular file without a symlink: "EACCES,EPERMaccess_deniedwithpathandsystem_codeThese stay unchanged: malformed JSON or UTF-8 (
invalid_format), the byte limit, changes during the read, cancellation, and every failure on the manifest-derived source file underfiles/(still an artifact fault, because the export is incomplete or tampered). Schemas are unchanged.Tests
tests/boundary/filesystem/webModuleArtifacts.test.ts, newcaller-selected web module filesblock:invalid_requestonmanifest_path;access_denied(skipped on Windows and as root);invalid_requestonimport_map.path;ArtifactOperationError/io.It replaces the test that pinned a missing manifest as
ArtifactOperationError/io. InwebSourceLocationArtifacts.test.ts, a missing source map is now expected asinvalid_requestonsource_map.path.Verification:
npm run test:focused -- tests/acceptance/webModuleCli.test.tsplus allwebModule*/webSource*boundary and MCP tests (10 files, 103 passed)npm run check:changed,npm run format:check, jscpd 2.46% (< 2.5%)dist: a missing manifest and a directory each return theinvalid_requestissue shown above.No Hopper/Ghidra or browser verification needed (local file reads only).
🤖 Generated with Claude Code