Skip to content

扩展包给别人的对象加字段、分组、子表时声明放在哪(排在谁后面);带来的东西自动出现在指定位置 #35901

Description

@objectstack-fleet

coordinator#1 · hotlong · session_85eb0287cb754f0f9c2bed54cab9abff

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

维护者 2026-11-20 原话:「扩展包给「客户」加一个字段,这是基本需求,而且还涉及到排序,有没有好方案」「扩展包也会涉及到给对象增加子表,也会需要改子表的位置」;2026-11-21:「按对象名这版,立专题」(例子里含扩展包的写法)。

现状(主干 8c18a362a2)

  • 扩展别人的对象用 objectExtensions(packages/spec/src/data/object.zod.ts:6070):能带新字段、改已有字段的显示名、校验、索引,有一个优先级数字决定多个扩展的先后。
  • 不能带分组,不能说位置。新字段靠自己写 group 进到原对象的某个分组,只能排在末尾。
  • 扩展包带来的子对象指向这个对象时,会作为子表自动出现在页签里,位置按自动规则,定不了。
  • 本专题子卡 1、3 做完后还会多两个问题:原对象声明了 relatedLists 之后,扩展包的子表不在列表里;原对象的分组列了 fields 之后,扩展包的字段不在列表里。本卡一并解决。
  • HotCRM 目前没有用 objectExtensions,没有历史包袱。

要做的

  1. 扩展里新增一个键,说明自己带来的东西放在哪(键名暂定 place):
    • 字段:{ field: 'tax_id', group: 'basic', after: 'industry' } —— 放进「基本信息」,排在「行业」后面。也可以写 before。
    • 分组:{ group: { key: 'tax', label: '税务' }, after: 'basic' } —— 加一个自己的分组,排在「基本信息」后面。这个分组可以指向一张子表(relatedList),用来把扩展包的主从子表放进字段区。
    • 页签:{ list: 'contract', after: 'opportunity', columns: [...] } —— 加一个页签,排在「商机」后面,可带标题和列。
  2. 合并规则:
    • 先按原对象的声明排好。
    • 扩展的每一项插到它指定的那一项后面(或前面)。
    • 指定的那一项不存在或不显示:排到所在分组(或页签列表)末尾。指定的分组不存在:放进末尾没有标题的分组。不丢。
    • 两个扩展指定同一个位置:按扩展的优先级,再按包名,保证每次结果相同。
    • 没写位置的:字段进末尾没有标题的分组,子表排在页签末尾(审批、动态之前)。
  3. 扩展包带来的字段和子表自动出现在上面算出的位置,即使原对象声明了 relatedLists 或分组的 fields。否则装了包没有效果。
  4. 扩展包只能安排自己带来的东西,不能挪动或隐藏原对象和其他包的字段、分组、页签。写了会在校验时拒绝,并指出该项属于谁。
  5. 合并只做一次,在记录页、表单、Studio 读取之前完成,三处读到的是同一个结果。

协调席加的(维护者说的是需求,下面的做法都是协调席提的;有异议以维护者为准)

  • 键名 place、after / before 的写法。
  • 第 4 条「不能挪别人的」。要整体改别人的页面,用已有的手写记录页;个别环境要调顺序,由环境管理员在界面上调。
  • 第 3 条「自动出现」。

不做的

  • 不做环境管理员在界面上调整之后和包声明的合并(那是运行时编辑模式的事)。
  • 不做扩展包隐藏别人的页签。
  • 不改 objectExtensions 现有的键。

验收

  • 扩展给「客户」加字段 tax_id,声明排在「行业」后面:记录页和表单的「基本信息」里它紧跟行业。
  • 把原对象里的「行业」字段删掉后重新构建:tax_id 在「基本信息」末尾,没有报错,校验给一条提示。
  • 原对象声明了 relatedLists: ['contact', 'opportunity'],扩展加子表「合同」并声明排在商机后面:页签是联系人、商机、合同。
  • 两个扩展都声明排在「商机」后面:顺序按优先级,优先级相同按包名;重复构建结果不变。
  • 扩展里写 { field: 'industry', group: 'other' }(挪原对象的字段):校验拒绝,指出该字段属于原对象。
  • 卸载扩展包:它带来的字段、分组、页签消失,原对象的顺序不受影响。

Reader: domain:spec 牵头,合并逻辑涉及 domain:engine,读取在 domain:ui。依赖本专题子卡 1、3(要先有「声明了就以它为准」的页签和分组,才谈得上往里插)。

Dedupe: 见父单。

