fix(cloud-connection): don't refuse upgrading an orphaned marketplace install#2174
Merged
Conversation
… install `findConflict` classified any manifest present in the engine registry but absent from the on-disk ledger as `user-code`, and the install endpoint then refused the upgrade with "manifest_id … is already defined by this runtime's local code. Refusing to overwrite" (and told the user to edit objectstack.config.ts — where it isn't). But a marketplace package is hot-registered AND recorded in the ledger. If the ledger entry goes missing or out of sync — a half-finished upgrade that left a `.bak`, a manual cleanup, a corrupted file — the manifest stays registered while `ledger.has()` returns false. The package is now an ORPHANED marketplace install, not local code, yet every reinstall/upgrade was blocked with a misleading error. (Hit live: a stale `app.objectstack.template.project.json.bak` made the showcase refuse to install the fixed version.) Disambiguate by source instead of by "is it registered": - Snapshot the manifest ids already in the engine registry at `kernel:ready`, BEFORE rehydrating the ledger — those are genuine AppPlugin/config code. - findConflict: ledger entry ⇒ 'marketplace'; in the boot snapshot ⇒ 'user-code' (still protected); registered but in neither ⇒ orphaned marketplace install ⇒ 'marketplace' (allow the upgrade to overwrite) rather than 'user-code'. Adds `marketplace-install-local-conflict.test.ts` (3 cases: real user code refused, orphaned install allowed, fresh install clean). 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 1 package(s): 1 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
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
findConflicttreated any manifest present in the engine registry but absent from the on-disk ledger asuser-code. The install endpoint then refused the upgrade:…and pointed the user at
objectstack.config.ts, where it isn't defined.But a marketplace package is both hot-registered and recorded in the ledger. If the ledger entry drifts out of sync — a half-finished upgrade that left a
.bak, a manual cleanup, a corrupted file — the manifest stays registered whileledger.has()returnsfalse. It's now an orphaned marketplace install, not local code, yet every reinstall/upgrade was blocked.Hit live while fixing a showcase: a stale
app.objectstack.template.project.json.bak-0.1.0made the runtime refuse to install the corrected version with this exact misleading error.Fix
Disambiguate by source, not by "is it registered":
kernel:ready, before rehydrating the ledger, snapshot the manifest ids the engine registry already holds — those are genuine AppPlugin /objectstack.config.tscode.findConflict:marketplaceuser-code(still protected — real authored code is never overwritten)marketplace(allow the upgrade) instead ofuser-codeTests
marketplace-install-local-conflict.test.ts(3 cases): genuine user code refused (409), orphaned install allowed (no 409), fresh install clean. Fullcloud-connectionsuite green (51 tests); package builds clean (0 TS errors).🤖 Generated with Claude Code