[PR #1000] [MERGED] fix(cli): classify ENOTDIR JSON input failures #2569

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1000
Author: @morluto
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @morluto

Base: main ← Head: codex/cli-json-enotdir


📝 Commits (4)

  • f19bc44 fix(cli): classify ENOTDIR JSON input failures
  • 7c77813 Merge remote-tracking branch 'origin/main' into codex/cli-json-enotdir
  • f91c0ef Merge remote-tracking branch 'origin/main' into codex/cli-json-enotdir
  • 91e0b3f Merge remote-tracking branch 'origin/main' into codex/cli-json-enotdir

📊 Changes

2 files changed (+71 additions, -2 deletions)

View changed files

📝 src/cliJsonInput.ts (+3 -1)
📝 tests/boundary/cli/jsonInputStatus.test.ts (+68 -1)

📄 Description

What changed

Malformed inline JSON such as [prefix/rest is probed as a possible file path for compatibility with selected JSON files. If the current directory contains a regular file named [prefix, reading the rest returns ENOTDIR; the CLI previously reported read-failed with input_path, even though the supplied value was malformed JSON.

Treat ENOTDIR as evidence that this malformed inline value cannot name an existing file, alongside the existing ENOENT and ENAMETOOLONG cases. Explicit .json paths still take file-path precedence, and permission failures such as EACCES still return read-failed with the selected path. The CLI regression uses a real temporary regular-file prefix, and a second regression verifies an actual permission-denied read. Existing valid [input].json selection remains covered.

Follow-up to the report on merged PR #946. Related to #893.

Verification

  • npm run test:focused -- tests/boundary/cli/jsonInputStatus.test.ts tests/boundary/filesystem/cliJsonInput.test.ts — 61 tests passed; focused runner built the project.
  • npm run check:fast — passed.
  • npm run docs:check — passed.
  • npm run format:check and git diff --check — passed.

🔄 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/1000 **Author:** [@morluto](https://github.com/morluto) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/cli-json-enotdir` --- ### 📝 Commits (4) - [`f19bc44`](https://github.com/morluto/rea/commit/f19bc449cae9ab8cce165886e7b2be2f8249436b) fix(cli): classify ENOTDIR JSON input failures - [`7c77813`](https://github.com/morluto/rea/commit/7c778136af6e23279b3acdb06d7bae9efa0565c0) Merge remote-tracking branch 'origin/main' into codex/cli-json-enotdir - [`f91c0ef`](https://github.com/morluto/rea/commit/f91c0ef76a3ce29bd37ac4a3a5346a8a50e3e8a0) Merge remote-tracking branch 'origin/main' into codex/cli-json-enotdir - [`91e0b3f`](https://github.com/morluto/rea/commit/91e0b3f603e67b004f63803ef005d3758f77cf37) Merge remote-tracking branch 'origin/main' into codex/cli-json-enotdir ### 📊 Changes **2 files changed** (+71 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/cliJsonInput.ts` (+3 -1) 📝 `tests/boundary/cli/jsonInputStatus.test.ts` (+68 -1) </details> ### 📄 Description ## What changed Malformed inline JSON such as `[prefix/rest` is probed as a possible file path for compatibility with selected JSON files. If the current directory contains a regular file named `[prefix`, reading the rest returns `ENOTDIR`; the CLI previously reported `read-failed` with `input_path`, even though the supplied value was malformed JSON. Treat `ENOTDIR` as evidence that this malformed inline value cannot name an existing file, alongside the existing `ENOENT` and `ENAMETOOLONG` cases. Explicit `.json` paths still take file-path precedence, and permission failures such as `EACCES` still return `read-failed` with the selected path. The CLI regression uses a real temporary regular-file prefix, and a second regression verifies an actual permission-denied read. Existing valid `[input].json` selection remains covered. Follow-up to [the report on merged PR #946](https://github.com/morluto/rea/pull/946#discussion_r4209139965). Related to #893. ## Verification - `npm run test:focused -- tests/boundary/cli/jsonInputStatus.test.ts tests/boundary/filesystem/cliJsonInput.test.ts` — 61 tests passed; focused runner built the project. - `npm run check:fast` — passed. - `npm run docs:check` — passed. - `npm run format:check` and `git diff --check` — passed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:07:41 +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#2569
No description provided.