Repository navigation
Registry integrity - #30
Merged
Merged
Conversation
P12 refused two schemas claiming one resource URI but left three ways a URI could still be shadowed silently: - An `$id` equal to another document's retrieval URI registered, and was unreachable: lookups prefer the alias. - A retrieval URI reused for a different document silently repointed its alias. - Claiming a bundled metaschema's URI with different content succeeded on a fresh engine and failed once the metaschema had been used. All three are `DuplicateResourceError` now. The first two follow the TypeScript engine's ADR 0005. For the third, the owner ruled that bundled URIs are reserved for content equal to the bundled document, checked against `_bundled` before lazy registration so the answer no longer depends on order. A custom metaschema goes under its own URI. Resolves DESIGN.md §7 "P12 has three gaps where an identifier still shadows silently". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Groundwork for `unregister`, matching the TypeScript engine's ADR 0005: - `_owned_resources` maps a document root to every resource its last registration claimed -- exactly P12's claim set, so nothing new is collected. `_resource_locations` stays the truth for who owns a resource now. - When an equal embedded copy takes over a resource that was a document of its own, that document stops being one and loses its ownership record and range lookup. - The journal gains `_pop`, a removal recorded like a write so undo puts it back. Only `_documents` promises an order, and nothing removes from it mid-registration. A re-registration without a range lookup now drops the old one: equal JSON can come from differently formatted text, and a caller who re-registers without positions has said there are none. Resolves DESIGN.md §7 "A stale range lookup survives a re-registration". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
P12 made a modified re-registration a `DuplicateResourceError`, and nothing could undo a registration, so an edit-and-re-register loop needed a fresh engine. `SchemaRegistry.unregister(uri)` and `Engine.unregister_schema(uri)` take the shape the TypeScript engine's ADR 0005 decided: no `replace=`, so remove then register is the replacement path. `uri` must name a document root, directly or by retrieval URI. Anything else is `UnresolvableReferenceError`, naming the owning document for an embedded resource. Removal drops what the document still owns -- a resource an equal copy in a later document has taken over stays with that document -- plus the document's range lookup and every alias pointing at it. The produced/consumed unions and the pending queue are left alone. Snapshots, and so compiled artifacts, keep everything. It is refused on a snapshot, from caller code inside a registration (whose rollback would undo it), and for a bundled metaschema, whose URI is reserved. Resolves DESIGN.md §7 "No way to replace a registered document". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
No description provided.