Repository navigation
Reload hand-off for exclusive extension resources so stateful sites hot-reload; contact-form signal docs and example version alignment (#777, #793, #795) - #798
Merged
Conversation
…ources; store adopts it (#777) An in-process reload activates the replacement runtime while the serving one keeps serving, so the store's per-activation directory lock refused the replacement ("Store directory is already locked by this process") and a generated `init --with admin,form-records --example` site could not hot reload. Core (RIM-EXT-HANDOFF-001): an optional, additive `ExtensionInstance.handoff()` and `ExtensionActivation.handoff: ExtensionHandoff {value}`. Only `startServer`'s reload (createRuntime `replacing`, refused from startServer callers) asks the serving instance of the very same registration object for its offer just before that registration activates in the replacement; a throw rejects the reload ("failed to hand off for a reload"). Ownership is reference counted by the extension: a failed replacement's close and the retired runtime's close each drop only their own reference. Store: a per-registration directory lease (one lock, refcount, one shared write path per data file). The replacement joins the lease with a single-use token instead of locking again; every commit is applied to every live view of the file, so there is never a second writer; a changed declaration reloads, and a view that cannot represent a committed state answers 503. The records export and audit producer follow the newest live activation. Another registration, server or process is still refused. ui, auth (current activation and lifecycle hooks) and mail keep the newest live activation current and fall back to the previous live one on close: ui previously cleared its kit when the retired runtime closed, so every ui page answered 500 after a successful reload, and a failed reload switched ui, auth and mail off for the runtime still serving. Audit, admin, forms, form-records and abuse hold no exclusive per-activation resource. Tests: a synthetic exclusive extension in core, store reload/overlap tests, an in-process generated-composition reload in form-records, ui/auth/mail lifecycle tests, and a reload step in the packed add-on integration test. Docs: RIM-EXT-HANDOFF-001 card, EXTENSIONS "Reload hand-off", LOCAL-DEVELOPMENT, STORE "Single-writer lock and reload", store README, changelogs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
…nal; keep example runtime versions aligned with releases (#793, #795) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
jimhoyd
added a commit
that referenced
this pull request
Sep 26, 2026
#798 fixed #777, #793 and #795 with its own design (an extension handoff() hook with a reference-counted exclusive resource) and merged first. This resolves the conflict by taking main for all of that, so this branch's own reload-handoff, recipe-signal and example-pin changes are dropped. What remains is the context/plan-feature/MCP fix for #791 and #790 on top of main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 26, 2026
Closed
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 and change
#777 (reopened): a generic reload hand-off in the extension contract.
init --with admin,form-records --examplesite could not hot-reload.reload()activates the replacement runtime before closing the serving one, so the last-good snapshot survives a failure, and the store's second activation in the same process failed withStore directory is already locked by this process.@jimhoyd/urlcode/extensions.ExtensionInstance.handoff?()is offered once per extension, in activation order, only during an in-processstartServerreload, and only from the serving instance of the very same registration object. It is never offered on a first activation or to any other command.undefinedresult reaches the replacement's activation ascontext.handoff = {value}.handoff()rejects the reload withextension-activation.RuntimeOptions.replacingis set only by the server's reload;startServerrefuses it from callers.RIM-EXT-HANDOFF-001; EXTENSIONS, LOCAL-DEVELOPMENT and STORE docs updated.#793: the contact-form recipe no longer promises that test/audit won't fire its signal.
urlcode test/auditfixtures are ordinary requests, so a fixture that reaches/contactcalls the granted destination. Only HEAD requests and the runtime's own health/readiness probes skip signals.examples/egresswere corrected the same way.#795: example runtime versions stay aligned.
examples/cloudflareandexamples/vercelnow pin the current core exactly.scripts/release-bump.tsrewrites@jimhoyd/urlcodein everyexamples/*/package.json, and its--checkstep (run bynpm run check) fails on a stale or ranged pin.Closes #777. Closes #793. Closes #795.
Verification
All runs used Node 26.10.0, on this exact head (main df0952d plus these two commits):
npm ci, build, workspace builds,npm run check,npm run audit:packagesandnpm run verifyall passed (exit 0).npm run test:packagepassed: 801780 packed / 3205208 unpacked bytes, 471 files; 39 packaged example commands ran from consumer copies.test/extension-handoff.test.ts: success, failure keeps the old runtime serving, the old close doesn't release, and exclusion holds;packages/store/test/reload.test.ts;packages/form-records/test/reload.test.ts, which runs the in-process composition;test/addons.integration.tson the real packed site: change the contact title, the new title is served, earlier records are readable and new writes work.Compatibility and security
Additive: extensions without
handoff()behave exactly as before. Store single-writer safety is preserved, and the cross-process lock is unchanged.Not covered by a reload: changes to
host.mjsitself, such as the storedirectoryoption, still need a restart. Locking is still single-host.Changed store declaration mid-reload: if the retiring runtime commits a record that the new declaration rejects, that collection answers 503 until a restart. It is refused rather than overwritten.
Test coverage: auth's failed-reload fix is covered by a unit test, not by a failed reload on the real composition. This is test evidence, not an independent security review.
Changes match the documented portable contract; docs/examples are updated where needed.
Relevant tests and package checks pass, or limitations are explained above.
No credentials, customer data or private project material are included.
Runtime/starter changes remain aligned where applicable.
🤖 Generated with Claude Code
https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
Generated by Claude Code