[PR #2716] [MERGED] fix(reference): report entries beyond the path limit as I/O failures #5339

Closed
opened 2026-10-31 01:05:51 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/issue-2652


📝 Commits (10+)

  • 727e7ee fix(reference): report entries beyond the path limit as I/O failures
  • f8344b7 test(reference): assert the imported graph keeps readable and failed entries
  • 087f4b8 Merge remote-tracking branch 'origin/main' into fix/issue-2652
  • f346b81 Merge remote-tracking branch 'origin/main' into fix/issue-2652
  • 6eb7b40 fix(process): report no remaining time after a provider deadline fires
  • 24f3bb4 fix: reconcile PR #2716 with pinned main and preserve review fixes
  • 7be5f6f fix(reference): preserve path limit entry uncertainty
  • cc3de7a fix(reference): preserve unknown entry failures and identity
  • cf04f9b Merge commit '8fef2aa64e' into HEAD
  • 4735c7c Merge branch 'main' into fix/issue-2652

📊 Changes

10 files changed (+197 additions, -15 deletions)

View changed files

📝 src/application/ReferenceSourceImport.ts (+22 -8)
📝 src/application/ReferenceSourceImportEntries.ts (+9 -0)
📝 src/domain/referenceSourceGraph.test.ts (+24 -0)
📝 src/domain/referenceSourceGraph.ts (+11 -1)
📝 src/domain/referenceSourceSummary.test.ts (+20 -0)
📝 src/domain/referenceSourceSummary.ts (+3 -1)
📝 src/reference/ReferenceSourceReaderEntries.ts (+10 -3)
📝 src/reference/ReferenceSourceReaderErrors.ts (+5 -0)
📝 src/reference/ReferenceSourceReaderTypes.ts (+8 -2)
📝 tests/boundary/filesystem/referenceSourceFailureDetails.test.ts (+85 -0)

📄 Description

Fixes #2652.

Problem

Reference-source traversal (src/reference/ReferenceSourceReaderEntries.ts) builds each child path by joining it onto the root and calls lstat on the result. A valid tree whose nested entries exceed the platform's absolute path limit makes lstat fail with ENAMETOOLONG, even though the selected root and every component are fine. The limit is PATH_MAX 1024 on macOS and 4096 on Linux.

filesystemFailureDetail turns allow-listed OS errors into the reader's existing failed io entry. Its FILESYSTEM_ERROR_CODES set lacked ENAMETOOLONG, so it returned undefined, readMetadata rethrew, and the native error escaped both readReferenceSource and importReferenceSource:

Error: ENAMETOOLONG: name too long, lstat '…/d00xxx…/d01xxx…/…/d04xxx…'

The CLI's handled import-error path never saw it, and the readable parts of the tree were lost.

Fix

Add ENAMETOOLONG to the reader's allow-list, which matches the JavaScript application reader's list (JavaScriptApplicationService.ts already includes it). The entry that can't be reached becomes { status: "failed", code: "io", message: "Entry metadata could not be read: ENAMETOOLONG: …" }. Readable siblings stay in the graph, and the import completes with that limitation instead of rejecting.

Validation

  • New boundary test, referenceSourceFailureDetails.test.ts > reports an entry beyond the absolute path limit as an I/O failure. It uses a child Node process with relative mkdir/chdir to build a tree of 24 × 200-byte components, which exceeds PATH_MAX on both macOS and Linux. It asserts that kept.txt is read, the deep entry is a failed io entry mentioning ENAMETOOLONG, and importReferenceSource succeeds. The tree is removed the same way afterwards. On main the test fails with the raw ENAMETOOLONG rejection; here it passes.
  • All 16 reference-source test files pass (69 tests). npm run check:fast and format:check pass.
  • Windows is skipped, because its long-path behavior differs.

🤖 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/2716 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/issue-2652` --- ### 📝 Commits (10+) - [`727e7ee`](https://github.com/morluto/rea/commit/727e7eeb1f34ec44fd5f42da96d3276be54e7223) fix(reference): report entries beyond the path limit as I/O failures - [`f8344b7`](https://github.com/morluto/rea/commit/f8344b79933864c8051eb15b8be4981fd811258b) test(reference): assert the imported graph keeps readable and failed entries - [`087f4b8`](https://github.com/morluto/rea/commit/087f4b8688645d602d7d99ff7ea9196b543241d1) Merge remote-tracking branch 'origin/main' into fix/issue-2652 - [`f346b81`](https://github.com/morluto/rea/commit/f346b8156699c0d1768875bfc333a1746b1b479f) Merge remote-tracking branch 'origin/main' into fix/issue-2652 - [`6eb7b40`](https://github.com/morluto/rea/commit/6eb7b404e31c66d79f82647c728298577a131307) fix(process): report no remaining time after a provider deadline fires - [`24f3bb4`](https://github.com/morluto/rea/commit/24f3bb4671f98cf4181c3f956fc0022e56f30a84) fix: reconcile PR #2716 with pinned main and preserve review fixes - [`7be5f6f`](https://github.com/morluto/rea/commit/7be5f6fb454d5885053545aa825c8db5ba902b81) fix(reference): preserve path limit entry uncertainty - [`cc3de7a`](https://github.com/morluto/rea/commit/cc3de7afc302d1aeac0409ae38118ee3661361dd) fix(reference): preserve unknown entry failures and identity - [`cf04f9b`](https://github.com/morluto/rea/commit/cf04f9b620c357de876baec183cce66a7de29b63) Merge commit '8fef2aa64ec1ee742e8b70b825938d30a0ea7319' into HEAD - [`4735c7c`](https://github.com/morluto/rea/commit/4735c7c72140bec519b03d32f1673091c051dd6f) Merge branch 'main' into fix/issue-2652 ### 📊 Changes **10 files changed** (+197 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `src/application/ReferenceSourceImport.ts` (+22 -8) 📝 `src/application/ReferenceSourceImportEntries.ts` (+9 -0) 📝 `src/domain/referenceSourceGraph.test.ts` (+24 -0) 📝 `src/domain/referenceSourceGraph.ts` (+11 -1) 📝 `src/domain/referenceSourceSummary.test.ts` (+20 -0) 📝 `src/domain/referenceSourceSummary.ts` (+3 -1) 📝 `src/reference/ReferenceSourceReaderEntries.ts` (+10 -3) 📝 `src/reference/ReferenceSourceReaderErrors.ts` (+5 -0) 📝 `src/reference/ReferenceSourceReaderTypes.ts` (+8 -2) 📝 `tests/boundary/filesystem/referenceSourceFailureDetails.test.ts` (+85 -0) </details> ### 📄 Description Fixes #2652. ## Problem Reference-source traversal (`src/reference/ReferenceSourceReaderEntries.ts`) builds each child path by joining it onto the root and calls `lstat` on the result. A valid tree whose nested entries exceed the platform's absolute path limit makes `lstat` fail with `ENAMETOOLONG`, even though the selected root and every component are fine. The limit is `PATH_MAX` 1024 on macOS and 4096 on Linux. `filesystemFailureDetail` turns allow-listed OS errors into the reader's existing failed `io` entry. Its `FILESYSTEM_ERROR_CODES` set lacked `ENAMETOOLONG`, so it returned `undefined`, `readMetadata` rethrew, and the native error escaped both `readReferenceSource` and `importReferenceSource`: ``` Error: ENAMETOOLONG: name too long, lstat '…/d00xxx…/d01xxx…/…/d04xxx…' ``` The CLI's handled import-error path never saw it, and the readable parts of the tree were lost. ## Fix Add `ENAMETOOLONG` to the reader's allow-list, which matches the JavaScript application reader's list (`JavaScriptApplicationService.ts` already includes it). The entry that can't be reached becomes `{ status: "failed", code: "io", message: "Entry metadata could not be read: ENAMETOOLONG: …" }`. Readable siblings stay in the graph, and the import completes with that limitation instead of rejecting. ## Validation - New boundary test, `referenceSourceFailureDetails.test.ts > reports an entry beyond the absolute path limit as an I/O failure`. It uses a child Node process with relative `mkdir`/`chdir` to build a tree of 24 × 200-byte components, which exceeds `PATH_MAX` on both macOS and Linux. It asserts that `kept.txt` is read, the deep entry is a failed `io` entry mentioning `ENAMETOOLONG`, and `importReferenceSource` succeeds. The tree is removed the same way afterwards. On main the test fails with the raw `ENAMETOOLONG` rejection; here it passes. - All 16 reference-source test files pass (69 tests). `npm run check:fast` and `format:check` pass. - Windows is skipped, because its long-path behavior differs. 🤖 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-31 01:05:51 +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#5339
No description provided.