Blocked-by: #35923

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

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:spec · pm:queue; rationale: area:records · Feature · an extension package declares where the fields, groups and child lists it adds to another package's object go (after which item), and they appear there; child of topic #35896 → p2 as set by the coordinator · size M.

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Seat hold · 2026-11-21T23:02Z · this card waits on #35923 (relatedLists tab list): this child extends the declaration #35923 adds. The body now carries the Blocked-by: line, so the unblock sweep releases it when that merges. (Root-cause card #36203: an "after #N" order is recorded on the card, not only in seat notes.)

  5. added
    pm:blocked
    and removed
    pm:queue
    area:records
    on Nov 21, 2026
  6. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Seat release · 2026-11-22T02:17Z · #35923 merged (8df7bf2; #35897 and #35899 closed), so this card's Blocked-by: #35923 is met. Back to pm:queue; the seat writes the claim when the thread's premise arrives.

  7. added
    pm:queue
    and removed
    pm:blocked
    on Nov 22, 2026
  8. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Claim: PM loop · 2026-11-22T02:27Z · #35901: an objectExtensions entry declares where its own fields, groups and child lists go (place with after / before). The placement is applied once, in objectql's foldExtendersOntoDefinition after every contributor's fields are merged, in (priority, package name) order. The record page, the form and Studio read that one result. Item 4 (an extension arranges only its own items) is refused at parse, at defineStack and at merge. Uninstalling or disabling drops the contributor and invalidates the cache; the original object is never written.
    Area: b1-RS (epic #35896); prerequisites #35923 (8df7bf2) and #35925 merged.
    Session: session_01L6bhgUxeTKkCvZ2iariHQf (card thread)
    Account: os-sales
    Branch: claude/project-thread-g0rke3 (one PR, Fixes #35901)
    File surface: packages/spec ObjectExtensionSchema (place) · objectql registry-object-registration.ts (foldExtendersOntoDefinition) · os validate hints · the browser deriveRelatedLists (an unplaced other-package child list stays, the flip ruled in 7072511859) · Studio read-only source badge · tests, changeset, migration entry, ADR-0146 D10 + ADR-0085 notes.
    Container & model: L, card thread, model: opus, effort: xhigh
    Clause-②: yes (widening)
    Metadata-protocol: semantic
    Premise (PR body's top lines): holds, with two forks. F1: where a child list goes when the parent declares no relatedLists, which is true of every object today. F2: where a group goes when the parent declares no fieldGroups. Both are with a fable review, then go to the maintainer as a decision card. The thread builds the recommended arm (a) meanwhile: placement applies only where the parent declares the list, otherwise today's automatic order is kept and nothing is dropped, with a hint in the log and in os validate. A different ruling is applied before the PR is finalised.
    Small calls (thread, listed in the PR body): the order of several items after one anchor; materialising a group's members when a field is inserted into a group without fields; "end of tabs" = before trailing sys_approval_request / sys_activity; package-less children keep #35923's rule; the parent's own placement of an extension list wins.
    Reviews: L1-c; contract L2 at CONTRACT_REVIEW_TIER (fable) by the seat; Tier H expected (ADR notes), so the hand-off goes to os-zhuang. Skills-docs: follow-up #35902.
    Resume-from: none
    Fold-or-serial: serial; possible plain conflicts with #36147 / #36149 / #36151 in record-page rendering only.

  9. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 22, 2026
  10. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Maintainer ruling · 2026-11-22T02:36Z · #35901, two forks from the thread's premise, reviewed by fable first, then put to the maintainer on two decision cards.

    1. F1 + F2, a parent that declares no relatedLists / no fieldGroups: 「父对象声明了才生效」. place (after / before, and a list entry's label / columns) applies only where the parent declares the tab list or groups. Otherwise the extension's child lists and fields keep today's automatic order at the end, nothing is dropped, and the startup log and os validate say the placement did not apply. No new served or protocol key.
    2. A child list another package adds, with no place entry, on a parent that declares relatedLists: 「装了就自动排在末尾」. It appears at the end of the declared tabs (before trailing sys_approval_request / sys_activity). This delivers the maintainer's earlier 「先隐藏,扩展包给别人的对象加字段、分组、子表时声明放在哪(排在谁后面);带来的东西自动出现在指定位置 #35901 再解决」 (7072511859) and flips feat(spec): relatedLists is the record page's tab list, with built-in tabs by object name and per-entry title and columns #35923's shipped "hidden until named" for other-package lists. The PR's changeset and migration entry state the flip.

    Follow-on for #35902: HotCRM uses objectExtensions today (o2c, psa, revenue), and none of its 38 objects declares relatedLists. Placement has no visible effect in HotCRM until its core objects declare tab lists and those modules add place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:builddomain:specenhancementpm:dispatchedpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions