feat(spec,runtime): make seed a first-class, publish-applied metadata type#1611
Merged
Conversation
…ta type Initialization / fixture data becomes a runtime-draftable metadata type (`seed`), authored and published through the same draft → publish flow as object/view/app (ADR-0033). Publishing a seed draft is what actually loads its rows — so an author (or the AI metadata assistant) can stage sample/ seed data as a reviewable draft and make it live with one publish. Mechanism only (open-core): the AI that *generates* seed rows lives in the private studio package; this is just the type + apply path. spec: - register `seed` in MetadataTypeSchema + DEFAULT_METADATA_TYPE_REGISTRY (domain: data, allowRuntimeCreate, loadOrder 95 so referenced objects already exist), bind it to SeedSchema in the type→schema map. - add SeedSchema/Seed (shares the Dataset shape today, named separately so the `seed` type can evolve independently of the analytics-bound `dataset`). runtime: - publish-drafts handler applies every just-published `seed` via the existing SeedLoaderService (best-effort, idempotent upsert, never fails the publish; result surfaced under `seedApplied`). Lives at the runtime layer because the loader needs the data engine + metadata service, which objectql cannot depend on without a cycle. 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.
动机
初始化/示例数据应当是平台一等公民,而不是旁路 insert。本 PR 把
seed做成运行时可草拟、发布即落数据的元数据类型——和 object/view/app 一样走 stageDraft → 发布(ADR-0033)。发布一条 seed 草稿 = 把它的记录真正写入目标对象。这样 AI 元数据助手(或任何作者)可以把示例/种子数据当作可审阅的草稿暂存,一键发布即生效。机制开源、智能闭源:生成 seed 行的 AI 在私有 studio 包,这里只放类型 + 应用路径。
dataset名保留给未来的数据分析能力,故新类型独立命名为seed(当前复用 Dataset 形状)。改动
spec
MetadataTypeSchema+DEFAULT_METADATA_TYPE_REGISTRY注册seed(domain: data、allowRuntimeCreate、loadOrder 95 使被引用对象先就绪),在 type→schema 映射绑定SeedSchema。SeedSchema/Seed(复用 Dataset 形状,独立命名以便seed与分析向的dataset各自演进)。runtime
seed调用既有SeedLoaderService落数据(best-effort、幂等 upsert、绝不因 seed 失败而让发布失败,结果并入响应的seedApplied)。放在 runtime 层是因为 loader 需要 data engine + metadata service,objectql 不能反向依赖 runtime。验证
tsc --noEmit0 错误。后续(分开 PR)
create_seed工具,AI 用 ai.generateObject 生成符合对象 schema 的行 → stageDraft(type:'seed');skill 指示"建完→提议填充示例数据"。