Skip to content

fix(views): write the measured related-list mechanism to source (#944) - #957

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-944-campaign-member-views
Aug 6, 2026
Merged

fix(views): write the measured related-list mechanism to source (#944)#957
yinlianghui merged 1 commit into
mainfrom
claude/issue-944-campaign-member-views

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes #944

结论:二选一里错的是注释,不是缺元数据

issue 说得对——event_attendee.view.ts:10crm_campaign_member 当「已成立的先例」,而后者全仓零 view,两者必有一错。按派发的 measure-first 裁定先测,结果是注释所述的机制本身就不成立,于是走修法 B:改注释、不补 view。

三项测量

① 文档承诺(三语一致)。 content/docs/marketing/campaign-members.mdx(及 .zh-Hans / .zh-Hant 第 85-92 行)在《Standard list views》一节向读者承诺:营销活动详情页的 Members 选项卡上有 All Members / Responded / Bounced-Unsubscribed / Converted to Opportunity 四个标准列表视图。这四个视图在元数据里一个都没有——而且下面的测量说明,即便补上最小 grid,它们也不会出现在那个面板上。该缺口与本单修法无关,已另行留档(见文末)。

② 注释自述的机制,逐句对着 17.0.0-rc.3 的 Console 产物测。 两句断言各有下场:

  • 「关联列表渲染 THIS view 的列」——不成立。详情页关联列表的列来自子对象 lookup 字段上的 relatedListColumns(本仓一处都没写),其次退到子对象的 highlightFields 去掉该面板的作用域字段,上限 6 列,并丢弃在所有已取行上都为空的列;只有两者皆无才落到字段表启发式(name 类字段靠前、审计列靠后,rich_text / html / json 排除)。从头到尾不读子对象的 list view,也不是「按声明顺序渲染全部字段」。
  • 「快速新建弹窗渲染 THIS form」——成立;但配套那句「没有 form 就把 autonumber 当首字段」不成立。Console 会把 view bundle 的 form 合并到它持有的对象定义上,关联列表的 New / 行编辑抽屉渲染其 sections;而没有 form 时抽屉也不裸:create 模式下它先丢掉 autonumber / formula / summary(以及 hidden / readonly)字段,再按对象自己的 fieldGroups 分节。attendee_number 从来没被端上来过。

③ dist 产物现状。 基线 pnpm build 产出 14 个 view,crm_campaign_member 无任何 view 声明(crm_event_attendee 有,记录形如 { list, form })。

由此推出的影响判定(与 issue 正文相反)

crm_campaign_member 声明了 highlightFields: ['crm_campaign', 'crm_lead', 'crm_contact', 'status', 'response_date'],面板会去掉自己的作用域字段 crm_campaign,所以营销活动详情页的成员关联列表今天渲染的是 Lead / Contact / Status / Response Date——是策展过的,不是退化态。补一个 grid view 一列都改变不了。快速新建弹窗同理:autonumber 已被 create 模式剔除,分节走 fieldGroups

也就是说,修法 A(补 CampaignMemberViews)在关联列表这一半没有任何可测的业务拉力,唯一真实的一半(form 分节)今天由对象自己的 fieldGroups 承担且结果合理;把 grid 补进来只会多出一块「声明了但没人渲染」的表面——正是这条错注释已经制造过一次的那类误导。按仓库的 startup-focus 取舍,不建。

本 PR 改了什么

  • src/views/event_attendee.view.ts:重写文件头注释,把上面测到的两条路径写进源码(哪一半 live、哪一半不读、无 view 时的真实回退),并明确 crm_campaign_member 不是反例而是「不需要」的证据。注释改动,零元数据变更
  • test/view-references.test.ts:新增守卫,钉住真正承重的东西。派生集合 = 只能经父记录抵达的 crm_ 对象(持有指向 crm_ 的 required lookup 且无导航项)= 两个 junction + 两个 line item,四个对象都必须声明 highlightFields、其中每项都要解析得到真字段、并且在去掉任一父 lookup 后仍剩至少一列且不以 autonumber 打头。
  • changeset(patch):面向发布说明读者写清「机制被写反了」这件事。

反向验证(方向先判后跑)

预判为:唯一能真把成员面板打回退化态的改动,就是删掉 crm_campaign_member.highlightFields。删之实测——新守卫的两条断言同时报红:

FAIL  objects reached only through a parent curate that related list
      > crm_campaign_member authors highlightFields
AssertionError: crm_campaign_member authors no highlightFields — nothing curates
its related list, and the fallback heuristic leads with whatever the field map
offers first: expected 0 to be greater than 0

FAIL  objects reached only through a parent curate that related list
      > crm_campaign_member still has columns once the parent lookup is dropped
AssertionError: related lists with nothing to show:
  crm_campaign_member in the crm_campaign panel: no highlightFields at all — the panel falls to the heuristic

Tests  2 failed | 23 passed (25)

随即还原。

六道门(worktree hotcrm-944,均在共享 verify 锁内串行)

结果
pnpm validate 0 —— 14 Views / 17 Objects,告警集与基线同(含 #715field-group-shadowed,非本单)
pnpm typecheck 0
pnpm lint 0 —— 13 warning / 14 suggestion,与基线同
pnpm hygiene 0 —— 含控制字节扫描;另按规程对三个改动文件做了 grep -naP 自扫,无命中
pnpm build 0 —— 产物与基线逐项一致:14 Views,dist/objectstack.json 1921.4 KB(注释不进产物,符合零元数据变更的预期)
pnpm test -- --maxWorkers=2 0 —— Test Files 70 passed,Tests 1611 passed / 1 skipped

既有测试语义零变化:本 PR 只新增一个 describe 块,未改动任何既有断言;views 清单类对账(i18n _views 标签、tabs 可达性)因未新增 view 而无需更新。

边界

未起 dev server,无浏览器实测条件——上述机制结论来自对 17.0.0-rc.3 Console 产物中 RecordDetailView 关联列表派生、RelatedList 列回退链、MetadataProvider 的 view→object 合并、以及 form 渲染器 create 模式字段过滤这四处的静态测量,如实标注。未碰 content/docs/releases/@objectstack/* 版本;#715(字段组被 highlightFields 提升)机制不同未混改,#597(成员生命周期)不预判。

文档承诺缺口(测量 ①)与 EventAttendeeViews.list 的消费面问题按 Prime Directive #10 另行立单,不在本 PR 内修。


Generated by Claude Code

`src/views/event_attendee.view.ts` justified its grid and form with a
mechanism it stated as fact — "the related list renders THIS view's
columns, and the quick-create modal renders THIS form … for the same
reason `crm_campaign_member` has them" — and it was this repo's only
written account of that rendering path. `crm_campaign_member` ships no
view metadata at all, so the cited precedent was a counter-example.

Measured against the shipped Console (17.0.0-rc.3), the mechanism is the
wrong half. A detail-page related list takes its columns from the child's
lookup field (`relatedListColumns`, authored nowhere here), then falls
back to the child object's `highlightFields` minus the lookup the panel
is scoped by, capped at six, with all-empty columns dropped; only with
neither does it reach a heuristic over the field map — never the child's
list view, and never declaration order. The form half is real: the
Console merges a view bundle's `form` onto the object definition and the
record drawer renders its sections, but the no-form fallback already
drops autonumber/formula/summary fields in create mode and sections the
rest by `fieldGroups`, so the raw autonumber was never on offer.

The campaign detail page's member panel is therefore not degraded: it
renders Lead / Contact / Status / Response Date off
`crm_campaign_member.highlightFields`, and a member view would not have
changed one column of it. No metadata changes — the artifact is
byte-identical (14 views, 1921.4 KB). `test/view-references.test.ts`
pins what is load-bearing for every object reached only through a parent
(the two junctions, the two line items): `highlightFields` must exist,
resolve, and survive dropping the panel's own scope field.

Refs #944.
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hotcrm Ignored Ignored Aug 6, 2026 1:32pm

Request Review

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

Labels

ci/cd CI plumbing and the verification pipeline metadata Declarative metadata — schema, security posture, UI surfaces

Projects

None yet

2 participants