fix(objectql): promoteDraft preserves the draft's package binding (AI-built apps stay hidden)#1834
Merged
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
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-eerig:GET /api/v1/meta/appreturned only the bundledcrm_enterprise, while 16 AI-built apps sat insys_metadataasstate=activebuthidden=trueandpackage_id=NULL.Root cause
ADR-0045: a materialized (additive) build leaves its app
hidden:true(unlisted) until Publish flips it. The visibility flip lives inPOST /packages/:id/publish-draftsand unhides hidden apps scoped to the published package:But
SysMetadataRepository.promoteDraft()calledput()without apackageId. The draft was staged bound to the workspace package (e.g.com.workspace), yet the promoted active row landed withpackage_id = NULL. The package-scoped unhide query then never matched it, sohiddenwas never flipped — the app stayed invisible forever.(Objects/views were unaffected because they're also surfaced via the SchemaRegistry; the
applist relies on the package-bound overlay row.)Fix
promoteDraft()now reads the raw draft row, carries itspackage_idonto the promoted active row, and reads the current active row through the same package scope so the optimistic-lockparentVersionstill matches. Package-less drafts (packageIdnull) behave exactly as before.Verification
objectqlsuite green (607 tests).objectos-ee: with the app carrying itscom.workspacebinding,publish-draftsreturnsunhiddenApps: ["ticket_service_app"]and the app then appears inGET /api/v1/meta/appand the home 全部应用 grid.🤖 Generated with Claude Code