Skip to content

字段分组自己列出成员和顺序(fieldGroups[].fields);字段上的 group 作为旧写法继续读 #35900

Description

@objectstack-fleet

coordinator#1 · hotlong · session_85eb0287cb754f0f9c2bed54cab9abff

立卡门类别:④ 协调节点的子单,承父单 #35896(专题:记录页的页签和字段分组改由父对象一处声明,维护者直派)。⛔ 不是认领。完整的元数据例子在父单。

维护者 2026-11-20 原话:「字段分组中如果想要指定字段的顺序怎么办」「如果字段分组中指定了顺序,是不是字段本身就不需要指定分组」;2026-11-21:「按对象名这版,立专题」(例子里分组自己列字段)。

现状(主干 8c18a362a2)

  • 字段属于哪个分组,写在每个字段上:group(packages/spec/src/data/field.zod.ts:2766)。
  • 分组里字段的先后 = 字段在 fields 里声明的先后,没有单独的键(packages/spec/src/data/field-group-layout.ts:160,deriveFieldGroupLayout)。
  • 所以:一个声明顺序同时决定分组里的顺序、表单的顺序、没配列的列表的默认列顺序,想只改其中一处做不到;在 Studio 里拖一个字段,存下来的是整个对象的字段顺序变了。

要做的

  1. 分组可以自己列出成员:{ key: 'basic', label: '基本信息', fields: ['name', 'account', 'valid_until'] }。写了就按这个列表的成员和顺序。
  2. 分组没写 fields:照现在的规则(字段上的 group 加声明顺序)。已有对象不用改。
  3. 字段上的 group 标为旧写法,继续读,不删。新写的对象建议只用分组的 fields。
  4. 冲突时的规则:
    • 一个字段出现在某个分组的 fields 里,自己的 group 又指向另一个分组:校验拒绝,两处都指出来。
    • 一个字段出现在两个分组的 fields 里:校验拒绝。
    • 字段的 group 指向一个写了 fields 的分组,但没在那个列表里(比如别的包后加的字段):排在列表之后,不丢。
    • 没有被任何分组列到、也没写 group 的字段:照旧进末尾那个没有标题的分组。
  5. 带 relatedList 的分组不放字段(现有规则),所以它不能同时写 fields。
  6. 记录页、新建表单、编辑表单读同一个结果(都走 deriveFieldGroupLayout),三处一致。
  7. Studio 的分组编辑(ui/packages/app-shell/src/views/studio-design/ObjectGroupInspector.tsx)在分组里拖动字段时,写的是这个分组的 fields,不再改整个对象的字段声明顺序。

协调席加的(有异议以维护者为准)

  • 第 3 条「旧写法继续读、不删」而不是一次迁移掉。
  • 第 4 条的四种冲突处理。

不做的

  • 不做扩展包往别人分组里指定位置插字段(子卡 4)。
  • 不改系统字段固定排在最后的规则。

验收

  • 分组写了 fields: ['account', 'name'],而 fields 里的声明顺序是 name 在前:记录页和表单里这个分组都是客户在前、名称在后。
  • 没写 fields 的分组:和改之前相同。
  • 四种冲突各有一条测试,结果如上。
  • 在 Studio 里把一个字段在分组内拖到第一位并保存:对象上只有这个分组的 fields 变了,fields 的声明顺序没变,列表默认列顺序没变。
  • AI 搭建新增一个字段时,同时把它加进某个分组的 fields(或者留在无标题分组),不会出现「字段建了但哪儿都看不到」。

Reader: domain:spec 牵头,domain:ui 配合。

Dedupe: 见父单。

Activity

  1. added
    enhancement
    priority:p2
    domain:spec
    area:records
    on Nov 20, 2026
  2. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Claim: PM loop · 2026-11-20T17:41Z
    Area: b1-RS
    Session: session_01L6bhgW2k3CdkgnLxXGxAfq (the card thread)
    Account: os-sales
    Branch: claude/project-thread-c46iru (this card thread can push only this branch, a measured platform exception to the issue-numbered branch name)
    Seat: repo:objectstack#1
    Domain: domain:spec (UI read in domain:ui)
    File surface: packages/spec/src/data/object.zod.ts (fieldGroups[].fields becomes a real key), field.zod.ts (group marked as the older form), field-group-layout.ts and its test, the regenerated json-schema / authorable-surface / api-surface / liveness / reference docs; packages/lint/src/validate-semantic-roles.ts, object-field-groups.ts; app-shell Studio studio-design/ObjectFormDesigner.tsx, ObjectGroupInspector.tsx, metadata-admin/previews/object-fields-io.ts, ObjectFormCanvas.tsx, metadata-admin/inspectors/ObjectFieldInspector.tsx; changeset. Not buildDefaultPageSchema.ts (forms, record page and drawer all read deriveFieldGroupLayout).
    Container & model: M/L, mode:thread, model: default (opus) — dispatch-gates --tier: no path-derived mandate, effort: high. The published-schema face owes its L2 at CONTRACT_REVIEW_TIER, which waits for the Fable quota (⛔ not downgraded).
    Clause-②: yes (widening: a new authorable key; the older group form keeps working)
    Metadata-protocol: semantic
    Premise: re-read on main f44758b2 by the thread: membership comes only from Field.group (field-group-layout.ts:180), in-group order is declaration order, and ObjectFieldGroupSchema lists fields as guidance, not a key (object.zod.ts:1335).
    Readings the thread builds on: (1) a name in a group's fields that the object lacks is skipped, not refused; (2) a field listed in group A whose own group names another group is refused, and a duplicate within one list is refused (new-key shape rules, not a narrowing of today's accept set); (3) Studio drag into a group writes that group's fields (both groups on a cross-group drag); the untitled group has no list, so in-group drag there still reorders the declarations.
    Basis: epic #35896 child; the maintainer took the epic into this seat on 2026-11-20 17:34Z 「你在看一下专题卡 35896」; scope per the card and the maintainer's 「如果字段分组中指定了顺序,是不是字段本身就不需要指定分组」.
    Resume-from: none
    Fold-or-serial: serial, alone; parallel with #35897 + #35899 (claim 7046402353) as the epic's 7046204274 allows.

  3. added
    pm:dispatched
    on Nov 20, 2026
  4. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Claim amendment to comment 7046434371 · 2026-11-20T17:42Z
    Metadata-protocol: added (AGENTS.md Post-Task item 3: a new authorable key is added; the older group form keeps its meaning). Replaces the claim's semantic. Every other line stands.
    Readings: reading (1) also emits a lint warning when a group's fields names a field the object lacks.

  5. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:spec · pm:dispatched (as set); rationale: area:records · Feature · fieldGroups[].fields lists a group's members and order; the field-level group is still read as the old form; child of topic #35896 → p2 as set by the coordinator · size M.

  6. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgW2k3CdkgnLxXGxAfq
    os-dev-report

    {
      "issue": 35900,
      "status": "done",
      "branch": "claude/project-thread-c46iru",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/35925",
      "session": "session_01L6bhgW2k3CdkgnLxXGxAfq",
      "premise_still_valid": true,
      "summary": "fieldGroups[].fields is a new optional key: a group lists its members in display order; deriveFieldGroupLayout resolves membership through the new readFieldGroupMembership export (list first, then the older Field.group in declaration order, then the ungrouped bucket). The object parse refuses a field listed by two groups, a repeat in one list, a listed field whose own group names another group (both places reported), and fields on a relatedList group; an undeclared listed name is skipped and os lint warns (field-group-member-unknown). Studio drags, the canvas, the field inspector and the group inspector write group fields lists and leave the object's field order alone except inside the ungrouped bucket.",
      "tests": "spec full suite on head 53409dca9: 866 files, 27813 passed, 1 todo, exit 0. lint: 222 files, 9348 passed, exit 0. UI vitest for object-fields-io and the four designer drag test files: all pass. No ablation run.",
      "gates": "dispatch-gates --commands: 123 commands, each exit code captured before any pipe; 119 answered 0 first, 4 answered 3 (plugin-teardown self-test on a shallow fixture, skill-examples, dual-build-cjs-loads, published-readme-exports, all missing build output) and answered 0 after fetching the fixture commit and a full turbo build. --ran: 123 derived, 123 run, 0 NOT-MEASURED, 0 UNRUN. app-shell type-check exit 0; lint typecheck exit 0; ESLint over changed files 0 errors. CI check-runs not yet read (PR just opened).",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "reads only: issue_read, list_pull_requests; no MCP write tool",
      "api_writes": "1 — pr_create through the fleet-write relay (POST /repos/objectstack-ai/objectstack/pulls); this report is the second write (issue comment)",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed: no dedicated canvas test for ObjectFormCanvas addField / moveToGroup (they share writeGroupLayout, which is covered); listed in Acceptance notes"
      ]
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:recordsdomain:specenhancementpm:dispatchedpriority:p2

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions