feat(metadata): list pending drafts — Studio draft discoverability backend (ADR-0033)#1552
Merged
Merged
Conversation
…ackend) Add SysMetadataRepository.listDrafts + protocol.listDrafts + GET /api/v1/meta/_drafts so the console can surface draft-state metadata that the active-only getMetaItems list hides (a just-built app package no longer looks empty). Read-only; reuses the overlay repo. Unit tests for the repo projection/filtering and the dispatcher route (+501 fallback, no type collision). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The REST server's Hono `/meta/:type` param route was capturing `_drafts` as a type name, so the dispatcher fallback never ran. Register `/meta/_drafts` (→ protocol.listDrafts) before `/meta/:type`, mirroring the `diagnostics` route. Also harden the dispatcher's mirrored guard to accept method-less GET. Verified live: an AI-built app's drafts now surface via /api/v1/meta/_drafts (filterable by packageId). Co-Authored-By: Claude Opus 4.8 <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.
Context
After an AI builds an app, its objects/views land as drafts (
sys_metadatarows withstate='draft', bound to the app package). But the only list path —getMetaItems— reads the active registry, so drafts were invisible: a just-built app package looked empty in Studio and there was no "pending changes" surface. (Diagnosed live: the metadata is created and correctly package-bound, just hidden because the browsers are active-only.)This adds the backend so the console can surface drafts. (Frontend is a companion objectui PR.)
Change
SysMetadataRepository.listDrafts({type?, packageId?})— lists draft rows (mirrorslist()but scoped tostate='draft', optionally narrowed by package), returning a light header projection (no body) carryingpackageId.protocol.listDrafts({packageId?, type?, organizationId?})— exposes it over the overlay repo.GET /api/v1/meta/_drafts?packageId=&type=— registered in the REST server before the greedy/meta/:typeparam route (mirroring thediagnosticsroute) so_draftsisn't captured as a type name; mirrored in the dispatcher as a fallback.Read-only; no change to existing list/publish paths.
Verification
GET /api/v1/meta/_draftsreturns all 5 with theirpackageId, and?packageId=app.customer_supportfilters to them./meta/:type. Full objectql (495) + runtime (339) + rest (78) suites green.🤖 Generated with Claude Code