Skip to content

feat(metadata): list pending drafts — Studio draft discoverability backend (ADR-0033)#1552

Merged
xuyushun441-sys merged 2 commits into
mainfrom
feat/adr-0033-draft-discoverability
Jun 3, 2026
Merged

feat(metadata): list pending drafts — Studio draft discoverability backend (ADR-0033)#1552
xuyushun441-sys merged 2 commits into
mainfrom
feat/adr-0033-draft-discoverability

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Context

After an AI builds an app, its objects/views land as drafts (sys_metadata rows with state='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 (mirrors list() but scoped to state='draft', optionally narrowed by package), returning a light header projection (no body) carrying packageId.
  • 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/:type param route (mirroring the diagnostics route) so _drafts isn't captured as a type name; mirrored in the dispatcher as a fallback.

Read-only; no change to existing list/publish paths.

Verification

  • Live (showcase): an AI build of a "customer support" app produced 5 drafts; GET /api/v1/meta/_drafts returns all 5 with their packageId, and ?packageId=app.customer_support filters to them.
  • Unit: repo projection/filtering by state+package+type; dispatcher route (+501 fallback, no type collision); REST route registered before /meta/:type. Full objectql (495) + runtime (339) + rest (78) suites green.

🤖 Generated with Claude Code

os-zhuang and others added 2 commits June 3, 2026 10:10
…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>
@vercel

vercel Bot commented Jun 3, 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 3, 2026 2:29am

Request Review

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling and removed size/m labels Jun 3, 2026
@xuyushun441-sys xuyushun441-sys merged commit a75823a into main Jun 3, 2026
12 checks passed
@xuyushun441-sys xuyushun441-sys deleted the feat/adr-0033-draft-discoverability branch June 3, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants