Skip to content

fix(plugin-detail): a highlight chip with no translation is captioned by the field's declared label - #26564

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-26417-highlight-chip-caption
Oct 27, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-26417-highlight-chip-caption

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #26417
Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么: 记录页标题下的高亮条(highlight strip),字段没有翻译条目时,每个小标题不再是空白,而是显示对象定义里声明的字段标签(内联多语言标签按当前语言取),没有声明标签时显示字段名;有翻译或视图里写了标签时仍以它们为准。
  • 为什么改: AI 生成的应用和所有没有 i18n 包的对象,记录页高亮条只显示「陈静 | 周明轩」两个值,看不出哪个是所有者、哪个是客户;详情区对同一批字段早已按「翻译 → 标签 → 字段名」显示,高亮条漏了中间一级。
  • 风险与回滚: 低。只改 HeaderHighlight.tsx 的小标题取值一处,有翻译或作者标签的页面渲染不变(测试钉住);回滚即 revert 本 PR。
  • 先看: ui/packages/plugin-detail/src/HeaderHighlight.tsx 中 caption 的取值;新测试 record-highlights.declaredCaption-26417.test.tsx。
  • 两分钟验证: pnpm --dir ui exec vitest run packages/plugin-detail/src/renderers/__tests__/record-highlights.declaredCaption-26417.test.tsx,预期 7 个测试全绿。
  • 需要你做的: 无,席位落地。

What changes

ui/packages/plugin-detail/src/HeaderHighlight.tsx: the chip caption was fieldLabel(objectName, field.name, field.label). With no bundle key and no label on the strip entry (every entry the synthesized page hands record:highlights, which passes bare names through as { name }), the fallback was undefined and the caption rendered as an empty span.

The caption now climbs the details body's ladder, the same rungs in the same order:

  1. the bundle's translation (fieldLabel, unchanged);
  2. the strip entry's own label, when the author wrote one;
  3. the label the object declares for the field, read with pickLocalized in the session language, so an inline locale map never renders as an object;
  4. the field name.

Rungs 2 and 3 are the details body's withDeclaredLabel (renderers/record-details.tsx) and rung 4 is DetailSection's field.label || field.name. DetailSection.tsx and record-details.tsx are not touched.

The ladder sits in HeaderHighlight, not in the record:highlights normaliser, because HeaderHighlight has two callers: the record:highlights renderer and DetailView's schema.highlightFields. Both already hand it the object definition, so filling the rung once covers both. It is computed on every render, so a definition that arrives after the record replaces the field-name caption with the declared label. record-highlights.tsx gains one comment line that says where a bare name gets its caption.

Tests

