Skip to content

Commit 981bd66

Browse files
os-zhuangclaude
andcommitted
fix(spec): mirror highlightFields back onto compactLayout during transition
Browser dogfood of the rename found a live gap: metadata authored with the canonical highlightFields key parsed to output WITHOUT compactLayout, so current renderers that still read the old key (ObjectGrid default columns, card compact views, vendored console) silently lost their curated field list. The alias now mirrors both directions (canonical wins when both are present); the back-fill is removed together with the deprecated key. Verified end-to-end in a running app (app-todo, HMR console against the worktree server): default list columns, mobile card fields, detail highlight strip, stageField stepper, and field-group form sections all render from the renamed keys. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 09f4234 commit 981bd66

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

packages/spec/src/data/object.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,9 @@ describe('ObjectSchema semantic roles (ADR-0085)', () => {
902902
name: 'account', fields: {}, highlightFields: ['name', 'industry'],
903903
});
904904
expect(direct.highlightFields).toEqual(['name', 'industry']);
905+
// Transition mirror: old-key readers (current objectui) still see
906+
// compactLayout for metadata authored with the canonical name.
907+
expect(direct.compactLayout).toEqual(['name', 'industry']);
905908

906909
const aliased = ObjectSchema.parse({
907910
name: 'account', fields: {}, compactLayout: ['name', 'industry'],

packages/spec/src/data/object.zod.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,12 @@ function normalizeNameFieldAlias(input: unknown): unknown {
905905
* (same pattern as `normalizeNameFieldAlias`; deprecated keys are PRESERVED
906906
* on output for cross-repo back-compat):
907907
*
908-
* - `compactLayout` → `highlightFields` when the canonical key is absent.
908+
* - `compactLayout` ⇄ `highlightFields`: whichever key is present is mirrored
909+
* onto the other (canonical wins when both exist). The BACK-fill
910+
* (highlightFields → compactLayout) is a transition mirror so renderers
911+
* that still read the old key (current objectui / vendored console) keep
912+
* their default columns for metadata authored with the new name; it is
913+
* removed together with the alias.
909914
* - `fieldGroups[].collapse` derived from the deprecated flags when absent:
910915
* the UI-dialect `collapsible`/`collapsed` pair wins over the old
911916
* `defaultExpanded` (it is what designer-authored metadata actually
@@ -920,6 +925,9 @@ function normalizeSemanticRoleAliases(input: unknown): unknown {
920925

921926
if (obj.highlightFields == null && Array.isArray(obj.compactLayout)) {
922927
out = { ...out, highlightFields: obj.compactLayout };
928+
} else if (obj.compactLayout == null && Array.isArray(obj.highlightFields)) {
929+
// Transition mirror for old-key readers (see doc comment above).
930+
out = { ...out, compactLayout: obj.highlightFields };
923931
}
924932

925933
if (Array.isArray(obj.fieldGroups)) {

0 commit comments

Comments
 (0)