Skip to content

fix(reference): join internal symlink targets with the inventory NFC normalizer - #1535

Merged
morluto merged 3 commits into
morluto:mainfrom
anujsingh-cse:fix/symlink-target-nfc-identity
Oct 10, 2026
Merged

morluto merged 3 commits into
morluto:mainfrom
anujsingh-cse:fix/symlink-target-nfc-identity

Conversation

@anujsingh-cse

Copy link
Copy Markdown
Contributor

Problem

checkSymlinks in src/domain/referenceSourceGraph.ts resolved an internal symlink target with bare posix.normalize and looked the result up in the inventoried path set:

const resolved = posix.normalize(
  posix.join(posix.dirname(entry.path), entry.target),
);
if (resolved.startsWith("../") || resolved === ".." || !paths.has(resolved))

A target a filesystem reports in NFD (macOS readlink commonly does) joins to an NFD spelling while the inventory holds NFC, so validation reported Internal symlink target must resolve to an inventoried entry for a target the inventory actually contains — the same path-identity class #1488 describes.

The three joins #1488 lists are already routed through normalizeJoinedLogicalPath (that landed with #1513); this join was the remaining one of the class, which the issue's Where list missed.

Fix

Route the symlink join through normalizeJoinedLogicalPath, the inventory identity normalizer, exactly like the #1513 fixes. The feature-seed NFKC query fold stays a query, per the issue's expected behavior. Internal targets are already schema-constrained to relative, backslash-free, normalized spellings, so the extra normalization only adds NFC.

Verification

$ npm run test:focused -- src/domain/referenceSourceGraph.test.ts
Test Files  1 passed (1)
     Tests  11 passed (11)

Two new cases in a dedicated describe block (the file's main describe is at the max-lines-per-function limit):

  • an NFD-spelled target (cafe\u0301.ts) resolving to an NFC inventoried file (src/café.ts) now validates instead of failing
  • an NFD target that normalizes to a path no inventory holds is still rejected

The NFC case fails on the pre-fix source (red/green confirmed locally).

$ npm run check:fast
Tasks: 2 successful, 2 total

$ npm run verify:test-discovery
Discovered all 725 test files exactly once.

Unavailable coverage: no real-provider or host lane is relevant to this validator change.

Refs #1488

…normalizer

checkSymlinks resolved an internal symlink target with bare
posix.normalize and looked the result up in the inventoried path set.
A target that a filesystem reports in NFD (macOS readlink commonly
does) joined to an NFD spelling while the inventory holds NFC, so
validation reported "Internal symlink target must resolve to an
inventoried entry" for a target the inventory actually contains.

Route the join through normalizeJoinedLogicalPath, the same inventory
identity normalizer morluto#1513 applied to the runtime, HTML/module, and
import joins from morluto#1488. The feature-seed NFKC query fold stays a
query.

Refs morluto#1488
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 0363e5a into morluto:main Oct 10, 2026
@morluto

morluto commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thanks @anujsingh-cse for catching the Unicode normalization issue in internal symlink lookup! Squash merged with the source-spelling preservation fix. Welcome to REA, and thank you for your first PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants