fix(protocol): persist versionless package installs; drop sys_packages on delete#2540
Merged
Conversation
…s on delete (#2532) installPackage's durable half was guarded by `pkgSvc?.publish && manifest.version`, silently skipping every versionless runtime-created base ({id,name} from the builder/Setup) — in-memory only, gone after restart, while metadata/tables survived. Default the version (0.1.0) instead of skipping, log persist failures loudly, and make deletePackage drop the sys_packages row so uninstalled packages don't resurrect at boot via service-package hydration. Verified: unit tests (8/8) + three-boot E2E on one db — install → restart → still listed; DELETE → restart → stays gone. Fixes #2532 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 25 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
…es persist too The duplicate path did a bare registry.installPackage — the copied base would vanish from GET /packages on restart, same #2532 mechanics. Route through installPackage to get the durable sys_packages write (and version default). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…re scope-less Two more holes found browser-verifying the duplicate journey: 1. dispatcher-plugin never MOUNTED the newer handlePackages branches — duplicate (ADR-0070 D4), adopt-orphans (D5), discard-drafts, commits / commit-revert / rollback (ADR-0067) all 404'd at the hono layer on every serve stack despite working handler code. Mount them all; routing only. 2. duplicatePackage copied the SOURCE manifest verbatim — including scope (e.g. 'project'), branding the writable copy as read-only in every writability heuristic. The duplicate's manifest is now scope-less. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…istence Two objectql protocol tests asserted the pre-#2540 behavior: - installPackage used to SKIP sys_packages persistence for versionless manifests (the {id,name} shape the builder/Setup create), so base packages vanished on restart (#2532). It now defaults version to '0.1.0' and persists. Test updated to expect persistence with the defaulted version. - duplicatePackage used to do a bare registry.installPackage write and keep the source scope. It now routes through installPackage (so the copy also lands in sys_packages) and strips scope (a duplicate must be a writable base, not inherit the source's read-only scope). Test updated to assert the routed call + scope stripped. Co-Authored-By: Claude Opus 4.8 <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.
Fixes #2532 — runtime-created base packages vanished from
GET /packagesafter a server restart (their metadata and tables survived; only the package registration was lost).Root cause
protocol.installPackagewrites both package stores (in-memory registry + durablesys_packagesvia thepackageservice), but the durable half was guarded by:Runtime-created bases arrive versionless (
{id, name}from the builder / Setup) — so persistence was silently skipped for exactly those packages.service-packagehydratessys_packagesback into the registry at boot, so no row = no package after restart.Fix
0.1.0) instead of skipping persistence — the registry and the durable row must agree.persist FAILED … will not survive a restart) instead of silently succeeding in-memory (kept non-fatal by design).deletePackagedrops thesys_packagesrecord — otherwise, once installs persist, an uninstalled package would RESURRECT at the next boot via hydration.Verified
durable-package.test.ts— versionless persists with defaulted version; explicit version untouched; persist failure non-fatal + loud; delete drops the durable row. metadata-protocol suite 8/8.Found while browser-demoing the login→build journey; workaround (re-POST same id) no longer needed.
🤖 Generated with Claude Code