fix(registry): match scoped definition names on Windows - #136
Merged
Conversation
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
loadDefinitionderives the expected name fromrelative(managerDir, filePath), which returns platform separators. On Windows a scoped definition yields@apollo\client, which never matches the@apollo/clientinside the file: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
mainwith 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:sepis/on Linux, sosplit(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:
Definition name "@apollo/client" doesn't match filename "@apollo\client.yaml"pnpm lintclean (neededpnpm fixfor wrapping),pnpm buildcleanpnpm test— 221 context + 49 registry, all passingNo changeset:
@neuledge/registryisprivate: true, and CLAUDE.md scopes changesets to published packages.Scope
The fix and its test only. The Windows path-separator artifact in
doc_pathvalues 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