Skip to content

fix(objectql): promoteDraft preserves the draft's package binding (AI-built apps stay hidden)#1834

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/meta-app-list-workspace
Jun 14, 2026
Merged

fix(objectql): promoteDraft preserves the draft's package binding (AI-built apps stay hidden)#1834
xuyushun441-sys merged 1 commit into
mainfrom
fix/meta-app-list-workspace

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Problem

AI-built apps (whole-app blueprint builds via the metadata assistant) never appear in the console's app switcher or home 全部应用 grid after publishing — the user builds an app, publishes it, the objects/views/data all materialize and work, but the app itself is unreachable from the UI (only by direct URL, rendered inside another app's shell).

Verified locally on the objectos-ee rig: GET /api/v1/meta/app returned only the bundled crm_enterprise, while 16 AI-built apps sat in sys_metadata as state=active but hidden=true and package_id=NULL.

Root cause

ADR-0045: a materialized (additive) build leaves its app hidden:true (unlisted) until Publish flips it. The visibility flip lives in POST /packages/:id/publish-drafts and unhides hidden apps scoped to the published package:

const apps = await protocol.getMetaItems({ type: 'app', packageId: id });
// unhide apps where app.hidden === true

But SysMetadataRepository.promoteDraft() called put() without a packageId. The draft was staged bound to the workspace package (e.g. com.workspace), yet the promoted active row landed with package_id = NULL. The package-scoped unhide query then never matched it, so hidden was never flipped — the app stayed invisible forever.

(Objects/views were unaffected because they're also surfaced via the SchemaRegistry; the app list relies on the package-bound overlay row.)

Fix

promoteDraft() now reads the raw draft row, carries its package_id onto the promoted active row, and reads the current active row through the same package scope so the optimistic-lock parentVersion still matches. Package-less drafts (packageId null) behave exactly as before.

Verification

  • New regression test: the promoted active row keeps the draft's package binding.
  • Full objectql suite green (607 tests).
  • End-to-end on objectos-ee: with the app carrying its com.workspace binding, publish-drafts returns unhiddenApps: ["ticket_service_app"] and the app then appears in GET /api/v1/meta/app and the home 全部应用 grid.

🤖 Generated with Claude Code

promoteDraft() called put() WITHOUT a packageId, so promoting a
package-bound draft to active created the active row unbound
(package_id = NULL). Every package-scoped reader then missed it — most
visibly the ADR-0045 publish visibility flip
(getMetaItems({ type:'app', packageId }) → unhide in publish-drafts),
which never matched a just-published AI-built app and left it hidden:true
forever (invisible in the app switcher / home "全部应用").

Read the raw draft row, carry its package_id onto the promoted active
row, and read the current active through the same package scope so the
optimistic-lock parentVersion still matches. Package-less drafts
(packageId null) behave exactly as before.

Adds a regression test asserting the promoted active row keeps the
draft's package binding.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Building Building Preview, Comment Jun 14, 2026 5:52am

Request Review

@xuyushun441-sys
xuyushun441-sys merged commit 3337cf5 into main Jun 14, 2026
7 of 8 checks passed
@github-actions github-actions Bot added the tests label Jun 14, 2026
@xuyushun441-sys
xuyushun441-sys deleted the fix/meta-app-list-workspace branch June 14, 2026 05:52
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