Skip to content

fix(registry): match scoped definition names on Windows - #136

Merged
moshest merged 1 commit into
mainfrom
claude/fix-scoped-name-separator
Sep 8, 2026
Merged

fix(registry): match scoped definition names on Windows#136
moshest merged 1 commit into
mainfrom
claude/fix-scoped-name-separator

Conversation

@moshest

@moshest moshest commented Sep 8, 2026

Copy link
Copy Markdown
Member

The bug

loadDefinition derives the expected name from relative(managerDir, filePath), which returns platform separators. On Windows a scoped definition yields @apollo\client, which never matches the @apollo/client inside the file:

Definition name "@apollo/client" doesn't match filename "@apollo\client.yaml"

listDefinitions() loads every definition, so one scoped package throws and no registry command runs at all on Windows.

Reported by @TeeJS in #133. They reproduced it on main with their own definitions removed, confirmed it doesn't affect Linux CI, and deliberately left it unfixed to keep that PR to one concern. Credit to them — this is their find and their proposed approach.

The fix

Normalise the derived name to forward slashes before comparing.

They suggested split(sep).join("/"), which is correct. I used .replaceAll("\\", "/") instead for one reason: sep is / on Linux, so split(sep) leaves backslashes untouched and the Windows behaviour becomes a branch that no Linux CI run ever executes. Normalising unconditionally keeps a single code path on both platforms, so the comparison Linux tests is the comparison Windows runs.

Test

The regression test reproduces the failure on Linux. A literal backslash in a filename is one filename here rather than a separator, but the string reaching the comparison is byte-identical to what Windows produces from a real separator.

Verified in both directions rather than assumed:

  • Without the fix, the new test fails with the exact reported error: Definition name "@apollo/client" doesn't match filename "@apollo\client.yaml"
  • With the fix, it passes
  • pnpm lint clean (needed pnpm fix for wrapping), pnpm build clean
  • pnpm test — 221 context + 49 registry, all passing

No changeset: @neuledge/registry is private: true, and CLAUDE.md scopes changesets to published packages.

Scope

The fix and its test only. The Windows path-separator artifact in doc_path values that @TeeJS also mentioned is a different thing — a display artifact in built output rather than a hard failure — and isn't touched here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NBQQpA86yYzwJUiVz8ph2R


Generated by Claude Code

loadDefinition derives the expected name from relative(managerDir, filePath),
which returns platform separators. On Windows a scoped definition yields
"@apollo\client" and never matches the "@apollo/client" inside the file, so
listDefinitions() threw for every scoped package and no registry command ran
at all.

Reported by @TeeJS in #133, who reproduced it on main with their own
definitions removed and deliberately left it unfixed to keep that PR to one
concern.

Normalising unconditionally rather than branching on sep keeps a single code
path on every platform, so Linux CI exercises the same comparison Windows does
instead of leaving the Windows branch untested.

The regression test reproduces the failure on Linux: a literal backslash in the
filename is one filename here rather than a separator, but the string reaching
the comparison is byte-identical to what Windows produces. Without the fix it
fails with the exact reported error, "Definition name \"@apollo/client\"
doesn't match filename \"@apollo\\client.yaml\"".

No changeset: @neuledge/registry is private.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBQQpA86yYzwJUiVz8ph2R
@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: fde6ab8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@moshest
moshest marked this pull request as ready for review September 8, 2026 23:34
@moshest
moshest merged commit 149f112 into main Sep 8, 2026
3 checks passed
@moshest
moshest deleted the claude/fix-scoped-name-separator branch September 8, 2026 23:34
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.

2 participants