New: ui/packages/plugin-detail/src/renderers/__tests__/record-highlights.declaredCaption-26417.test.tsx. Each leg first finds the chip by its value, so an empty caption cannot pass as a strip that drew nothing.

  • Bare names on an object with no bundle (zh): 所有者 / 关联客户 (the card's case).
  • An inline locale map: 阶段 in zh, Stage in en.
  • No declared label: the field name, never a blank caption.
  • A bundle entry still wins over the declared label, and an unbundled sibling still reads its declared label.
  • An authored strip label still wins over the declared label.
  • Agreement: the details body draws the same two captions for the same fields.
  • Late definition (the DetailView path, HeaderHighlight mounted directly): the caption is the field name before the definition arrives and the declared label after.

Red, then green

  • Red at 0729de2e (the test alone, before the fix): pnpm exec vitest run packages/plugin-detail/src/renderers/__tests__/record-highlights.declaredCaption-26417.test.tsx from ui/ under the verify lock, VERDICT command-exit 1, Tests 7 failed (7). Four legs failed on an empty caption (received ''): bare names, the locale map, the field-name fallback and the late definition. The bundle and authored-label legs passed their first assertion (the bundle entry, the authored label) and then failed on the unbundled sibling's empty caption. The agreement leg failed on its harness: with no name field declared, the details body drops owner as the record title. The fix commit switches that leg to customer and stage.
  • Green at 542908d2 (fix plus origin/main merged), from ui/ under the lock: pnpm exec vitest run packages/plugin-detail --maxWorkers=2 exit 0, Test Files 310 passed and 1 skipped (311), Tests 2876 passed and 18 skipped (2894). pnpm --filter @object-ui/plugin-detail type-check (tsc --noEmit && tsc -p tsconfig.test.json) exit 0. The new file alone, verbose, Tests 7 passed (7).

Gates at 542908d2

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 34 commands. 32 exited 0, including node scripts/check-sdui-manifest.mjs (manifest present and intact, 106 components; no registry contract changed, so nothing was regenerated). --ran reconciliation: 34 derived, 33 run, 1 NOT-MEASURED, 0 UNRUN.

  • NOT MEASURED, pnpm check:type-check-debt: exit 3, PREREQUISITE NOT MET. Its closure build queued on the shared verify lock twice and never got a turn. CI's Lint & Repo Gates is the reading.
  • NOT MEASURED, pnpm --dir ui exec vitest run scripts/: exit 1, but the run was killed with SIGKILL before its summary. Two tests had already timed out at about 18.8 s under box contention: check-hand-rolled-comment-mask.test.ts ("exits 0 as a process") and js-comment-mask-returns-interpolation-9424.test.ts (the type-check:scripts program). Both test ui/scripts/, which this diff does not touch. The first one's subject, node ui/scripts/check-hand-rolled-comment-mask.mjs, run directly on this tree, exits 0. CI is the reading.

Acceptance notes

  • DetailView's own highlightFields path (HeaderHighlight mounted directly) gets the same caption, because the ladder sits in HeaderHighlight. The late-definition leg pins it.
  • DetailSection.tsx, record-details.tsx and the locale packs are untouched. No new i18n key.
  • The caption ladder now exists in two places: withDeclaredLabel in record-details.tsx (rungs 2 and 3, filled on the entry) and HeaderHighlight (computed at render). The agreement leg pins that both give the same text. Extracting one shared helper would mean editing record-details.tsx, which is outside this card's file surface. Carrier: none. Noted here only.

Generated by Claude Code

…rung (red first)

Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup
Co-authored-by: Claude <noreply@anthropic.com>
… by the field's declared label

The chip caption now climbs the details body's label ladder: the bundle's
translation, then the strip entry's label, then the label the object declares
(read in the session language), then the field name.

Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling labels Oct 27, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

维护者速读

改了什么:记录页标题下的高亮条,字段没有翻译条目时,每个小标题不再空白,而是显示对象定义里声明的字段标签(内联多语言标签按当前语言取),没有声明标签时显示字段名;有翻译或视图里写了标签时仍以它们为准。
为什么改:AI 生成的应用和所有没有语言包的对象,高亮条只显示「陈静 | 周明轩」两个值,看不出哪个是所有者、哪个是客户;详情区对同一批字段早已按「翻译 → 标签 → 字段名」显示,高亮条漏了中间一级(#26417)。
风险与回滚:只改 HeaderHighlight.tsx 的小标题取值一处;有翻译或作者标签的页面渲染不变(测试钉住)。回滚 = revert 本 PR。
先看:ui/packages/plugin-detail/src/HeaderHighlight.tsx 中 caption 的取值 → 新测试 record-highlights.declaredCaption-26417.test.tsx。
两分钟验证:在 ui/ 下运行 pnpm exec vitest run packages/plugin-detail/src/renderers/__tests__/record-highlights.declaredCaption-26417.test.tsx,预期 7 个用例全过。
需要你做的:无,席位落地。
席位意见:ACCEPT。取值顺序与详情区(record-details.tsx 的 withDeclaredLabel 加 DetailSection 的 field.label || field.name)一致,新测试有一格钉住两处结果相同;抽成共用函数要改 record-details.tsx,超出本卡,记为后续,不另开卡。

席位核对

seat 2 · 2026-10-27T09:01Z · head 542908d2 (#26417)

item reading
form 4 files, +249/−1: HeaderHighlight.tsx caption = translation → the entry's own label → the object's declared label (pickLocalized in the session language) → field name; record-highlights.tsx one comment line (the ladder lives in HeaderHighlight, which serves both record:highlights and DetailView highlightFields); new 7-cell pin; root .changeset/ patch on plugin-detail; no locale keys
premise measured record:highlights hands the strip bare { name } entries, so with no bundle entry fieldLabel(…, field.label) resolved to undefined and the caption rendered empty
gates (check-runs on 542908d2) 45 success, 9 skipped, 0 failing (Test UI 16/16, Build & E2E UI, Type Check UI and debt ledger, Lint UI, Check PR Size, governed guard all green). Local: red 7/7 at 0729de2e (pin only; the parity cell's own fixture was corrected in the fix commit to use customer / stage, since the details body lifts owner as the title with no name field), green after; plugin-detail 2876 tests passed, 18 skipped; type-check exit 0; check-sdui-manifest exit 0 (106 components); 32 of 34 derived gates exit 0, check:type-check-debt and ui scripts/ vitest not measured locally (lock / load), left to CI
accepted deviations the red cell whose fixture was wrong is named above, not hidden; the ladder is written in two places (withDeclaredLabel and HeaderHighlight), held equal by the parity cell
out of scope one shared label-ladder helper for the strip and the details body (needs record-details.tsx)
landing not governed (check-governed-merges: 250 changed lines, no hit paths); git merge-tree against origin/main 1080f07 clean; HeaderHighlight.tsx held by no other open PR; DetailSection.tsx untouched (#26560)

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 27, 2026 09:02
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 27, 2026 09:02
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 2dd332d Oct 27, 2026
55 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-26417-highlight-chip-caption branch October 27, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling

Projects

None yet

1 participant