Skip to content

chore: ADR-0079 — migrate record titles to nameField (framework v11)#420

Merged
os-zhuang merged 2 commits into
mainfrom
adr-0079-namefield
Jun 29, 2026
Merged

chore: ADR-0079 — migrate record titles to nameField (framework v11)#420
os-zhuang merged 2 commits into
mainfrom
adr-0079-namefield

Conversation

@os-zhuang

@os-zhuang os-zhuang commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

ADR-0079 — 记录标题迁移到 nameField(canonical)

退役 render-only 的 titleFormat(服务端无法返回 / 查询 / 排序它),改用 ADR-0079 的 nameField —— 指向一个真实存储字段作为记录标题。

改动

  • 框架 bump v10 → v11.2.0nameField 是 v11 才落地的 canonical 键(v10 仅有 displayNameField 别名,且 ADR-0032 未知键守卫直接拒 nameField)。
  • 单字段标题nameField: 'the_field'
  • 复合标题 → 新增 returnType: 'text' 的 formula 字段并指定为 nameField(服务端可返回 / 排序)。
  • lookup dot-walk 标题 → 按 ADR-0072 降级为最具辨识度的本地字段(注释标注丢弃项)。

验证(v11.2.0)

build ✓ / typecheck ✓ / validate(仅既有 widget 警告)/ test 全过。

配合 framework#2434(foundation)+ #2458(autoprov)+ #2463(lint gate)。

os-zhuang and others added 2 commits June 29, 2026 22:43
Retire the render-only `titleFormat` template on all 12 CRM objects in
favor of `displayNameField`, which names a REAL field holding the record
title (the installed @objectstack/spec v10.x key for ADR-0079's intent;
`nameField` does not exist in this framework version and is rejected by
ObjectSchema.create's unknown-key guard).

Single-field titles point straight at the field:
  • task    → subject
  • contact → full_name (existing formula field)

Composite titles add a `display_title` formula field (CEL string concat,
mirroring the repo's existing Field.formula shape) and point
displayNameField at it:
  • account, campaign, opportunity, knowledge_article, case, quote,
    product, lead, forecast

Degraded (lookup segment cannot be referenced by a formula, ADR-0072):
  • contract → displayNameField: 'contract_number'
      (dropped '{crm_account.name}' dot-walk; only local field remains,
       so no formula)
  • forecast → display_title = period_label + (period_start)
      (dropped leading '{owner}' lookup; date text()-coerced)

opportunity.stage (a select) is referenced by its stored value directly.

Verified green in the worktree: objectstack validate, tsc --noEmit,
objectstack build, objectstack lint, vitest (17/17). Pre-existing
dashboard widget-binding warnings and enable.* liveness warnings are
unrelated and unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Completes the ADR-0079 record-title migration on framework v11.2.0, which
lands `nameField` as the canonical title key. v10 only had the
`displayNameField` alias and rejected `nameField` outright (ADR-0032
unknown-key guard), so the first migration pass had to target the alias.

- Bump all @objectstack/* ^10.0.0 → ^11.2.0
- Rename displayNameField → nameField across all 12 migrated objects
  (single-field titles + composite formula-field titles)

Verified on v11.2.0: build OK, tsc clean, validate (pre-existing widget
warnings only), vitest 17/17.
@os-zhuang os-zhuang merged commit b6b57bb into main Jun 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant