[PR #4060] [CLOSED] fix(reference-source): keep a partial graph for symlinks into unenumerated directories #6027

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4060
Author: @Xander-AJ
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: fix/reference-source-symlink-unreadable-target


📝 Commits (2)

  • 7a95eb5 fix(reference-source): keep a partial graph for symlinks into unenumerated directories
  • 20b5fa2 test(reference-source): cover symlink targets under unenumerated and enumerated directories

📊 Changes

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

View changed files

📝 src/domain/referenceSourceGraph.test.ts (+24 -0)
📝 src/domain/referenceSourceGraph.ts (+16 -1)
📝 tests/boundary/filesystem/referenceSourceUnreadableDirectories.test.ts (+30 -1)

📄 Description

Summary

Fixes #4013. import-reference-source aborted the whole import when a readable symlink resolved to a file under a directory that permits search but denies enumeration (for example mode 0111). The failure was a graph-validation error and the readable sibling observations were discarded.

Problem and expected behavior

Fixture: visible.txt, hidden/target.txt (hidden is mode 0111) and alias.txt -> hidden/target.txt. The import failed with Internal symlink target must resolve to an inventoried entry or a recorded exclusion. Expected: a partial graph that keeps visible.txt, the hidden directory marked unreadable, and the symlink entry, consistent with referenceSourceUnreadableDirectories.test.ts, which already requires unreadable descendants to preserve a successful partial graph.

Change and scope

In checkSymlinks (src/domain/referenceSourceGraph.ts), an internal target is also accepted when one of its ancestor directories is inventoried with a tree_state other than enumerated. Children of such a directory cannot be inventoried, so a symlink into one is a legitimate limitation, handled like a target under a recorded exclusion. Not included: any change to how the importer builds symlink entries, and no new limitation text.

Contract and boundary impact

  • Semantic owner and earliest changed stage: reference-source graph validation (checkSymlinks).
  • Contribution scope fit and linked maintainer decision: ordinary fix within existing boundaries; not applicable.
  • CLI and MCP/tool-catalog contract: no schema change; an import that previously failed now returns a partial graph.
  • Provider, bridge, target-format, or platform compatibility: filesystem permission semantics; exercised on macOS only.
  • Evidence, artifact, provenance, or reconstruction contract: partial inventories stay partial; no entry is invented.

Expected effects:

  • Read existing files or captured data.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/filesystem/referenceSourceUnreadableDirectories.test.ts adds the symlink fixture from the issue (needs real directory permissions, so it is skipped as root or on Windows). src/domain/referenceSourceGraph.test.ts adds a filesystem-independent test: a target under an unreadable directory is accepted, and the same target under an enumerated directory is still rejected.
  • Base reproduction or other evidence: both new tests fail on the base revision (the domain test with Internal symlink target must resolve to an inventoried entry or a recorded exclusion) and pass with the change.
  • Remaining proof gaps: Linux not exercised; the CLI was not run (the test uses the import API). The relaxed check also accepts a target under a directory with tree_state excluded, partial or unknown that has no matching exclusion record; I did not add separate tests for those states. Open question: whether the symlink entry should carry its own limitation or a different target_state for the unverified target, as the issue's "truthful uncertainty" wording may suggest.

Validation performed

  • npx vitest run tests/boundary/filesystem/referenceSourceUnreadableDirectories.test.ts — 4 passed
  • npx vitest run src/domain/referenceSourceGraph.test.ts — 28 passed (27 on the base plus the new test; the new test fails when referenceSourceGraph.ts is reverted to the base)
  • npx vitest run referenceSource ReferenceSource sourceToBundle on this branch and on the base: 32 tests fail on both with an identical failure list, so none come from this change (this machine has no built dist); this branch has 182 passing versus 181 on the base, the difference being the new test
  • npx oxfmt --check on all three changed files — formatted

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the import still never reads the unreadable directory's contents; only the validation of an already-recorded link target is relaxed.

Author readiness

Drafted with AI assistance and then reviewed by the human owner, who made the declarations below.

Human owner: @Xander-AJ

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 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/4060 **Author:** [@Xander-AJ](https://github.com/Xander-AJ) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/reference-source-symlink-unreadable-target` --- ### 📝 Commits (2) - [`7a95eb5`](https://github.com/morluto/rea/commit/7a95eb579bceaeda6bfa7060a3f63e525e041b30) fix(reference-source): keep a partial graph for symlinks into unenumerated directories - [`20b5fa2`](https://github.com/morluto/rea/commit/20b5fa2a09b29d6227473e7630dbab434b6d98f2) test(reference-source): cover symlink targets under unenumerated and enumerated directories ### 📊 Changes **3 files changed** (+70 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/referenceSourceGraph.test.ts` (+24 -0) 📝 `src/domain/referenceSourceGraph.ts` (+16 -1) 📝 `tests/boundary/filesystem/referenceSourceUnreadableDirectories.test.ts` (+30 -1) </details> ### 📄 Description ## Summary Fixes #4013. `import-reference-source` aborted the whole import when a readable symlink resolved to a file under a directory that permits search but denies enumeration (for example mode `0111`). The failure was a graph-validation error and the readable sibling observations were discarded. ## Problem and expected behavior Fixture: `visible.txt`, `hidden/target.txt` (`hidden` is mode `0111`) and `alias.txt -> hidden/target.txt`. The import failed with `Internal symlink target must resolve to an inventoried entry or a recorded exclusion`. Expected: a partial graph that keeps `visible.txt`, the `hidden` directory marked `unreadable`, and the symlink entry, consistent with `referenceSourceUnreadableDirectories.test.ts`, which already requires unreadable descendants to preserve a successful partial graph. ## Change and scope In `checkSymlinks` (`src/domain/referenceSourceGraph.ts`), an internal target is also accepted when one of its ancestor directories is inventoried with a `tree_state` other than `enumerated`. Children of such a directory cannot be inventoried, so a symlink into one is a legitimate limitation, handled like a target under a recorded exclusion. Not included: any change to how the importer builds symlink entries, and no new limitation text. ## Contract and boundary impact - Semantic owner and earliest changed stage: reference-source graph validation (`checkSymlinks`). - Contribution scope fit and linked maintainer decision: ordinary fix within existing boundaries; not applicable. - CLI and MCP/tool-catalog contract: no schema change; an import that previously failed now returns a partial graph. - Provider, bridge, target-format, or platform compatibility: filesystem permission semantics; exercised on macOS only. - Evidence, artifact, provenance, or reconstruction contract: partial inventories stay `partial`; no entry is invented. Expected effects: - [x] Read existing files or captured data. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/filesystem/referenceSourceUnreadableDirectories.test.ts` adds the symlink fixture from the issue (needs real directory permissions, so it is skipped as root or on Windows). `src/domain/referenceSourceGraph.test.ts` adds a filesystem-independent test: a target under an `unreadable` directory is accepted, and the same target under an `enumerated` directory is still rejected. - Base reproduction or other evidence: both new tests fail on the base revision (the domain test with `Internal symlink target must resolve to an inventoried entry or a recorded exclusion`) and pass with the change. - Remaining proof gaps: Linux not exercised; the CLI was not run (the test uses the import API). The relaxed check also accepts a target under a directory with `tree_state` `excluded`, `partial` or `unknown` that has no matching exclusion record; I did not add separate tests for those states. Open question: whether the symlink entry should carry its own limitation or a different `target_state` for the unverified target, as the issue's "truthful uncertainty" wording may suggest. ## Validation performed - `npx vitest run tests/boundary/filesystem/referenceSourceUnreadableDirectories.test.ts` — 4 passed - `npx vitest run src/domain/referenceSourceGraph.test.ts` — 28 passed (27 on the base plus the new test; the new test fails when `referenceSourceGraph.ts` is reverted to the base) - `npx vitest run referenceSource ReferenceSource sourceToBundle` on this branch and on the base: 32 tests fail on both with an identical failure list, so none come from this change (this machine has no built `dist`); this branch has 182 passing versus 181 on the base, the difference being the new test - `npx oxfmt --check` on all three changed files — formatted ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: none. - Package or release metadata impact: none. - Security, privacy, process, or containment review: the import still never reads the unreadable directory's contents; only the validation of an already-recorded link target is relaxed. ## Author readiness Drafted with AI assistance and then reviewed by the human owner, who made the declarations below. Human owner: @Xander-AJ - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:11:17 +00:00
bsakaguchi changed title from [PR #4060] [CLOSED] fix(reference-source): keep a partial graph for symlinks into unenumerated directories to [PR #4060] fix(reference-source): keep a partial graph for symlinks into unenumerated directories 2026-11-03 13:31:38 +00:00
bsakaguchi changed title from [PR #4060] fix(reference-source): keep a partial graph for symlinks into unenumerated directories to [PR #4060] [CLOSED] fix(reference-source): keep a partial graph for symlinks into unenumerated directories 2026-11-03 14:33:20 +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#6027
No description provided.