[PR #1259] [MERGED] fix(cli): list the read failure cause for an unreadable JSON input file #2747

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

📋 Pull Request Information

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

Base: main ← Head: fix/cli-json-input-read-cause


📝 Commits (1)

  • 6020df5 fix(cli): list the read failure cause for an unreadable JSON input file

📊 Changes

2 files changed (+67 additions, -3 deletions)

View changed files

📝 src/cliJsonInput.ts (+17 -1)
📝 tests/boundary/filesystem/cliJsonInput.test.ts (+50 -2)

📄 Description

Problem

CLI workflows that take <inputJson> (inline JSON or a JSON file path) include compare-source-to-bundle, compare-application-versions, inspect-analysis-view, trace-application-feature, reconcile-javascript-runtime, compare-javascript-export-shapes, build-reconstruction-obligation-ledger, evaluate-reconstruction-coverage, import-managed-reconstruction and capture-browser-scenario. When the selected file cannot be read, they return:

$ rea compare-source-to-bundle /path/to/a-directory --format json
{ "error": "Application workflow failed", "code": "invalid_request", "category": "invalid_input",
  "message": "Analysis input is invalid. Check the arguments and try again.",
  "remediation": { "action": "Correct the listed arguments and retry." },
  "input_path": "/path/to/a-directory", "input_reason": "read-failed" }

There is no details, so the remediation's "listed arguments" lists nothing. The system error is also dropped, so a missing file (ENOENT), a directory (EISDIR) and a permission denial (EACCES) all look identical. For malformed JSON, the same envelope does carry an issue (invalid_format, expected JSON).

Change

jsonFileError now gives a read-failed input one issue:

"details": { "operation": "compare-source-to-bundle",
  "issues": [{ "path": [], "reason": "invalid_value",
    "message": "The JSON input file could not be read (EISDIR): /path/to/a-directory" }] }

The envelope (input_path, input_reason: "read-failed"), code, category and the permission-denial classification pinned by jsonInputStatus.test.ts ("preserves permission errors for malformed path-like JSON input") are unchanged. The issue only adds the cause. details.operation keeps the hyphenated CLI command name, as before.

Verification

  • tests/boundary/filesystem/cliJsonInput.test.ts: new cases for a missing file (ENOENT), a directory (EISDIR) and an unreadable file (EACCES; skipped on Windows and as root). All three fail on main.
  • Every test touching the JSON input envelope (8 files, 102 tests) and the full tests/boundary/cli suite (37 files, 190 tests) passed after npm run build:cached. npm run check:changed also passed (typecheck, lint).
  • Real CLI on macOS: the directory case above now lists EISDIR with the path.

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/1259 **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/cli-json-input-read-cause` --- ### 📝 Commits (1) - [`6020df5`](https://github.com/morluto/rea/commit/6020df53d9cd44845cf3b6b416db2d7802925578) fix(cli): list the read failure cause for an unreadable JSON input file ### 📊 Changes **2 files changed** (+67 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/cliJsonInput.ts` (+17 -1) 📝 `tests/boundary/filesystem/cliJsonInput.test.ts` (+50 -2) </details> ### 📄 Description ## Problem CLI workflows that take `<inputJson>` (inline JSON or a JSON file path) include `compare-source-to-bundle`, `compare-application-versions`, `inspect-analysis-view`, `trace-application-feature`, `reconcile-javascript-runtime`, `compare-javascript-export-shapes`, `build-reconstruction-obligation-ledger`, `evaluate-reconstruction-coverage`, `import-managed-reconstruction` and `capture-browser-scenario`. When the selected file cannot be read, they return: ``` $ rea compare-source-to-bundle /path/to/a-directory --format json { "error": "Application workflow failed", "code": "invalid_request", "category": "invalid_input", "message": "Analysis input is invalid. Check the arguments and try again.", "remediation": { "action": "Correct the listed arguments and retry." }, "input_path": "/path/to/a-directory", "input_reason": "read-failed" } ``` There is no `details`, so the remediation's "listed arguments" lists nothing. The system error is also dropped, so a missing file (`ENOENT`), a directory (`EISDIR`) and a permission denial (`EACCES`) all look identical. For malformed JSON, the same envelope does carry an issue (`invalid_format`, expected `JSON`). ## Change `jsonFileError` now gives a `read-failed` input one issue: ```json "details": { "operation": "compare-source-to-bundle", "issues": [{ "path": [], "reason": "invalid_value", "message": "The JSON input file could not be read (EISDIR): /path/to/a-directory" }] } ``` The envelope (`input_path`, `input_reason: "read-failed"`), `code`, `category` and the permission-denial classification pinned by `jsonInputStatus.test.ts` ("preserves permission errors for malformed path-like JSON input") are unchanged. The issue only adds the cause. `details.operation` keeps the hyphenated CLI command name, as before. ## Verification - `tests/boundary/filesystem/cliJsonInput.test.ts`: new cases for a missing file (`ENOENT`), a directory (`EISDIR`) and an unreadable file (`EACCES`; skipped on Windows and as root). All three fail on `main`. - Every test touching the JSON input envelope (8 files, 102 tests) and the full `tests/boundary/cli` suite (37 files, 190 tests) passed after `npm run build:cached`. `npm run check:changed` also passed (typecheck, lint). - Real CLI on macOS: the directory case above now lists `EISDIR` with the path. 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:46 +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#2747
No description provided.