feat(spec): structured buttons + defaults config on FormViewSchema (#2998)#3014
Merged
Merged
Conversation
…2998) Track A of #2998: give the renderer-invented flat form keys ObjectUI's ObjectForm reads today (showSubmit/submitText/showCancel/cancelText/ showReset/initialValues — objectui#2545) a real home in the protocol, instead of being silently stripped by the strip-mode FormViewSchema container (the "parsed -> silently inert" shape ADR-0078 prohibits). - New optional `buttons` block: per-button `{ show, label }` for submit/cancel/reset via a new exported FormButtonConfigSchema leaf, `.strict()` per ADR-0089 D3a so typo'd keys error loudly. - New optional `defaults` record: initial field values for create-mode forms, keyed by field machine name (absorbs objectui `initialValues`). - Both marked [EXPERIMENTAL — NOT ENFORCED, #2998] per ADR-0078's escape hatch: the framework has no runtime consumer of FormViewSchema, so the contract ships ahead of its ObjectUI consumer without a false promise. The marker matches the liveness ledger's experimental regex, ready for Track B (enrolling `view` in GOVERNED — separate PR per the issue). - Purely additive (strip-mode container): minor changeset, no tombstone. - Tests: parse round-trips, strict-leaf rejection of legacy flat keys, experimental-marker assertion. api-surface.json regenerated (+2 exports); ui/view.mdx reference regenerated (scoped hunks only). Refs ADR-0078, ADR-0089 D3a, objectui#2545, objectui#1763. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Ue47V8zZ5QhcYMPiRQDA7
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 97 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 16, 2026 09:05
Conflict resolution: content/docs/references/ui/view.mdx (auto-generated) regenerated via gen:docs on the merged tree; api-surface.json auto-merge verified identical to regenerated output; json-schema.manifest.json (disappearance ratchet, #3012, new on main) picks up +ui/FormButtonConfig. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Ue47V8zZ5QhcYMPiRQDA7
This was referenced Jul 16, 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.
实现 #2998 的 Track A:为
FormViewSchema增加结构化的buttons+defaults配置(Track B —— 将view纳入 liveness ledger —— 按 issue 的排期约定另开专门 PR,不在本 PR 范围内)。背景
objectui 侧的
ObjectForm今天读取一组 spec 中不存在 的扁平表单键(showSubmit/submitText/showCancel/cancelText/showReset/initialValues,见 objectui#2545 与docs/audits/2026-06-viewschema-property-liveness.md:25)。FormViewSchema是 strip 模式容器,这些键在.parse()时被静默剥除 —— 正是 ADR-0078 禁止的 "parsed → silently inert" 形态。本 PR 按 issue 中的草图把这组渲染器自造键收编进协议。变更内容
buttons(新增可选顶层键,紧邻submitBehavior):submit/cancel/reset三个动作按钮的{ show, label }结构化配置。叶子 schemaFormButtonConfigSchema(新导出)按 ADR-0089 D3a 使用.strict(),拼错键(如把submitText写进buttons.submit)会大声报错而不是消失;label复用I18nLabelSchema。defaults(新增可选顶层键):create 模式表单的初始字段值,按字段机器名(machine name)索引 —— 收编 objectui 的initialValues。FormViewSchema没有运行时消费者,新增无人读取的可写面本身就是 parsed-but-inert。由于本 session 仓库范围仅限 framework,无法同批联动 objectui 渲染器,故按 issue 列出的 fallback 形态落地:两个键的 TSDoc 与.describe()均标注[EXPERIMENTAL — NOT ENFORCED, #2998],直到 objectui 侧接线(objectui#2545)。该标记与 liveness ledger 的 experimental 正则(check-liveness.mtsMARKER_RE)匹配,Track B 入册时可直接归类为experimental,不会挡 gate。view.test.ts新增 6 例):解析往返、部分配置、strict 叶子对旧扁平键/拼错键的拒绝、experimental 标记断言;api-surface.json重新生成(+2 个导出);自动生成的content/docs/references/ui/view.mdx同步再生(仅本变更相关的 hunk;gen:docs顺带再生的无关陈旧文件已回退,未纳入)。遗留的开放问题(维持现状,未动)
nextText/prevText目前 spec 中并不存在,showStepIndicator已在 spec —— issue 中标记为 open question,本 PR 不折叠进buttons,留待 objectui 接线时一并定夺。submitBehavior在审计中被判定为 dead(无渲染器消费者,audit L20)—— 与新块相邻,建议在 objectui#2545 接线时一并布线或另行处置。验证
pnpm test(turbo 全仓)126/126 任务全绿;spec 包 253 个测试文件 6861 例通过。pnpm --filter @objectstack/spec build+gen:api-surface通过,surface diff 仅 +FormButtonConfigSchema/ +FormButtonConfig。Grounding: ADR-0078(escape hatch)、ADR-0089 D3a(strict 叶子)、ADR-0049/0050。Refs objectstack-ai/objectui#2545、objectstack-ai/objectui#1763。
Refs #2998(仅完成 Track A;Track B 另开 PR 跟踪,不要因本 PR 合并而关闭该 issue)。
🤖 Generated with Claude Code
https://claude.ai/code/session_013Ue47V8zZ5QhcYMPiRQDA7