docs(ui): field-group derivation is authorized by fieldGroups, not by field.group alone (#5458) - #5763
Merged
Merged
Conversation
…by `field.group` alone (#5458) Two UI guides taught that form sectioning derives from `field.group` by itself, and neither page mentioned `fieldGroups` at all. Copying either one yields a FLAT form: `deriveFieldGroupLayout` (ADR-0085 §5) buckets only fields whose `group` matches a declared `fieldGroups[].key`, and with no declared group it returns null outright — so an undeclared `group` renders exactly like no `group`, and `os lint` reports `field-group-undeclared`. Same falsehood as #5443, one layer up: that issue fixed the showcase object the two pages link to as their runnable example; this fixes the prose that cites it. - create-vs-edit-form.mdx §2: the derivation's authorization source, the undeclared-equals-unwritten equivalence, and the lint rule name. Also drops "equivalent grouped form" for the two measured differences a derived form really has (platform-injected `owner_id` lands in the trailing untitled section; `columns` is a form-view knob the group declaration cannot carry). - field-grouping-and-order.mdx: same three facts on the semantic-grouping section, and its sample — previously a `fields: {…}` fragment with no declaration side — becomes a self-contained `ObjectSchema.create` with the matching `fieldGroups`, marked `{/* os:check */}` so the gate type-checks it against the built spec instead of leaving the corrected example ungated.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
os-zhuang
marked this pull request as ready for review
August 6, 2026 04:58
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.
Fixes #5458
两篇 UI 指南把表单分组说成「派生自
field.group自身」,全文不出现fieldGroups。读者照抄拿到的是一张平铺表单。#5443 已修示例层(showcasecontact.object.ts,正是这两篇「Runnable example」链接的文件),本 PR 修引用它的文档正文。前提复证(当前 main
889ae474,实测非读码)packages/spec/src/data/field-group-layout.ts语义逐字核对通过:deriveFieldGroupLayout实测group,无fieldGroups)null—— 分组根本不适用fieldGroups声明contact/status,成员正确group值未命中已声明 keygroup的字段进同一个尾部无标题桶:{"fields":["stage","plain"]}第三行是「未声明的
group等同于没写group」的直接证据 —— 两者字面进同一个桶。packages/lint侧:文档今日样例报 3 条field-group-undeclared(warning);补上声明后 0 条;「部分声明 + 一个未命中」同样报。规则注册为commands: ALL=['validate','build','lint'],故正文写「os lint(以及os build/os validate)」。派生实现的唯一性也复核过:消费者是各渲染面与packages/cli/src/utils/i18n-extract.ts的walkObjectSections。顺带实测了 #5443 量到的两处「省略
form后的真实差异」,都在当前 main 复现,因此把 §2 原来的 “derive an equivalent grouped form” 一并校准:applySystemFields注入的owner_id未被分组 → 落进尾部无标题段(FIELD_GROUP_SYSTEM_FIELDS不含owner_id);key/label/icon/description/collapse+ 成员 —— 没有columns,手写的columns: 2派生给不回来。改动(仅这两篇 mdx)
content/docs/ui/create-vs-edit-form.mdx—— §2 补三要素(授权来源 / 未声明等同没写 / 规则名),group表格行与代码块注释同步;并把 “equivalent” 换成上面两条实测差异。content/docs/ui/field-grouping-and-order.mdx—— 语义分组小节补同三要素;样例原是fields: {…}片段(只有成员侧、没有声明侧),改为自包含的ObjectSchema.create+ 对齐 showcase 的fieldGroups,并挂{/* os:check */}。排查过同一谎言的其余落点:全仓
group: '…'且不提fieldGroups的文件只剩 4 个(ui/setup-app.mdx、automation/approvals.mdx、objectstack-automation/SKILL.md、ADR-0029),经查全是另一个group(审批分组 / 导航分组),与Field.group无关 —— 本次修正半径就是这两篇。os:check 门禁:存在,且新样例已实际纳入
{/* os:check */}有真实消费者 ——packages/spec/scripts/check-skill-examples.ts,对标记块跑tsc --noEmit打到已构建的 spec.d.ts;逐块 opt-in。create-vs-edit-form.mdx原本已在册,field-grouping-and-order.mdx一个标记都没有(其代码块是片段)。所以修正后的样例不是「顺手过门禁」,而是新纳入门禁:204 marked example(s) across 74 file(s)✅,列表中无field-grouping-and-order.mdx205 marked example(s) across 75 file(s)✅,新增content/docs/ui/field-grouping-and-order.mdx:34反向验证(方向先判后跑,预判「红,且落在注入行」):把新样例的
label: 'Status'改成label: 42→ 门禁转红,报在content/docs/ui/field-grouping-and-order.mdx:43:23——error TS2322: Type 'number' is not assignable to type 'string'.,即注入行本身;还原后复绿 205 ✅。证明这 +1 是活覆盖,不是空跑绿。其他验证
pnpm --filter @objectstack/docs build→DOCS_BUILD_EXIT=0(mdx 语法完整)node scripts/check-nul-bytes.mjs(含--self-test)✅;改动文件按[\x00-\x08\x0b\x0c\x0e-\x1f]自扫零命中check-doc-authoring(362 files clean)、docs-audit/check-audit-scope均 ✅lint.yml里 TypeScript Type Check job 的 “Check skills TypeScript examples compile” 步骤(在 “Build workspace packages” 之后),所以该 job 转绿即代表新纳入的样例在 CI 里真的被编译过。skip-changeset标签 04:14:20 才落,标签事件触发的后续两次 run 均已skipped。需 PM 重跑该 check 收尾。边界
未碰
content/docs/releases/、examples/(#5443 已修)、spec/lint 代码。文档-only,无用户可见行为变更 → 走skip-changeset标签路线,不写空 frontmatter changeset。