Repository navigation
Declare the URLCode extension contract every package is built for (#844) - #906
Merged
Merged
Conversation
…built for (#844) Core exports one integer extension contract (`extensionContract`, 1), bumped only on a breaking change to the descriptor format, defineExtension/composeHost or the registration and activation interfaces, never with core's semver. Every urlcode.json descriptor (both kinds) and every defineExtension definition must declare `contract`; any other value, or none, is refused naming both versions: - extensions/artifacts add, from the installed descriptor before any entry is imported, with the usual rollback; - list --strict and static validate for installed and declared extensions; - the inert-artifact check (artifacts list, inspection, upgrade); - defineExtension, and again composeHost before any host() runs. build:addons writes each first-party extension's contract from its definition, refuses one that differs from core's, and stamps first-party artifact descriptors. A single integer instead of a range: the number moves only on breaking changes, so a range could only claim compatibility with an untested contract. Tests: a compatible (greeting) and an incompatible (beyond, contract 2) independent fixture through add, list --strict, validate and composeHost; an independent package that bundles its own @jimhoyd/urlcode is refused at add and reported by list --strict (the fake npm now locks bundled dependencies as npm does); a locked independent package survives upgrade and a catalog change with its own version; first-party descriptors carry the contract. Docs: an "extension contract" section and descriptor field in EXTENSIONS.md, the stale "descriptor-only discovery ... not a general third-party package resolver" and "add/remove do not manage third-party packages" prose rewritten, RIM-ADDON-001 updated. The core packed/unpacked budgets are raised with measurements: main at 4a09546 is already over the packed budget in CI. BREAKING CHANGE: urlcode.json and defineExtension definitions require `contract`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
enabled auto-merge (squash)
September 29, 2026 12:45
…dget Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dget with Node 24 margin Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
added a commit
that referenced
this pull request
Sep 29, 2026
…easure core budget Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 29, 2026
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.
Closes the remaining #844 gaps found by the audit.
Extension contract
extensionContract = 1(also from@jimhoyd/urlcode/extensions).urlcode.jsonformat,defineExtension/composeHost, the registration and activation interfaces, and the extensions exports.urlcode.json(extensions and artifacts) and everyExtensionDefinitionmust declarecontract.build:addonswrites it for first-party packages and refuses a mismatch.extensions add/artifacts add, before any entry is imported, with rollback;list --strictand staticvalidate;defineExtension;composeHost, before anyhost()runs.Tests
@example/urlcode-beyond(contract 2): refused at add with full rollback. If npm-installed by hand, it is caught bylist --strict,validateandcomposeHost.@jimhoyd/urlcodeis refused at add and reported bylist --strict.urlcode upgradeand a catalog change, and keeps its own version.Docs
Evidence (macOS, Node 26)
npm test1179,npm run verifyandtest:packagepass.Limits:
upgradecan't check independent packages against the target core's contract before switching; the new core'svalidatecatches declared ones.🤖 Generated with Claude Code