Skip to content

Commit 95c1911

Browse files
authored
feat(spec): ADR-0079 record display-name foundation — nameField + resolver (#2434)
1 parent 7fbdafc commit 95c1911

47 files changed

Lines changed: 731 additions & 6 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/objectql/src/engine.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,9 @@ export class ObjectQL implements IDataEngine {
19271927
fields: _findSchema.fields as any,
19281928
searchableFields: (_findSchema as any).searchableFields,
19291929
requestedFields: _reqFields,
1930-
displayField: (_findSchema as any).displayNameField,
1930+
// [ADR-0079] `nameField` is the canonical primary-title pointer;
1931+
// `displayNameField` is the deprecated alias (still honored).
1932+
displayField: (_findSchema as any).nameField ?? (_findSchema as any).displayNameField,
19311933
});
19321934
if (_searchFilter) {
19331935
ast.where = ast.where ? { $and: [ast.where, _searchFilter] } : _searchFilter;

packages/objectql/src/registry.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,21 @@ export class SchemaRegistry {
567567
// applySystemFields().
568568
schema = applySystemFields(schema, { multiTenant: this.multiTenant });
569569

570+
// TODO(ADR-0079): wire `provisionPrimary` (from `@objectstack/spec/data`)
571+
// HERE — this is the object materialization seam. It should run for
572+
// `ownership === 'own'` only (extensions must not synthesize a title) and
573+
// AFTER `applySystemFields` (so a synthesized `name` co-exists with system
574+
// columns). NOT wired yet on purpose: `provisionPrimary` SYNTHESIZES a real
575+
// `name` text field when nothing is title-eligible, which the driver's
576+
// `syncSchema` would materialize as a new DB column on dozens of title-less
577+
// system/append-only tables (e.g. sys_record_share, sys_member) that today
578+
// rely on `titleFormat`. Enabling that is a schema-migration-bearing change
579+
// and must be staged behind the ADR-0079 required-title refine. Until then
580+
// the canonical pointer is resolved on read via `resolveDisplayField`.
581+
// To wire the DESIGNATE-only half safely (set nameField when derivable,
582+
// never synthesize), split `provisionPrimary` or add a `{ synthesize:false }`
583+
// option and call it here for own-objects.
584+
570585
const shortName = schema.name;
571586
const fqn = computeFQN(namespace, shortName);
572587

packages/platform-objects/src/audit/sys-email-template.object.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const SysEmailTemplate = ObjectSchema.create({
2525
managedBy: 'config',
2626
description: 'Outbound email template (subject + body + variables) resolved by name+locale',
2727
displayNameField: 'label',
28+
nameField: 'label', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField)
2829
titleFormat: '{label}',
2930
compactLayout: ['name', 'label', 'category', 'locale', 'active'],
3031

packages/platform-objects/src/audit/sys-email.object.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const SysEmail = ObjectSchema.create({
2727
managedBy: 'append-only',
2828
description: 'Outbound email delivery log',
2929
displayNameField: 'subject',
30+
nameField: 'subject', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField)
3031
titleFormat: '{subject}',
3132
compactLayout: ['subject', 'to', 'status', 'sent_at'],
3233

packages/platform-objects/src/audit/sys-job-queue.object.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const SysJobQueue = ObjectSchema.create({
3333
managedBy: 'system',
3434
description: 'Durable job/message queue including dead letters',
3535
displayNameField: 'queue',
36+
nameField: 'queue', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField)
3637
titleFormat: '{queue} #{id}',
3738
compactLayout: ['queue', 'status', 'attempts', 'scheduled_for', 'last_error'],
3839

packages/platform-objects/src/audit/sys-job-run.object.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const SysJobRun = ObjectSchema.create({
2424
managedBy: 'append-only',
2525
description: 'Background job execution audit trail',
2626
displayNameField: 'job_name',
27+
nameField: 'job_name', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField)
2728
titleFormat: '{job_name} @ {started_at}',
2829
compactLayout: ['job_name', 'status', 'started_at', 'duration_ms', 'attempt'],
2930

packages/platform-objects/src/audit/sys-job.object.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const SysJob = ObjectSchema.create({
2424
managedBy: 'system',
2525
description: 'Catalogue of registered background jobs',
2626
displayNameField: 'name',
27+
nameField: 'name', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField)
2728
titleFormat: '{name}',
2829
compactLayout: ['name', 'schedule_type', 'active', 'last_run_at', 'last_status'],
2930

packages/platform-objects/src/audit/sys-notification.object.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const SysNotification = ObjectSchema.create({
3434
managedBy: 'system',
3535
description: 'Notification events — one row per emit() (ADR-0030 Layer 2 ingress)',
3636
displayNameField: 'topic',
37+
nameField: 'topic', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField)
3738
titleFormat: '{topic}',
3839
compactLayout: ['topic', 'severity', 'source_object', 'created_at'],
3940

packages/platform-objects/src/audit/sys-saved-report.object.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const SysSavedReport = ObjectSchema.create({
3232
managedBy: 'platform',
3333
description: 'Persisted ObjectQL report definition — re-runnable and schedulable',
3434
displayNameField: 'name',
35+
nameField: 'name', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField)
3536
titleFormat: '{name}',
3637
compactLayout: ['name', 'object_name', 'format', 'owner_id', 'updated_at'],
3738

packages/platform-objects/src/identity/sys-api-key.object.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const SysApiKey = ObjectSchema.create({
3030
},
3131
description: 'API keys for programmatic access',
3232
displayNameField: 'name',
33+
nameField: 'name', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField)
3334
titleFormat: '{name}',
3435
compactLayout: ['name', 'prefix', 'user_id', 'expires_at', 'revoked'],
3536

0 commit comments

Comments
 (0)