Skip to content

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

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)#80
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:45
…ADR-0079)

ADR-0079 retires the render-only `titleFormat` template (the server can't
return or query it) in favor of `displayNameField`, which names a REAL field
holding the record's display title.

Migrated all 40 objects that declared a `titleFormat`:

- Single placeholder `{{record.X}}` → `displayNameField: 'X'`, removed
  titleFormat (most objects; 18 already had a matching displayNameField, so
  only the redundant titleFormat + now-unused tmpl import were dropped).
- Composites with all-local placeholders → added a stored `display_name`
  formula field and pointed displayNameField at it:
    * compliance_control  F`coalesce(record.code,'') + ' · ' + coalesce(record.title,'')`
    * hr_time_off_request F`coalesce(record.leave_type,'') + ' · ' + string(record.start_date) + ' → ' + string(record.end_date)`
    * procurement_receipt F`'Receipt ' + coalesce(record.receipt_number,'')`
    * hr_employee         F`!isBlank(record.preferred_name) ? record.preferred_name : record.full_name`
  (helpdesk_ticket already had displayNameField:'name', a real field — kept
  that rather than re-introducing a composite formula.)
- Placeholders that were lookups or dot-walks (unreferenceable in a stored
  field per ADR-0072) → degraded to the most identifying LOCAL field, with a
  code comment noting the dropped reference:
    * content_metric      → period_start  (dropped {{publication}} lookup)
    * content_publication → published_at  (dropped {{piece}}/{{channel}} lookups)
    * pm_timesheet        → work_date     (dropped {{person.name}} dot-walk)
    * pm_resource         → role          (dropped {{person.name}}/{{project.name}} dot-walks)

CEL string concat uses single-quoted literals with nullable operands wrapped
in coalesce(…, '') and date fields in string(…); verified against the real
@objectstack/formula engine.

Build (objectstack build, all 9 packages), typecheck (tsc --noEmit), and
prettier --check all pass. Zero titleFormat / tmpl references remain.

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` (ADR-0032 unknown-key
guard), so the first migration pass targeted the alias.

- Bump all @objectstack/* ^10.2.0 → ^11.2.0 across 10 domain packages
  (+ pnpm-workspace.yaml release-age pins)
- Rename displayNameField → nameField across all 40 migrated objects
  (single-field titles + composite formula-field titles)

Verified on v11.2.0: pnpm -r build OK (9 packages), pnpm -r typecheck clean.
@os-zhuang os-zhuang merged commit 6b2a69f into main Jun 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant