Skip to content

Commit 2aa9af9

Browse files
committed
feat(spec): fieldPatches is live — the EXPERIMENTAL marker flips, citing mergeObjectDefinitions
Claude-Session: https://claude.ai/code/session_01FEkQ5nSMgkteiemkoN31vf Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5e34f3e commit 2aa9af9

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

‎packages/spec/src/data/field-customization.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ describe('`ObjectExtensionSchema.fieldPatches` — the per-field display patch s
212212
expect('fieldPatches' in parsed).toBe(false);
213213
});
214214

215-
it('reads `[EXPERIMENTAL — not enforced]` and names the merge card until the merge applies it', () => {
215+
it('is live: no `[EXPERIMENTAL — not enforced]` marker, and it names the merge that applies it', () => {
216216
const description = shapeOf(ObjectExtensionSchema).fieldPatches!.description ?? '';
217-
expect(description.startsWith('[EXPERIMENTAL — not enforced]')).toBe(true);
218-
expect(description).toContain('N-23d');
217+
expect(description).not.toContain('EXPERIMENTAL');
218+
expect(description).toContain('mergeObjectDefinitions');
219219
});
220220
});

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4877,8 +4877,8 @@ function refuseExtensionFieldPatchKeys(fieldPatches: unknown, ctx: z.RefinementC
48774877
* objectExtensions: [{
48784878
* extend: 'contact', // target object FQN
48794879
* fields: { sales_stage: Field.select([...]) },
4880-
* // A base field's display properties only (ADR-0146 D10). Not applied
4881-
* // until the registry merge carries the slot — see `fieldPatches`.
4880+
* // A base field's display properties only (ADR-0146 D10), applied by the
4881+
* // registry merge (`mergeObjectDefinitions`) — see `fieldPatches`.
48824882
* fieldPatches: { industry: { label: 'Sector', options: { tech: { label: 'Technology' } } } },
48834883
* }]
48844884
* ```
@@ -4900,12 +4900,9 @@ export const ObjectExtensionSchema = lazySchema(() => strictObject({
49004900
},
49014901
guidance: {
49024902
// The merge in `objectql/src/engine.ts` copies EXACTLY the declared keys
4903-
// (extend / fields / label / pluralLabel / description / validations /
4904-
// indexes / priority) onto the extension def. Anything else is not
4905-
// "unsupported yet" — there is no slot for it to arrive through.
4906-
// `fieldPatches` is the one declared key that copy does not carry yet:
4907-
// it is parsed and marked not enforced until the merge card (N-23d,
4908-
// #28565) carries it through the engine into `mergeObjectDefinitions`.
4903+
// (extend / fields / fieldPatches / label / pluralLabel / description /
4904+
// validations / indexes / priority) onto the extension def. Anything else
4905+
// is not "unsupported yet" — there is no slot for it to arrive through.
49094906
actions:
49104907
'`actions` cannot be contributed through an object extension — the merge carries ' +
49114908
'`fields`, `label`, `pluralLabel`, `description`, `validations` and `indexes` only. ' +
@@ -4953,18 +4950,21 @@ export const ObjectExtensionSchema = lazySchema(() => strictObject({
49534950
* fields. Keys are DERIVED from `BASE_FIELD_DISPLAY_WHITELIST`; structural
49544951
* keys are refused by name with the D6 prescription; an `__c` key is refused
49554952
* by the root refinement below. Pure shape: whether the target has the field
4956-
* or the option, and who may patch, are the server's (N-23d, #28565), which
4957-
* also carries the slot through `engine.ts`'s extension copy — dropped there
4958-
* until then — and flips the marker below.
4953+
* or the option is the server's — `@objectstack/metadata-core`'s
4954+
* `fieldPatchTargetMisses`, refused at the marketplace install door and at
4955+
* `os validate`, named in the boot log — and the merge that applies the patch
4956+
* is `@objectstack/objectql`'s `mergeObjectDefinitions`.
49594957
*/
49604958
fieldPatches: z.record(z.string(), FieldDisplayPatchSchema).optional().describe(
4961-
'[EXPERIMENTAL — not enforced] Display patches of the target object\'s own fields, keyed by field ' +
4962-
'name: change a vendor field\'s display properties (BASE_FIELD_DISPLAY_WHITELIST: label, description, ' +
4963-
'help text, placeholder, option labels) without taking the field over, so its type, values and rules ' +
4964-
'stay the vendor\'s and its upgrades still apply (ADR-0146 D10). Nothing applies a patch yet: the ' +
4965-
'registry merge that does is rollout card N-23d, and until it lands the engine drops this slot at ' +
4966-
'registration. Example: `fieldPatches: { industry: { label: \'Sector\', inlineHelpText: \'The market ' +
4967-
'the account sells into\', options: { tech: { label: \'Technology\' } } } }`.',
4959+
'Display patches of the target object\'s own fields, keyed by field name: change a vendor field\'s ' +
4960+
'display properties (BASE_FIELD_DISPLAY_WHITELIST: label, description, help text, placeholder, option ' +
4961+
'labels) without taking the field over, so its type, values and rules stay the vendor\'s and its ' +
4962+
'upgrades still apply (ADR-0146 D10). Applied by the registry merge (`mergeObjectDefinitions`) after ' +
4963+
'the additive merges, on every object read: a tenant\'s own text keeps winning, and between two ' +
4964+
'extensions the higher `priority` wins. A patch naming a field or option value the target does not ' +
4965+
'have is refused at install and by `os validate`. Example: `fieldPatches: { industry: { label: ' +
4966+
'\'Sector\', inlineHelpText: \'The market the account sells into\', options: { tech: { label: ' +
4967+
'\'Technology\' } } } }`.',
49684968
),
49694969

49704970
/** Override label */

0 commit comments

Comments
 (0)