Skip to content

fix(cloud-connection): don't refuse upgrading an orphaned marketplace install#2174

Merged
xuyushun441-sys merged 2 commits into
mainfrom
fix/findconflict-orphaned-ledger
Jun 22, 2026
Merged

fix(cloud-connection): don't refuse upgrading an orphaned marketplace install#2174
xuyushun441-sys merged 2 commits into
mainfrom
fix/findconflict-orphaned-ledger

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Problem

findConflict treated any manifest present in the engine registry but absent from the on-disk ledger as user-code. The install endpoint then refused the upgrade:

manifest_id "app.objectstack.template.project" is already defined by this runtime's local code. Refusing to overwrite. Uninstall the local definition first.

…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 while ledger.has() returns false. 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.0 made the runtime refuse to install the corrected version with this exact misleading error.

Fix

Disambiguate by source, not by "is it registered":

  • At kernel:ready, before rehydrating the ledger, snapshot the manifest ids the engine registry already holds — those are genuine AppPlugin / objectstack.config.ts code.
  • findConflict:
    • live ledger entry ⇒ marketplace
    • in the boot snapshot ⇒ user-code (still protected — real authored code is never overwritten)
    • registered but in neither ⇒ orphaned marketplace installmarketplace (allow the upgrade) instead of user-code

Tests

marketplace-install-local-conflict.test.ts (3 cases): genuine user code refused (409), orphaned install allowed (no 409), fresh install clean. Full cloud-connection suite green (51 tests); package builds clean (0 TS errors).

🤖 Generated with Claude Code

… 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>
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 22, 2026 5:23am

Request Review

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cloud-connection.

1 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/cloud-artifact-api.mdx (via packages/cloud-connection)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: spec.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@xuyushun441-sys
xuyushun441-sys merged commit c213ed8 into main Jun 22, 2026
14 of 15 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the fix/findconflict-orphaned-ledger branch June 22, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants