From 33b1f129134e44b54534f67fb93c9b330afe63ad Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 1 Oct 2026 17:10:06 +0000 Subject: [PATCH 1/4] wip(spec): ObjectSchema.imageField refused unless it names a declared image/avatar field Claude-Session: https://claude.ai/code/session_01UtnxvdiN376GF3sgXwAw4d Co-authored-by: Claude --- .../spec/src/data/object-image-field.test.ts | 147 ++++++++++++++++++ packages/spec/src/data/object.zod.ts | 101 +++++++++++- 2 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 packages/spec/src/data/object-image-field.test.ts diff --git a/packages/spec/src/data/object-image-field.test.ts b/packages/spec/src/data/object-image-field.test.ts new file mode 100644 index 00000000000..8a0cc003771 --- /dev/null +++ b/packages/spec/src/data/object-image-field.test.ts @@ -0,0 +1,147 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import { describe, it, expect } from 'vitest'; +import { ObjectSchema } from './object.zod'; +import { getMetadataTypeSchema } from '../kernel/metadata-type-schemas'; +import { ObjectStackDefinitionSchema } from '../stack.zod'; + +// --------------------------------------------------------------------------- +// [#21182 — ruling A on objectstack-ai/hotcrm#1199] An object declares which +// of its fields is the record's picture: `imageField`, a sibling of +// `nameField`, naming a field of the SAME object whose type is `image` or +// `avatar`. Anything else is refused at the object door, which every +// authoring door parses through — so a bad pointer never reaches a reader, +// and no reader needs a tolerance for one. +// +// The pins bear weight in both directions: the two accepted types (and the +// key's absence) parse clean, and each refused shape is ONE located issue at +// `imageField`. The refusals are asserted by code and path, plus the named +// subjects an author greps for — the field it names and the two accepted +// types — never by the prose around them. +// --------------------------------------------------------------------------- + +const account = (imageField: string | undefined, extra: Record = {}) => ({ + name: 'crm_account', + nameField: 'name', + fields: { + name: { type: 'text', label: 'Name' }, + logo: { type: 'image', label: 'Logo' }, + portrait: { type: 'avatar', label: 'Portrait' }, + website: { type: 'text', label: 'Website' }, + contract: { type: 'file', label: 'Contract' }, + ...extra, + }, + ...(imageField === undefined ? {} : { imageField }), +}); + +/** The one issue a refused object must carry, located at `imageField`. */ +function refusedAt(input: unknown) { + const parsed = ObjectSchema.safeParse(input); + expect(parsed.success, 'the declaration must NOT parse clean').toBe(false); + if (parsed.success) throw new Error('unreachable'); + expect(parsed.error.issues).toHaveLength(1); + const [issue] = parsed.error.issues; + expect(issue.code).toBe('custom'); + expect(issue.path).toEqual(['imageField']); + return issue; +} + +describe('[#21182] `imageField` names a declared `image` or `avatar` field of the same object', () => { + it('accepts an `image` field (control)', () => { + const parsed = ObjectSchema.safeParse(account('logo')); + expect(parsed.success, parsed.success ? '' : JSON.stringify(parsed.error.issues)).toBe(true); + if (!parsed.success) return; + expect(parsed.data.imageField).toBe('logo'); + }); + + it('accepts an `avatar` field (control)', () => { + const parsed = ObjectSchema.safeParse(account('portrait')); + expect(parsed.success, parsed.success ? '' : JSON.stringify(parsed.error.issues)).toBe(true); + if (!parsed.success) return; + expect(parsed.data.imageField).toBe('portrait'); + }); + + it('is optional — an object that declares no picture parses clean (control)', () => { + const parsed = ObjectSchema.safeParse(account(undefined)); + expect(parsed.success, parsed.success ? '' : JSON.stringify(parsed.error.issues)).toBe(true); + if (!parsed.success) return; + expect(parsed.data.imageField).toBeUndefined(); + }); + + it('refuses a name the object does not declare', () => { + const issue = refusedAt(account('company_logo')); + expect(issue.message).toContain('`company_logo`'); + expect(issue.message).toContain('`image`'); + expect(issue.message).toContain('`avatar`'); + }); + + it('refuses a `text` field — a URL column is not a declared picture', () => { + const issue = refusedAt(account('website')); + expect(issue.message).toContain('`website`'); + expect(issue.message).toContain('`text`'); + expect(issue.message).toContain('`image`'); + expect(issue.message).toContain('`avatar`'); + }); + + it('refuses a `file` field — the nearest neighbour type is still not a picture', () => { + const issue = refusedAt(account('contract')); + expect(issue.message).toContain('`file`'); + }); + + it('does not resolve a JS prototype name as a declared field', () => { + // `fields` is a plain record, so a lookup that walked the prototype chain + // would read `toString` as present. The pointer must name an OWN key. + refusedAt(account('toString')); + }); + + it('the authoring factory throws the same refusal, and accepts the same pointer', () => { + expect(() => ObjectSchema.create({ + name: 'crm_account', + fields: { + name: { type: 'text', label: 'Name' }, + website: { type: 'text', label: 'Website' }, + }, + imageField: 'website', + })).toThrow(/imageField/); + + const created = ObjectSchema.create({ + name: 'crm_account', + fields: { + name: { type: 'text', label: 'Name' }, + logo: { type: 'image', label: 'Logo' }, + }, + imageField: 'logo', + }); + expect(created.imageField).toBe('logo'); + }); + + it('the metadata save door resolves `object` to the schema that refuses it', () => { + // `saveMetaItem` validates an `object` item against + // `getMetadataTypeSchema('object')`; the refusal must ride that schema, + // located at the same path the Studio form keys on. + const schema = getMetadataTypeSchema('object'); + expect(schema).toBeDefined(); + const bad = schema!.safeParse(account('website')); + expect(bad.success).toBe(false); + if (bad.success) return; + expect(bad.error.issues.map((i) => [i.code, i.path])).toEqual([['custom', ['imageField']]]); + expect(schema!.safeParse(account('logo')).success).toBe(true); + }); + + it('the stack door refuses it inside `objects`, located at the object', () => { + const manifest = { + id: 'com.example.image_field', + name: 'image-field-test', + version: '1.0.0', + type: 'app' as const, + namespace: 'crm', + }; + const bad = ObjectStackDefinitionSchema.safeParse({ manifest, objects: [account('company_logo')] }); + expect(bad.success).toBe(false); + if (bad.success) return; + expect(bad.error.issues.map((i) => [i.code, i.path])).toEqual([['custom', ['objects', 0, 'imageField']]]); + + const good = ObjectStackDefinitionSchema.safeParse({ manifest, objects: [account('logo')] }); + expect(good.success, good.success ? '' : JSON.stringify(good.error.issues)).toBe(true); + }); +}); diff --git a/packages/spec/src/data/object.zod.ts b/packages/spec/src/data/object.zod.ts index 51b942c1ce3..1d7f36b646b 100644 --- a/packages/spec/src/data/object.zod.ts +++ b/packages/spec/src/data/object.zod.ts @@ -1,7 +1,7 @@ // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. import { z } from 'zod'; -import { FieldSchema } from './field.zod'; +import { FieldSchema, type FieldType } from './field.zod'; import { ValidationRuleSchema } from './validation.zod'; import { ActionSchema, type ActionParam } from '../ui/action.zod'; import { ObjectListViewSchema } from '../ui/view.zod'; @@ -1580,6 +1580,79 @@ function refuseForeignTreeReference(ownName: unknown, fields: unknown, ctx: z.Re } } +/** + * The field types an object's `imageField` may name: the two whose stored + * value IS a picture. One list, read by the refusal below and spelled into its + * prescription, so the accepted set and the text that names it cannot drift. + */ +const IMAGE_FIELD_TYPES: readonly FieldType[] = ['image', 'avatar']; + +/** + * [#21182 — ruling A on objectstack-ai/hotcrm#1199] `imageField`, when + * present, must name a field THIS object declares whose type is `image` or + * `avatar`. + * + * Judged here for the reason {@link refuseForeignTreeReference} is: only the + * object holds the field map the pointer resolves against, and every authoring + * door parses through this schema — `defineStack({ objects })` binds it + * element-wise (`ObjectSchema.create()` runs the same parse), `os validate` + * parses the stack through `ObjectStackDefinitionSchema`, and the metadata + * save door resolves the `object` type to this schema + * (`getMetadataTypeSchema('object')`). So a bad pointer is refused loudly at + * authoring and at publish alike, and no reader of the key ever needs a + * tolerance for one (Prime Directive #12). + * + * Two refusals, each one located issue at `['imageField']`: + * + * - the name is not a key of `fields` — a pointer into nothing; + * - the name resolves, and the field is any type but `image` / `avatar` — a + * `text` URL column or a `file` attachment is not a declared picture, and a + * renderer that guessed it was would be the consumer-side tolerance this + * rule exists to make unnecessary. + * + * Judged against the AUTHORED field map only. No registry-injected system + * column is an `image` or `avatar` field, so widening the existence half to + * the injected set (the #5378 move the semantic-role lints make) could only + * turn "not declared" into "wrong type" for the same refused value. Not judged + * on `ObjectExtensionSchema`: an extension cannot declare `imageField` (its + * strict shape refuses the key), so the pointer is only ever the owning + * object's own. Pinned in `object-image-field.test.ts`. + */ +function refuseNonPictureImageField( + ownName: unknown, + imageField: unknown, + fields: unknown, + ctx: z.RefinementCtx, +): void { + if (typeof imageField !== 'string') return; + const objectName = typeof ownName === 'string' ? ownName : ''; + const accepted = IMAGE_FIELD_TYPES.map((t) => `\`${t}\``).join(' or '); + const prescription = + `\`imageField\` must name a field of this object whose type is ${accepted} — point it at one ` + + '(declare one with `Field.image()` or `Field.avatar()` if the object has none), or remove `imageField`.'; + const declared = fields !== null && typeof fields === 'object' + && Object.prototype.hasOwnProperty.call(fields, imageField); + if (!declared) { + ctx.addIssue({ + code: 'custom', + path: ['imageField'], + message: + `\`imageField\` names \`${imageField}\`, but object \`${objectName}\` declares no field ` + + `\`${imageField}\`. ${prescription}`, + }); + return; + } + const type = ((fields as Record)[imageField] as { type?: unknown } | null)?.type; + if (typeof type === 'string' && (IMAGE_FIELD_TYPES as readonly string[]).includes(type)) return; + ctx.addIssue({ + code: 'custom', + path: ['imageField'], + message: + `\`imageField\` names \`${imageField}\`, a \`${String(type)}\` field on object \`${objectName}\`, ` + + `which is not a picture. ${prescription}`, + }); +} + // ⚠️ ORDER IS LOAD-BEARING (#5593). This map used to live ~700 lines BELOW // `ObjectSchemaBase`, and the error map that reads it was built lazily // (`objectUnknownKeyErrorImpl ??= …`) purely to step around the temporal dead @@ -2164,6 +2237,28 @@ const ObjectSchemaBase = strictObject( */ displayNameField: z.string().optional().describe('[DEPRECATED → nameField] Field to use as the record display name (e.g., "name", "title"). Accepted as an alias for nameField.'), titleFormat: TemplateExpressionInputSchema.optional().describe('[DEPRECATED → nameField (ADR-0079)] Render-only title template; the server cannot return or query it, and an explicit nameField now takes precedence. Migrate a single-field title to nameField, a composite to a formula field designated as nameField. Placeholders may be written {{field}} or {field} — the title renderers treat the two as equivalent, normalizing {{field}} to {field} before substituting; neither spelling is judged at parse time.'), + /** + * [#21182 — ruling A on objectstack-ai/hotcrm#1199] The record's PICTURE: + * names the field whose value the record page header — the record chrome + * every record detail page shares — draws beside the title. A sibling of + * `nameField`: `nameField` says which field is the record's name, this says + * which is its picture. One object-level declaration that every detail page + * reads, deliberately NOT a `page:header` prop (that header's own identity + * is drawn by the record chrome, which is why its `icon` was retired). + * + * - Must name a field of this object whose type is `image` or `avatar`; + * anything else — an undeclared name, a `text` URL column, a `file` — is + * refused at parse by `refuseNonPictureImageField`, so at every authoring + * and publish door. + * - A record whose field is empty shows no picture. The reader draws nothing + * in its place — no initials, no placeholder avatar. + * + * The reader is objectui's record chrome, and it does not read the key yet: + * the liveness ledger holds this row `planned` until it does, so an authored + * value is accepted, stored and served, and takes effect when the renderer + * lands with no re-authoring. + */ + imageField: z.string().optional().describe('The record\'s picture: names the field the record page header (record chrome) is to draw beside the title — one object-level declaration every record detail page reads, not a per-page header prop. Must name a field of this object whose type is `image` or `avatar`; any other name is refused. A record whose field is empty shows no picture (no initials or placeholder). Pending renderer: the record chrome does not draw it yet.'), /** * [ADR-0085] Semantic role: the object's most important fields, in priority * order (the first entry wins wherever only one field fits, e.g. child-record @@ -2432,6 +2527,10 @@ const ObjectSchemaBase = strictObject( // keeps this a `ZodObject` (zod 4 attaches checks in place), so `.shape` and // `create()`'s unknown-key walk are untouched; see the helper's docblock. refuseForeignTreeReference(object.name, object.fields, ctx); + // [#21182] `imageField` names a declared `image` / `avatar` field of THIS + // object — the same door, for the same reason: only the object holds the + // field map the pointer resolves against. + refuseNonPictureImageField(object.name, object.imageField, object.fields, ctx); }); /** From 049308cbf4e8232cfb51def9d819cba850632c9d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 1 Oct 2026 17:11:38 +0000 Subject: [PATCH 2/4] wip(spec): imageField liveness row, form omit row, docs sentence, changeset Claude-Session: https://claude.ai/code/session_01UtnxvdiN376GF3sgXwAw4d Co-authored-by: Claude --- .changeset/21182-object-image-field.md | 45 +++++++++++++++++++ content/docs/data-modeling/objects.mdx | 1 + packages/spec/liveness/object.json | 7 +++ .../spec/src/data/object-image-field.test.ts | 2 +- .../metadata-form-zod-reconciliation.test.ts | 7 +++ 5 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .changeset/21182-object-image-field.md diff --git a/.changeset/21182-object-image-field.md b/.changeset/21182-object-image-field.md new file mode 100644 index 00000000000..e294fcbecf3 --- /dev/null +++ b/.changeset/21182-object-image-field.md @@ -0,0 +1,45 @@ +--- +'@objectstack/spec': minor +--- + +feat(spec): an object declares which of its fields is the record's picture — `imageField`, beside `nameField` + +Clause-②: yes (widening) + +`ObjectSchema` accepts one more optional key, `imageField`. It names the field +whose value is the record's picture, the way `nameField` names the field that is +the record's name: one object-level declaration, read by the record page header +(the record chrome every record detail page shares) — not a per-page +`page:header` prop. + +```ts +defineStack({ + objects: [{ + name: 'crm_account', + nameField: 'name', + imageField: 'logo', + fields: { + name: Field.text({ label: 'Name' }), + logo: Field.image({ label: 'Logo' }), + }, + }], +}); +``` + +- **What it may name.** A field of the same object whose type is `image` or + `avatar`. A name the object does not declare, or a field of any other type + (a `text` URL column, a `file`), is refused at parse with an issue at + `imageField` that names the two accepted types — so `defineStack`, + `ObjectSchema.create()`, `os validate` and the metadata save door + (`422 INVALID_METADATA`) all refuse it. +- **An empty field.** The contract the reader is held to: a record whose + picture field is empty shows no picture — no initials or placeholder in its + place. +- **Who draws it.** No renderer reads the key yet. The record chrome in + `@object-ui/components` is the reader to come, and until it lands an authored + `imageField` is accepted, stored and served but nothing draws it. It takes + effect when that renderer ships, with no re-authoring. The liveness ledger + records the key as `planned`. + +Nothing that parsed before is refused: the key is new, and an object that does +not set it is unchanged. diff --git a/content/docs/data-modeling/objects.mdx b/content/docs/data-modeling/objects.mdx index 53382cbc85a..630f9ccc964 100644 --- a/content/docs/data-modeling/objects.mdx +++ b/content/docs/data-modeling/objects.mdx @@ -68,6 +68,7 @@ export const Account = ObjectSchema.create({ | :--- | :--- | :--- | :--- | | `nameField` | `string` | optional | The stored field used as the record display name, e.g. `'name'` or `'title'` (ADR-0079). The deprecated alias `displayNameField` is still accepted. | | `titleFormat` | `string` | optional | Deprecated (ADR-0079 → `nameField`). Render-only title template (e.g. `'{{record.name}} - {{record.code}}'`); an explicit `nameField` takes precedence | +| `imageField` | `string` | optional | The record's picture: names a field of this object whose type is `image` or `avatar` — any other name is refused when the object is validated or published. It is the one object-level declaration the record page header is to draw beside the title once the renderer reads it; no renderer draws it yet. | | `highlightFields` | `string[]` | optional | Most-important fields in priority order — default list columns, cards, previews, detail highlight strip (ADR-0085; formerly `compactLayout` — the old spelling was retired and is now rejected) | | `stageField` | `string \| false` | optional | Linear lifecycle field; `false` declares the status field non-linear and suppresses stage heuristics (ADR-0085) | diff --git a/packages/spec/liveness/object.json b/packages/spec/liveness/object.json index a7770470eca..f99f83b4c2e 100644 --- a/packages/spec/liveness/object.json +++ b/packages/spec/liveness/object.json @@ -31,6 +31,13 @@ "status": "live", "note": "ADR-0079 canonical record-title pointer; read by data/display-name.ts resolveDisplayField/resolveRecordDisplayName, objectql search displayField, and plugin-approvals." }, + "imageField": { + "status": "planned", + "verifiedAt": "2026-10-01", + "evidenceScope": "cross-repo", + "evidence": "packages/spec/src/data/object.zod.ts#refuseNonPictureImageField (the AUTHORING judgement only: a name the object does not declare, or a field of any type but `image` / `avatar`, is refused at parse, so at the defineStack, `os validate` and metadata-save doors alike; a value it ACCEPTS has no reader yet); objectui @31971ff1: packages/components/src/renderers/layout/containers.tsx (the record chrome resolves the header title from `nameField` and reads no image key — zero `imageField` hits there, control `nameField` 4 hits)", + "note": "PLANNED, carrier objectui#11383 (the record chrome draws the record's picture from the object's `imageField` in the record page header), which is the seam's acceptance: flip to `live` citing that reader at the `.objectui-sha` pin that carries it. Declared by ruling A on objectstack-ai/hotcrm#1199 — one object-level declaration every record detail page reads, not a `page:header` prop, and no initials/placeholder avatar when the field is empty. ZERO consumers measured: in this repo `imageField` had 0 hits repo-wide before this key (control `nameField` hits), and objectui @31971ff1 has no object-level `imageField` read (its only `imageField` hits are the gallery view's legacy option, a different key on a different schema). Not `authorWarn`'d, on the `app.branding.logo` precedent and README rule 1: a picture pointer is display metadata, an author who sets it today loses nothing and is not misled about behaviour, and the value takes effect the moment the carrier lands with no re-authoring. The key's own describe says the renderer is pending." + }, "titleFormat": { "status": "live", "note": "objectui ({{record.field}} interpolation)." diff --git a/packages/spec/src/data/object-image-field.test.ts b/packages/spec/src/data/object-image-field.test.ts index 8a0cc003771..9597b301a0c 100644 --- a/packages/spec/src/data/object-image-field.test.ts +++ b/packages/spec/src/data/object-image-field.test.ts @@ -130,7 +130,7 @@ describe('[#21182] `imageField` names a declared `image` or `avatar` field of th it('the stack door refuses it inside `objects`, located at the object', () => { const manifest = { - id: 'com.example.image_field', + id: 'com.example.imagefield', name: 'image-field-test', version: '1.0.0', type: 'app' as const, diff --git a/packages/spec/src/system/metadata-form-zod-reconciliation.test.ts b/packages/spec/src/system/metadata-form-zod-reconciliation.test.ts index 6fc32643303..f7554207ef1 100644 --- a/packages/spec/src/system/metadata-form-zod-reconciliation.test.ts +++ b/packages/spec/src/system/metadata-form-zod-reconciliation.test.ts @@ -384,6 +384,13 @@ const LEDGER: ReadonlyArray = [ key: 'externalSharingModel', why: 'declared, not enforced yet — liveness verdict `planned` (ADR-0090 D11: validated at authoring time only; the audience-aware evaluator branch that would honour it is scheduled, not built). No offer until it is enforced; whether to offer it then is a ruling for the enforcement, not for this gate', }, + { + kind: 'omit', + type: 'object', + path: ROOT_PATH, + key: 'imageField', + why: 'declared, not enforced yet — liveness verdict `planned` (the record picture: the parse refuses any name but a declared `image` / `avatar` field, and the record chrome that is to draw it in the record page header does not read it yet). No offer until it is enforced; whether to offer it then is a ruling for the enforcement, not for this gate', + }, { kind: 'omit', type: 'field', From 56d270771cab2005d578b885e80e13e98def4a74 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 1 Oct 2026 17:16:30 +0000 Subject: [PATCH 3/4] chore(spec): regenerate authorable surface, reference docs and liveness counts for imageField Claude-Session: https://claude.ai/code/session_01UtnxvdiN376GF3sgXwAw4d Co-authored-by: Claude --- content/docs/references/api/metadata.mdx | 1 + content/docs/references/data/object.mdx | 1 + content/docs/references/system/migration.mdx | 2 ++ packages/spec/authorable-surface/data.json | 1 + packages/spec/liveness/state-counts/object.md | 2 +- 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/content/docs/references/api/metadata.mdx b/content/docs/references/api/metadata.mdx index 989028c19a7..05c933b33ee 100644 --- a/content/docs/references/api/metadata.mdx +++ b/content/docs/references/api/metadata.mdx @@ -960,6 +960,7 @@ Metadata query with filtering, sorting, and pagination | **nameField** | `string` | optional | [ADR-0079] Canonical primary title field — the stored field used as the record display name (e.g. "name", "title"). | | **displayNameField** | `string` | optional | [DEPRECATED → nameField] Field to use as the record display name (e.g., "name", "title"). Accepted as an alias for nameField. | | **titleFormat** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object }` | optional | [DEPRECATED → nameField (ADR-0079)] Render-only title template; the server cannot return or query it, and an explicit nameField now takes precedence. Migrate a single-field title to nameField, a composite to a formula field designated as nameField. Placeholders may be written `{{field}}` or `{field}` — the title renderers treat the two as equivalent, normalizing `{{field}}` to `{field}` before substituting; neither spelling is judged at parse time. | +| **imageField** | `string` | optional | The record's picture: names the field the record page header (record chrome) is to draw beside the title — one object-level declaration every record detail page reads, not a per-page header prop. Must name a field of this object whose type is `image` or `avatar`; any other name is refused. A record whose field is empty shows no picture (no initials or placeholder). Pending renderer: the record chrome does not draw it yet. | | **highlightFields** | `string[]` | optional | [ADR-0085] Ordered most-important fields; first entry wins where only one fits. Drives default columns, cards, previews, detail highlight strip. Renamed from compactLayout. | | **stageField** | `string \| false` | optional | [ADR-0085] Lifecycle stage field (linear/ordered), or false to declare the status field non-linear and suppress stage heuristics. Absent = heuristic detection allowed. | | **editMode** | `Enum<'modal' \| 'page'>` | optional | Edit-interaction intent for records of this object: 'modal' opens the edit form as a dialog over the current view; 'page' navigates to a dedicated full-page edit route. Absent = the renderer picks its own default (objectui defaults to modal). Cross-renderer intent, not pixel styling (family). | diff --git a/content/docs/references/data/object.mdx b/content/docs/references/data/object.mdx index 44be57e6d4a..2d4c7433e62 100644 --- a/content/docs/references/data/object.mdx +++ b/content/docs/references/data/object.mdx @@ -164,6 +164,7 @@ const result = ApiMethod.parse(data); | **nameField** | `string` | optional | [ADR-0079] Canonical primary title field — the stored field used as the record display name (e.g. "name", "title"). | | **displayNameField** | `string` | optional | [DEPRECATED → nameField] Field to use as the record display name (e.g., "name", "title"). Accepted as an alias for nameField. | | **titleFormat** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object }` | optional | [DEPRECATED → nameField (ADR-0079)] Render-only title template; the server cannot return or query it, and an explicit nameField now takes precedence. Migrate a single-field title to nameField, a composite to a formula field designated as nameField. Placeholders may be written `{{field}}` or `{field}` — the title renderers treat the two as equivalent, normalizing `{{field}}` to `{field}` before substituting; neither spelling is judged at parse time. | +| **imageField** | `string` | optional | The record's picture: names the field the record page header (record chrome) is to draw beside the title — one object-level declaration every record detail page reads, not a per-page header prop. Must name a field of this object whose type is `image` or `avatar`; any other name is refused. A record whose field is empty shows no picture (no initials or placeholder). Pending renderer: the record chrome does not draw it yet. | | **highlightFields** | `string[]` | optional | [ADR-0085] Ordered most-important fields; first entry wins where only one fits. Drives default columns, cards, previews, detail highlight strip. Renamed from compactLayout. | | **stageField** | `string \| false` | optional | [ADR-0085] Lifecycle stage field (linear/ordered), or false to declare the status field non-linear and suppress stage heuristics. Absent = heuristic detection allowed. | | **editMode** | `Enum<'modal' \| 'page'>` | optional | Edit-interaction intent for records of this object: 'modal' opens the edit form as a dialog over the current view; 'page' navigates to a dedicated full-page edit route. Absent = the renderer picks its own default (objectui defaults to modal). Cross-renderer intent, not pixel styling (family). | diff --git a/content/docs/references/system/migration.mdx b/content/docs/references/system/migration.mdx index bb2c7757a81..029cf89bd4a 100644 --- a/content/docs/references/system/migration.mdx +++ b/content/docs/references/system/migration.mdx @@ -341,6 +341,7 @@ Create a new object | **nameField** | `string` | optional | [ADR-0079] Canonical primary title field — the stored field used as the record display name (e.g. "name", "title"). | | **displayNameField** | `string` | optional | [DEPRECATED → nameField] Field to use as the record display name (e.g., "name", "title"). Accepted as an alias for nameField. | | **titleFormat** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object }` | optional | [DEPRECATED → nameField (ADR-0079)] Render-only title template; the server cannot return or query it, and an explicit nameField now takes precedence. Migrate a single-field title to nameField, a composite to a formula field designated as nameField. Placeholders may be written `{{field}}` or `{field}` — the title renderers treat the two as equivalent, normalizing `{{field}}` to `{field}` before substituting; neither spelling is judged at parse time. | +| **imageField** | `string` | optional | The record's picture: names the field the record page header (record chrome) is to draw beside the title — one object-level declaration every record detail page reads, not a per-page header prop. Must name a field of this object whose type is `image` or `avatar`; any other name is refused. A record whose field is empty shows no picture (no initials or placeholder). Pending renderer: the record chrome does not draw it yet. | | **highlightFields** | `string[]` | optional | [ADR-0085] Ordered most-important fields; first entry wins where only one fits. Drives default columns, cards, previews, detail highlight strip. Renamed from compactLayout. | | **stageField** | `string \| false` | optional | [ADR-0085] Lifecycle stage field (linear/ordered), or false to declare the status field non-linear and suppress stage heuristics. Absent = heuristic detection allowed. | | **editMode** | `Enum<'modal' \| 'page'>` | optional | Edit-interaction intent for records of this object: 'modal' opens the edit form as a dialog over the current view; 'page' navigates to a dedicated full-page edit route. Absent = the renderer picks its own default (objectui defaults to modal). Cross-renderer intent, not pixel styling (family). | @@ -627,6 +628,7 @@ Create a new object | **nameField** | `string` | optional | [ADR-0079] Canonical primary title field — the stored field used as the record display name (e.g. "name", "title"). | | **displayNameField** | `string` | optional | [DEPRECATED → nameField] Field to use as the record display name (e.g., "name", "title"). Accepted as an alias for nameField. | | **titleFormat** | `string \| { dialect: 'template'; source?: string; ast?: any; meta?: object }` | optional | [DEPRECATED → nameField (ADR-0079)] Render-only title template; the server cannot return or query it, and an explicit nameField now takes precedence. Migrate a single-field title to nameField, a composite to a formula field designated as nameField. Placeholders may be written `{{field}}` or `{field}` — the title renderers treat the two as equivalent, normalizing `{{field}}` to `{field}` before substituting; neither spelling is judged at parse time. | +| **imageField** | `string` | optional | The record's picture: names the field the record page header (record chrome) is to draw beside the title — one object-level declaration every record detail page reads, not a per-page header prop. Must name a field of this object whose type is `image` or `avatar`; any other name is refused. A record whose field is empty shows no picture (no initials or placeholder). Pending renderer: the record chrome does not draw it yet. | | **highlightFields** | `string[]` | optional | [ADR-0085] Ordered most-important fields; first entry wins where only one fits. Drives default columns, cards, previews, detail highlight strip. Renamed from compactLayout. | | **stageField** | `string \| false` | optional | [ADR-0085] Lifecycle stage field (linear/ordered), or false to declare the status field non-linear and suppress stage heuristics. Absent = heuristic detection allowed. | | **editMode** | `Enum<'modal' \| 'page'>` | optional | Edit-interaction intent for records of this object: 'modal' opens the edit form as a dialog over the current view; 'page' navigates to a dedicated full-page edit route. Absent = the renderer picks its own default (objectui defaults to modal). Cross-renderer intent, not pixel styling (family). | diff --git a/packages/spec/authorable-surface/data.json b/packages/spec/authorable-surface/data.json index b199c25ebe8..f34b64c158a 100644 --- a/packages/spec/authorable-surface/data.json +++ b/packages/spec/authorable-surface/data.json @@ -692,6 +692,7 @@ "data/Object:fileAccessDelegate", "data/Object:highlightFields", "data/Object:icon", + "data/Object:imageField", "data/Object:indexes", "data/Object:isSystem", "data/Object:label", diff --git a/packages/spec/liveness/state-counts/object.md b/packages/spec/liveness/state-counts/object.md index 8ab2c1ecfbf..99801cb9400 100644 --- a/packages/spec/liveness/state-counts/object.md +++ b/packages/spec/liveness/state-counts/object.md @@ -12,4 +12,4 @@ committed anywhere: `check:liveness` sums the shards when it reads them. | Type | live | exp | elsewhere | dead | planned | classified | |---|---|---|---|---|---|---| -| `object` | 50 | 0 | 0 | 0 | 1 | 51 | +| `object` | 50 | 0 | 0 | 0 | 2 | 52 | From 2b175367fa0ac7ea7017b76b033f26911897f91a Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 1 Oct 2026 17:33:39 +0000 Subject: [PATCH 4/4] test(metadata-protocol): object serves 44 top-level properties once it declares imageField Claude-Session: https://claude.ai/code/session_01UtnxvdiN376GF3sgXwAw4d Co-authored-by: Claude --- .../src/protocol.meta-types-degenerate-derivation.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts b/packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts index 77712d05733..8749ab2be41 100644 --- a/packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts +++ b/packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts @@ -298,11 +298,13 @@ describe('#17501 — /meta/types serves a real schema for `action`, and moves no * against the SERVED document. They prove two things at once: this suite * measures the same thing the card measured, and none of the thirteen was * disturbed by the fix. `field` moved 74 → 75 when it gained `picklist` - * (the shared-option-list reference), a declared key, not a derivation change. + * (the shared-option-list reference), a declared key, not a derivation change; + * `object` moved 43 → 44 the same way when it gained `imageField` (the + * record's picture, beside `nameField`). */ const CARD_PROPERTY_COUNTS: Record = { agent: 26, app: 30, dashboard: 21, dataset: 16, field: 75, flow: 23, - hook: 22, object: 43, page: 24, position: 12, report: 21, skill: 17, tool: 14, + hook: 22, object: 44, page: 24, position: 12, report: 21, skill: 17, tool: 14, }; it.each(Object.entries(CARD_PROPERTY_COUNTS))(