Repository navigation
Conversation
This branch has not been deployed
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.
Problem
A canonical
$idalias registered by an external document can be invisible to a sibling$refresolved concurrently.Root schema references the same external document by path and by its canonical
$id:External refs are crawled concurrently. The
urn:ref is attempted beforeexternal.jsonhas been parsed and its$idregistered, so no resolver matches it and resolution throws:Before:
1 pass / 1 fail. A direct probe shows onlymem://schemas/ext.jsonhad been read when the failure occurred.Fix
getFileInfo()shared byparse()and the resolver pre-check (lib/parse.ts).lib/resolve-external.ts, when a ref has zero matching resolvers, defer it instead of failing immediately. After all documents finish loading, retry deferred refs once, when canonical aliases are registered.Verification
On the patched worktree, using
bun:testplus a temporaryvitestshim (project dependencies are not installed):Before-patch same spec logic:
1 pass / 1 fail.Additional checks:
The regression test asserts identity (
toBe) between the path-ref and$id-ref results, and that the external document is read exactly once. A second case confirms an actually unresolvableurn:still rejects with the original error.Caveat
vitestis unavailable in this environment, so the spec ran underbun:testwith a shim outside the repo. It has not been executed under the project's real Vitest config, and the full suite was not run. CI should re-run the new spec and the full suite.Duplicate check
Open issues at scan time: #440, #435, #433. Open PRs: none. No issue/PR covers this race between path-based and canonical-
$idresolution of the same external document.