feat(service-ai): ADR-0033 Phase A — draft-gate AI metadata authoring#1529
Merged
Conversation
Route every AI metadata write through the ADR-0027 draft workspace via
protocol.saveMetaItem({mode:'draft'}) instead of metadataService.register()
(which published straight to the live schema). The draft is the approval
gate; the never-enforced requiresConfirmation flag is retired.
- Add type-agnostic tools: create_metadata / update_metadata /
describe_metadata / list_metadata (work for any metadata type), validated
against each type's Zod schema with errors fed back to the agent.
- Reroute create_object / add_field / modify_field / delete_field through a
shared draft-write core (applyDraft); reads are draft-first so repeated
field ops stack into one draft.
- Result envelope: { status:'drafted', type, name, summary, changedKeys }.
- Update skill + agent instructions: propose drafts, never publish.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jun 2, 2026
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.
What & why
Implements Phase A of ADR-0033 — AI-assisted metadata authoring. The design center: the AI authors metadata; the human confirms and publishes.
Today every AI metadata tool persists via
metadataService.register(...), which publishes straight to the live schema — no draft, no review, no human gate (therequiresConfirmationflag existed but was never enforced). This PR closes that hazard structurally.What changed (all in
packages/services/service-ai)applyDraft()that callsprotocol.saveMetaItem({ …, mode:'draft' })— the same draft path Studio's designer already uses. Nothing goes live until a human publishes. The draft is the approval gate; the unenforcedrequiresConfirmationcomments are retired.create_metadata/update_metadata/describe_metadata/list_metadatawork for any type (view, dashboard, flow, …), not just objects.update_metadataapplies an RFC-7386 JSON merge patch to the single draft (read-modify-write, never forks).saveMetaItem's built-in Zod validation (getMetadataTypeSchema, ADR-0005) —422 invalid_metadataissues are returned to the agent as a fixable string error, never thrown.{ status:'drafted', type, name, summary, changedKeys }. Skill + agent instructions updated to "propose drafts, never publish."Verification
__tests__/metadata-tools.test.ts), DTS build clean, changed files tsc-clean.saveMetaItemcalled withmode:'draft',registernever called, validation errors fed back, drafts stack into one body, writes refuse safely when no protocol is wired.object/field(allowRuntimeCreate:true) draft through the repo path; editing a code-shipped object intentionally403s and is surfaced to the agent.Scope
Phase A only (framework / OSS). Out of scope, unblocked by this: B (objectui review/diff), C (blueprint + view/dashboard tools), D (EE governance).
🤖 Generated with Claude Code