Skip to content

fix(yield): case-insensitive canonical repo grouping via realpathSync.native#751

Open
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:pr/714-delta
Open

fix(yield): case-insensitive canonical repo grouping via realpathSync.native#751
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:pr/714-delta

Conversation

@ozymandiashh

Copy link
Copy Markdown
Collaborator

The focused follow-up you invited in the #714 discussion, covering the two deltas over #719 — one of which turned out to be a live gap, not just missing coverage.

Case-insensitivity was not actually covered

fs.realpathSync preserves the caller's path casing; only fs.realpathSync.native returns the on-disk casing. Verified empirically on macOS APFS:

fs.realpathSync('/tmp/CASETESTDIR')        -> /private/tmp/CASETESTDIR   (input casing kept)
fs.realpathSync.native('/tmp/CASETESTDIR') -> /private/tmp/CaseTestDir   (on-disk casing)

So #719's canonicalization still produced distinct keys for the same repo reached through differently cased paths (a shell tab-completed path vs a tool-emitted lowercase path, for example), splitting one repo into separate groups on macOS and Windows. The fix is the one-line switch to realpathSync.native inside the existing try/catch (failure fallback semantics unchanged), plus a regression test that creates a real repo, references it through altered casing, and asserts a single group — guarded so it only asserts strict equality on filesystems that are actually case-insensitive.

The documented residual

The second delta from #714's writeup, now a short comment at the canonicalization site: a main repo moved on disk after git worktree add leaves git's own linked-worktree metadata stale, so its worktrees may not unify. That is git-state staleness, not a grouping bug.

npx tsc --noEmit clean, yield grouping suite green (4/4). Closes the delta discussed in #714.

….native

Follow-up to getagentseal#719, closing the two deltas flagged in the getagentseal#714 discussion:

- fs.realpathSync preserves the caller's path casing on case-insensitive
  filesystems (macOS APFS, Windows), so the same repo reached through
  differently cased paths produced distinct canonical keys and split into
  separate groups. fs.realpathSync.native returns the on-disk casing, making
  the canonical key truly canonical. Regression test creates a real repo,
  references it through altered casing (guarded to case-insensitive
  filesystems), and asserts one group.

- Documents the accepted residual: a main repo moved on disk after
  'git worktree add' leaves git's linked-worktree metadata stale, so its
  worktrees may not unify; that is git-state staleness, not a grouping bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant