diff --git a/.changeset/33494-extension-door-priority-fold.md b/.changeset/33494-extension-door-priority-fold.md new file mode 100644 index 00000000000..46e2de2fed4 --- /dev/null +++ b/.changeset/33494-extension-door-priority-fold.md @@ -0,0 +1,23 @@ +--- +'@objectstack/lint': minor +'@objectstack/metadata-protocol': minor +'@objectstack/spec': minor +--- + +fix(lint, metadata-protocol): the `object_extension` publish door folds the written entry among the other packages' extensions of its target by priority, so it judges the field definition `os build` judges + +Clause-②: no (narrowing) — at the runtime `object_extension` publish door (Studio, `PUT /api/v1/meta/object_extension/TARGET`, the MCP and AI authoring doors) the expression rule now reads each field of the target as `os build` serves it when another package's published extension adds the same field: one write it accepted is now refused (a higher-priority package's definition of a field the written entry also adds closes a formula cycle through another field of the entry), and two it refused now publish (the written entry ties with another package on that field, or another package outranks it there). `os build` is unchanged. The new gate input (`storedObjectExtensions` on `runRuntimeAuthoringRules` and `evaluateRuntimeAuthoringGate`, the `StoredObjectExtension` type from `@objectstack/lint/runtime`) is optional. Measured first-party exposure: no two first-party packages extend the same object (`examples/app-showcase` one entry on `showcase_account`, `packages/plugins/plugin-auth` one on `sys_sso_provider`, HotCRM `origin/main` 2492ac6 one module, o2c, extending `crm_contract` and `crm_account`), so no first-party write changes verdict. +Metadata-protocol: narrowed +Skills-docs: none owed — this PR edits `content/docs/deployment/validating-metadata.mdx` (the object extension paragraph states the door's fold); the skills teach `defineObjectExtension({ extend, fields, priority })` and formula fields, and say nothing of how the door read a field two packages add. + + + +**BREAKING** accept-set change of the runtime `object_extension` publish door (narrowing in one shape, widening in two). + +**Before:** the door's target carried every other package's extension field as a plain field with no package and no priority, and the gate folded the written entry over it, so the door judged the written entry's own definition of every field it adds. A self-reading formula the written entry adds under a field another package adds at the same priority, or at a higher one, was refused although `os build` accepts it; and a higher-priority package's formula closing a cycle through another field of the written entry was not seen, although `os build` refuses it. + +**Now:** the host states the target's other packages' published extensions (each with its package, priority and fields; a disabled package's left out), and the gate folds the written entry among them by priority through the build's own fold (`objectsAsServed`). The door judges the definition `os build` judges: the written entry's where its priority decides the field, another package's where that one outranks it, and none where two packages add it at the priority that decides it. This corrects the `@objectstack/lint` 33153 note's **Now** clause "(at the door, a name the target already serves included: the written definition is the one served)" and its **Unchanged** sentence "The publish door judges the written entry's own definition of every field it adds, whatever priority another package's extension adds the same field at, so it can refuse a tie, or an entry another package outranks, that `os build` lets through": the written definition is the one judged where the written entry's priority decides the field, and the door no longer refuses a tie or an outranked entry that `os build` accepts. Where that note says "at the same priority", read "at the priority that decides it". + +**Unchanged:** `os build`, `os validate` and `os lint`; a write the door judges with no other package extending the same field; a host that states no extensions (the written entry is folded over the target as served); a draft save (never gated). + +**Fix:** a write refused for the new shape: break the cycle, so the formula the entry adds does not read a field that another package's higher-priority formula computes from it, or rename the entry's field so it is not outranked. diff --git a/content/docs/deployment/validating-metadata.mdx b/content/docs/deployment/validating-metadata.mdx index 21f76b01e6f..39f8d5a4787 100644 --- a/content/docs/deployment/validating-metadata.mdx +++ b/content/docs/deployment/validating-metadata.mdx @@ -623,11 +623,13 @@ through another formula, is refused as one the object declares is (#33153): the cycle is found on the target as served, each member the entry adds is located at the entry (`object 'TARGET' · objectExtensions[0] · field 'FIELD' expression`), and in `os build` a member the target declares keeps its -location at the object. The door judges the written entry's own definition of -every field it adds, so a name the target already serves is refused at the -entry too, whatever priority another package's extension adds it at; `os build` -judges the definition the registry serves, and on a declared object leaves out -a field two packages add at the same priority. +location at the object. The door folds the written entry among the other +packages' published extensions of the target by priority, as `os build` folds +every package's entry (#33494), so both judge the same definition of each +field: the written entry's where its priority decides the field (a name the +target already serves included), another package's where that one outranks it. +On a declared object neither judges a field two packages add at the priority +that decides it. **Declared enforcement that cannot run** is two rows for the mirror-image reason, and #4716 is where it split. That heading covers four rule ids, and diff --git a/packages/lint/src/authoring-rules.ts b/packages/lint/src/authoring-rules.ts index 0e9f012f541..a79413dbc46 100644 --- a/packages/lint/src/authoring-rules.ts +++ b/packages/lint/src/authoring-rules.ts @@ -172,6 +172,7 @@ import { import type { IObjectQLEngine } from '@objectstack/spec/contracts'; import type { UserTextParams } from './finding-user-text.js'; +import type { StoredObjectExtension } from './object-graph.js'; type AnyRec = Record; @@ -356,6 +357,15 @@ export interface AuthoringRuleContext { * platform names, a platform-prefixed name advised at `warning`) applies. */ runtimeWriteType?: string; + /** + * [#33494] Set by the runtime gate on an `object_extension` write only: the + * written entry's target's other packages' published extensions, as the + * host's registry holds them. Read by one rule, `validateStackExpressions`, + * whose extension walk folds the written entry among them by priority (the + * build's own fold, `objectsAsServed`), so the door judges the definition + * the build judges (`StackExpressionOptions.storedObjectExtensions`). + */ + storedObjectExtensions?: readonly StoredObjectExtension[]; /** * [#32666] Set by the runtime gate on its SUBJECT pass only, which judges * the subject collections it withholds from every other pass @@ -850,7 +860,10 @@ export const AUTHORING_RULES: readonly AuthoringRule[] = [ surfaces: CLI_AND_RUNTIME, runtimeTypes: ['flow', 'action', 'hook', 'object', 'view', 'page', 'object_extension'], run: (stack, ctx) => - runStackExpressionPasses(stack, { runtimeWriteType: ctx.runtimeWriteType }).map((i) => ({ + runStackExpressionPasses(stack, { + runtimeWriteType: ctx.runtimeWriteType, + ...(ctx.storedObjectExtensions !== undefined ? { storedObjectExtensions: ctx.storedObjectExtensions } : {}), + }).map((i) => ({ severity: i.severity ?? 'error', // [#32529, #32554] The stored-expression input member names its own // two ids; every other finding of the pass is `expression-invalid`. diff --git a/packages/lint/src/formula-cycle-issues.ts b/packages/lint/src/formula-cycle-issues.ts index 7f3b8df6449..471063cd70d 100644 --- a/packages/lint/src/formula-cycle-issues.ts +++ b/packages/lint/src/formula-cycle-issues.ts @@ -98,12 +98,19 @@ export function formulaCycleIssues( * elsewhere. The build passes the names the authored target declares (the * object walk locates those at the object, so a cycle closing through a * declared formula keeps that location); the `object_extension` door passes - * none, since it judges the written entry's own definition of every name the - * entry adds, over everything the target served before the write. + * none, since its target is served before the write and the object walk does + * not run there. + * + * [#33494] A `stored` entry (another package's published extension, which the + * door folds in among the written one by priority) locates nothing: a name it + * adds later in fold order than the written entry is the stored entry's + * definition, served over the written one, so no locus is left for it, and a + * cycle it closes through another field of the written entry is named on + * that field alone. */ export function extensionFormulaLoci( target: string, - entries: ReadonlyArray<{ path: string; fields: readonly AnyRec[] }>, + entries: ReadonlyArray<{ path: string; fields: readonly AnyRec[]; stored?: true }>, left: ReadonlySet, ): Map { const loci = new Map(); @@ -111,7 +118,8 @@ export function extensionFormulaLoci( for (const field of entry.fields) { const name = field.name; if (typeof name !== 'string' || left.has(name)) continue; - loci.set(name, `object '${target}' · ${entry.path} · field '${name}' expression`); + if (entry.stored) loci.delete(name); + else loci.set(name, `object '${target}' · ${entry.path} · field '${name}' expression`); } } return loci; diff --git a/packages/lint/src/object-graph.ts b/packages/lint/src/object-graph.ts index 4b0ab2199e9..7216c756cc7 100644 --- a/packages/lint/src/object-graph.ts +++ b/packages/lint/src/object-graph.ts @@ -396,6 +396,32 @@ export interface VisibleObjectExtension { */ label: unknown; fieldPatches: Record; + /** + * [#33494] Set on an entry the host's registry already holds + * ({@link StoredObjectExtension}), folded in at its priority but never + * located: its fields are no field of the stack, so no walk names one. + */ + stored?: true; +} + +/** + * [#33494] Another package's published extension of an object, as the host's + * registry holds it (each `extend` contribution of the object: its package, + * its merge priority, its fields). The `object_extension` publish door states + * them for the written entry's target, so {@link objectExtensionsByTarget} + * folds the written entry among them by priority, as the build folds every + * package's entry, instead of over their fields carried as plain fields with + * no priority. Never stated by the build, whose stack carries every entry. + */ +export interface StoredObjectExtension { + /** The object it extends. */ + extend: string; + /** Its merge priority; absent reads as the registry's default, 200. */ + priority?: number; + /** Its field records (a record keyed by name, or an array). */ + fields?: unknown; + /** The package it belongs to, for the record; the fold reads only the order. */ + packageId?: string; } /** @@ -428,17 +454,25 @@ export interface VisibleObjectExtension { * earlier one whole, its fields included. * - Fold order: ascending `priority` (default 200), equal priorities in * package order. Each list is returned in that order. + * - [#33494] `stored`: the entries the host's registry already holds for + * another package (the `object_extension` door states them, the build never + * does), each its own package, registered before every entry of the stack + * and marked `stored`. They fold as any entry does, so the stack's entry + * that one outranks is not the one served and a tie between them is a tie. * * Which targets to judge is the caller's question: an entry is listed here * whether or not the stack declares its target. */ -export function objectExtensionsByTarget(stack: unknown): Map { +export function objectExtensionsByTarget( + stack: unknown, + stored: readonly StoredObjectExtension[] = [], +): Map { const byTarget = new Map(); if (!isRec(stack)) return byTarget; // The receivers are named as `validate-security-posture.test.ts`'s key-read // meta-test tables them (`stack`, `entry`, `body`, `ext`, `obj`, `f`): that // scan reads this fold as part of the rules that read through it. - const collect = (entries: unknown, carrier: number, at: string) => { + const collect = (entries: unknown, carrier: number, at: string, held = false) => { if (!Array.isArray(entries)) return; entries.forEach((ext: unknown, i: number) => { if (!isRec(ext) || typeof ext.extend !== 'string') return; @@ -455,10 +489,14 @@ export function objectExtensionsByTarget(stack: unknown): Map isRec(pair[1])), ) : {}, + ...(held ? { stored: true as const } : {}), }); byTarget.set(ext.extend, kept); }); }; + // [#33494] Registered before the stack's own entries: carriers below 0, one + // per stored entry, in the order the host states them. + stored.forEach((entry, k) => collect([entry], k - stored.length, `stored[${k}].`, true)); if (Array.isArray(stack.packages)) { stack.packages.forEach((entry: unknown, j: number) => { const body = isRec(entry) ? entry.manifest : undefined; @@ -492,6 +530,9 @@ export function objectExtensionsByTarget(stack: unknown): Map> } { +export function objectsAsServed( + stack: unknown, + stored: readonly StoredObjectExtension[] = [], +): { objects: AnyRec[]; tied: Map> } { const objects = isRec(stack) ? recordsOf(stack.objects) : []; const tied = new Map>(); - const extensions = objectExtensionsByTarget(stack); + const extensions = objectExtensionsByTarget(stack, stored); if (extensions.size === 0) return { objects, tied }; const served = objects.map((obj) => { diff --git a/packages/lint/src/runtime-gate.object-formula-cycle.test.ts b/packages/lint/src/runtime-gate.object-formula-cycle.test.ts index 3ffc9d77025..e0a1e7995d9 100644 --- a/packages/lint/src/runtime-gate.object-formula-cycle.test.ts +++ b/packages/lint/src/runtime-gate.object-formula-cycle.test.ts @@ -16,6 +16,7 @@ import { describe, expect, it } from 'vitest'; import { formulaCycleMessage } from '@objectstack/formula'; import { EXPRESSION_INVALID, runAuthoringRules } from './authoring-rules.js'; import { runRuntimeAuthoringRules } from './runtime-gate.js'; +import type { StoredObjectExtension } from './object-graph.js'; const formula = (expression: string) => ({ type: 'formula', label: 'F', expression, returnType: 'number' }); @@ -99,8 +100,18 @@ describe('#33153 — formula cycles an object extension adds, at the object_exte const target = (formulas: Record = {}) => xJob(formulas); const extension = (fields: Record) => ({ extend: 'x_job', fields }); const extWhere = (field: string, at = 0) => `object 'x_job' · objectExtensions[${at}] · field '${field}' expression`; - const gateExtension = (item: unknown, objects: unknown[] = [target()]) => - runRuntimeAuthoringRules({ type: 'object_extension', item, context: { objects } }); + /** + * The door, as `judgeRuntimeAuthoringRules` calls it: the live target, and + * (#33494) the target's other packages' published extensions when the host + * states them (`storedObjectExtensions`, from the registry's contributors). + */ + const gateExtension = (item: unknown, objects: unknown[] = [target()], stored?: StoredObjectExtension[]) => + runRuntimeAuthoringRules({ + type: 'object_extension', + item, + context: { objects }, + ...(stored !== undefined ? { storedObjectExtensions: stored } : {}), + }); const build = (stack: Record) => cycleFindings(runAuthoringRules('build', { normalized: stack, parsed: stack })); const located = (fs: ReadonlyArray<{ where: string; message: string }>) => fs.map(({ where: w, message }) => ({ where: w, message })); @@ -196,28 +207,78 @@ describe('#33153 — formula cycles an object extension adds, at the object_exte ]); }); - it('the door judges the written entry\'s own definition whatever a sibling\'s priority: a tie and an outranked entry are refused there, though the build lets both through (#33494)', () => { - // The door's live target carries the sibling's `s__c` as a plain field, - // with no priority, and folds the written entry over it. - const served = target({ s__c: { type: 'number', label: 'Sibling' } }); - const sibling = (priority: number) => ({ ...extension({ s__c: { type: 'number', label: 'Sibling' } }), priority }); - const written = (priority: number) => ({ ...extension({ s__c: formula('record.s__c * 2') }), priority }); - const twoPackages = (siblingPriority: number, writtenPriority: number) => ({ + describe('#33494 — the door serves the build\'s winner when the host states the other packages\' extensions', () => { + // The door's live target carries a sibling package's published `s__c` as a + // plain field; the host also states the sibling's extension itself, with + // its package and priority, so the gate folds the written entry among it + // by priority, as the build folds both packages' entries. + const number = { type: 'number', label: 'Sibling' }; + const stored = (fields: Record, priority: number): StoredObjectExtension => + ({ extend: 'x_job', priority, fields, packageId: 'com.acme.sibling' }); + const twoPackages = (sibling: Record, siblingPriority: number, written: unknown) => ({ objects: [target()], packages: [ - { manifest: { objectExtensions: [sibling(siblingPriority)] } }, - { manifest: { objectExtensions: [written(writtenPriority)] } }, + { manifest: { objectExtensions: [{ ...extension(sibling), priority: siblingPriority }] } }, + { manifest: { objectExtensions: [written] } }, ], }); + const writtenAt = (packageWhere: string) => packageWhere.replace('objectExtensions[0]', 'packages[1].manifest.objectExtensions[0]'); + + it('⭐ shapes 1 and 2 — a tie (200/200) and an outranked entry (sibling 300, written 200) are not refused at the door, as the build does not refuse them', () => { + const served = target({ s__c: number }); + for (const [label, siblingPriority, writtenPriority] of [['a tie', 200, 200], ['outranked', 300, 200]] as const) { + const written = { ...extension({ s__c: formula('record.s__c * 2') }), priority: writtenPriority }; + const door = cycleFindings(gateExtension(written, [served], [stored({ s__c: number }, siblingPriority)]).errors); + expect(door, `${label}: ${dump(door)}`).toEqual([]); + const built = build(twoPackages({ s__c: number }, siblingPriority, written)); + expect(built, `${label}: ${dump(built)}`).toEqual([]); + } + }); - for (const [label, siblingPriority, writtenPriority] of [['a tie', 200, 200], ['outranked', 300, 200]] as const) { - const door = cycleFindings(gateExtension(written(writtenPriority), [served]).errors); - expect(door.map((f) => f.where), `${label}: ${dump(door)}`).toEqual([extWhere('s__c')]); - // The build drops the tied name on a declared target, and serves the - // outranking sibling's number: neither leaves a cycle to name. - const built = build(twoPackages(siblingPriority, writtenPriority)); - expect(built, `${label}: ${dump(built)}`).toEqual([]); - } + it('⭐ LIT shape 3 — a higher sibling\'s definition closing a cycle through another field of the entry is refused at the door on that field, as the build refuses it', () => { + // The sibling (300) serves `s__c` as a formula reading `a__c`; the written + // entry (200) adds `s__c` as a number, outranked, and `a__c` reading `s__c`. + const siblingFields = { s__c: formula('record.a__c + 1') }; + const served = target(siblingFields); + const written = { ...extension({ s__c: number, a__c: formula('record.s__c * 2') }), priority: 200 }; + + const door = cycleFindings(gateExtension(written, [served], [stored(siblingFields, 300)]).errors); + expect(door.map((f) => f.where), dump(door)).toEqual([extWhere('a__c')]); + expect(door[0]!.message).toContain(formulaCycleMessage('a__c', ['a__c', 's__c'])); + + // The build names the entry's member at the entry and the sibling's at the sibling's. + const built = build(twoPackages(siblingFields, 300, written)); + expect(built.map((f) => f.where), dump(built)).toEqual([ + "object 'x_job' · packages[0].manifest.objectExtensions[0] · field 's__c' expression", + writtenAt(extWhere('a__c')), + ]); + }); + + it('the entry that outranks the sibling (written 300 over sibling 200) is still refused at the door at the entry', () => { + const served = target({ s__c: number }); + const written = { ...extension({ s__c: formula('record.s__c * 2') }), priority: 300 }; + const door = cycleFindings(gateExtension(written, [served], [stored({ s__c: number }, 200)]).errors); + expect(door.map((f) => f.where), dump(door)).toEqual([extWhere('s__c')]); + const built = build(twoPackages({ s__c: number }, 200, written)); + expect(built.map((f) => f.where), dump(built)).toEqual([writtenAt(extWhere('s__c'))]); + }); + + it('a tied name is not served again from the target as the sibling stored it: a sibling\'s cyclic definition there is not charged to the write', () => { + // The sibling's own `s__c` reads itself (its stored cycle); the written + // entry adds `s__c` at the same priority. The tie leaves the name out, as + // the build leaves it out; the target's served copy does not put it back. + const siblingFields = { s__c: formula('record.s__c + 1') }; + const written = { ...extension({ s__c: number }), priority: 200 }; + const door = cycleFindings(gateExtension(written, [target(siblingFields)], [stored(siblingFields, 200)]).errors); + expect(door, dump(door)).toEqual([]); + expect(build(twoPackages(siblingFields, 200, written))).toEqual([]); + }); + + it('a host that states no extensions leaves the door as it was: the written entry is folded over the target as served', () => { + const written = { ...extension({ s__c: formula('record.s__c * 2') }), priority: 200 }; + const door = cycleFindings(gateExtension(written, [target({ s__c: number })]).errors); + expect(door.map((f) => f.where), dump(door)).toEqual([extWhere('s__c')]); + }); }); it('a sibling package\'s stored cycle, and a formula that only reads a cycle, are not the extension write\'s to answer for', () => { diff --git a/packages/lint/src/runtime-gate.ts b/packages/lint/src/runtime-gate.ts index effba98294f..1244d717919 100644 --- a/packages/lint/src/runtime-gate.ts +++ b/packages/lint/src/runtime-gate.ts @@ -76,6 +76,7 @@ import { import { isSystemObject } from './validate-security-posture.js'; import { membershipKeyOwnersOf } from './validate-membership-key-declarations.js'; import type { IObjectQLEngine } from '@objectstack/spec/contracts'; +import type { StoredObjectExtension } from './object-graph.js'; type AnyRec = Record; @@ -1421,6 +1422,18 @@ export function runRuntimeAuthoringRules(args: { * Omitted, the subject differential uses `context.objects`. */ subjectObjects?: readonly unknown[]; + /** + * [#33494] On an `object_extension` write: the written entry's target's + * OTHER packages' published extensions, as the host's registry holds them + * (package, priority, fields), disabled packages left out. `context.objects` + * carries their fields on the target as plain fields with no priority; with + * these the expression rule folds the written entry among them by priority, + * the build's own fold, so it judges the definition the build judges. + * Handed to the rules as `AuthoringRuleContext.storedObjectExtensions`, the + * same value in every pass. Read on no other write type; omitted, the door + * folds the written entry over the target as served, as before. + */ + storedObjectExtensions?: readonly StoredObjectExtension[]; }): RuntimeGateResult { const rules = runtimeAuthoringRulesFor(args.type); const empty: RuntimeGateResult = { errors: [], advisories: [], rulesRun: [] }; @@ -1483,6 +1496,11 @@ export function runRuntimeAuthoringRules(args: { ...(args.rlsMembershipResolverKeys !== undefined ? { membershipKeyOwners: membershipKeyOwnersOf(args.context?.objects, args.rlsMembershipResolverKeys) } : {}), + // [#33494] Stated on an extension write only; the same value in every + // pass, so it moves no baseline (the baseline carries no written entry). + ...(args.type === 'object_extension' && args.storedObjectExtensions !== undefined + ? { storedObjectExtensions: args.storedObjectExtensions } + : {}), }; const added = addedFindings(rules, snapshots, ctx, args.type, args.item); diff --git a/packages/lint/src/runtime.ts b/packages/lint/src/runtime.ts index 7bbb70fb7e7..979a9ebc051 100644 --- a/packages/lint/src/runtime.ts +++ b/packages/lint/src/runtime.ts @@ -81,6 +81,10 @@ export type { RuntimeStackContext, } from './runtime-gate.js'; export type { AuthoringFinding, AuthoringSeverity } from './authoring-rules.js'; +// [#33494] The other packages' published extensions the `object_extension` +// door states for the written entry's target +// (`runRuntimeAuthoringRules({ storedObjectExtensions })`). +export type { StoredObjectExtension } from './object-graph.js'; // [ruling record 6819749037] The user-facing sentence of a finding, for the // door that holds the request: it hands in the request's locale and the // workspace default, and puts the answer on the wire as diff --git a/packages/lint/src/validate-expressions.test.ts b/packages/lint/src/validate-expressions.test.ts index 7ec64a38de5..59f7ced888f 100644 --- a/packages/lint/src/validate-expressions.test.ts +++ b/packages/lint/src/validate-expressions.test.ts @@ -4375,6 +4375,10 @@ describe('validateStackExpressions — reads only keys the spec declares (meta-t // the metadata reads, `options` and `picklist`, go through // `declaresOptionsOnceServed`. 'fieldList', 'declaredNames', + // [#33494] The names the door's stored extensions add (a Set of field + // names), read to keep the target's served copy from filling a tied + // name back in. Its keys are Set methods (`add`, `has`), never metadata keys. + 'storedNames', // [#13935] The field-rule verdict, split into a compute half and a push // half so the walk can tell `check` a verdict was issued. `verdict`'s // keys are this helper's own `{ root, message, source }`, never metadata diff --git a/packages/lint/src/validate-expressions.ts b/packages/lint/src/validate-expressions.ts index 68cab7c5183..6bdc0cf189c 100644 --- a/packages/lint/src/validate-expressions.ts +++ b/packages/lint/src/validate-expressions.ts @@ -167,6 +167,7 @@ import { findUnguardedNullableOperands, nullGuardMessage, provenNonNullKeys } fr import type { NullGuardFinding, NullGuardOptions, NullGuardOutcome } from './validate-null-guards.js'; import { stripInjectedSystemColumns } from '@objectstack/metadata-core'; import { objectExtensionsByTarget, objectsAsServed, objectsWithoutTiedFields, recordsOf } from './object-graph.js'; +import type { StoredObjectExtension } from './object-graph.js'; import { storedExpressionInputIssues } from './stored-expression-inputs.js'; import { extensionFormulaLoci, formulaCycleIssues } from './formula-cycle-issues.js'; export interface ExprIssue { @@ -2387,6 +2388,19 @@ export interface StackExpressionOptions { * through the per-item door works. */ runtimeWriteType?: string; + /** + * [#33494] On an `object_extension` write only: the written entry's target's + * OTHER packages' published extensions, as the host's registry holds them + * (`AuthoringRuleContext.storedObjectExtensions`). The door's live target + * carries their fields as plain fields with no package and no priority, so + * without them the walk folded the written entry over all of them and served + * its definition of every name it adds. With them the fold + * (`objectsAsServed` and `objectExtensionsByTarget`, the build's own) places + * the written entry among them by priority: a sibling that outranks it is + * served, and a name they add at the priority that decides it is a tie, left + * out as the build leaves it out. Read on no other write. + */ + storedObjectExtensions?: readonly StoredObjectExtension[]; /** * [#32872] Set only by `judgeAuthoredSiteExpression` * (`authored-site-expression.ts`), the entry the MCP `validate_expression` @@ -2452,6 +2466,10 @@ export function runStackExpressionPasses(stack: AnyRec, options: StackExpression // after that walk, so the claim holds by construction. See // {@link StackExpressionOptions.runtimeWriteType}. const extensionWrite = options.runtimeWriteType === 'object_extension'; + // [#33494] The target's other packages' published extensions the door folds + // the written entry among, by priority. See + // {@link StackExpressionOptions.storedObjectExtensions}. + const storedExtensions = extensionWrite ? options.storedObjectExtensions ?? [] : []; // [#32872] See {@link StackExpressionOptions.sharedValidatorRunByCaller}. const validatorRunByCaller = options.sharedValidatorRunByCaller === true; // [#24798] On a `view` write exactly ONE pass judges — the bulk `confirmText` @@ -2491,7 +2509,7 @@ export function runStackExpressionPasses(stack: AnyRec, options: StackExpression // the registry serves is registration order, which the stack does not state, // so such a field is a known name with no type and no null-guard verdict. // The read-attachment index is object-level and an extension carries none. - const { objects: servedObjects, tied } = objectsAsServed(stack); + const { objects: servedObjects, tied } = objectsAsServed(stack, storedExtensions); const typedObjects = objectsWithoutTiedFields({ objects: servedObjects, tied }); const fieldIndex = buildFieldIndex(servedObjects); const attachedOnReadIndex = buildAttachedOnReadIndex(objects); @@ -4218,8 +4236,11 @@ export function runStackExpressionPasses(stack: AnyRec, options: StackExpression // `objectExtensions` and the door's live objects as `objects`, so the field // (and, #33154, the rule's field reads) is judged against its target as // served and located where the build locates it (`objectExtensions[0]` for - // a one-entry stack). - for (const [target, entries] of objectWrite ? [] : objectExtensionsByTarget(stack)) { + // a one-entry stack). [#33494] The target's other packages' published + // extensions join the fold there (`storedExtensions`), each at its priority, + // so the written entry is served where the build serves it; they are folded + // in, never judged or located (`stored`). + for (const [target, entries] of objectWrite ? [] : objectExtensionsByTarget(stack, storedExtensions)) { // The target's position in `objects`, which is its position in // `typedObjects` too (see `objectPosition` above); -1 when undeclared. let position = -1; @@ -4236,8 +4257,16 @@ export function runStackExpressionPasses(stack: AnyRec, options: StackExpression // Its fields by name as the registry serves them, built as the object // walk builds its own `fieldDefs`. const fieldDefs = new Map(servedTarget ? fieldEntries(servedTarget) : []); + // [#33494] On the door's pass `base` already carries the stored entries' + // fields as plain fields, folded before the write; filled back from it, a + // name they tie on would be served again as one sibling's definition. Their + // names come from the fold above alone, as in the build. + const storedNames = new Set(); + for (const { fields: held, stored } of entries) { + if (stored) for (const [n] of fieldEntries({ fields: held })) storedNames.add(n); + } if (base) { - for (const [n, def] of fieldEntries(base)) if (!fieldDefs.has(n)) fieldDefs.set(n, def); + for (const [n, def] of fieldEntries(base)) if (!fieldDefs.has(n) && !storedNames.has(n)) fieldDefs.set(n, def); for (const [n, def] of injectedColumnDefsFor(base)) if (!fieldDefs.has(n)) fieldDefs.set(n, def as AnyRec); } else { for (const { fields: added } of entries) { @@ -4247,7 +4276,10 @@ export function runStackExpressionPasses(stack: AnyRec, options: StackExpression const extensionOptionFields = [...fieldDefs] .filter(([, def]) => declaresOptionsOnceServed(def)) .map(([n]) => n); - for (const { path: entryPath, fields: added, validations: rules } of entries) { + for (const { path: entryPath, fields: added, validations: rules, stored } of entries) { + // [#33494] A stored entry is another package's, already published: folded + // in above, judged on its own write, never located here. + if (stored) continue; for (const f of added) { const fname = typeof f.name === 'string' ? f.name : '?'; judgeFieldFormula(fname, f, { @@ -4300,19 +4332,19 @@ export function runStackExpressionPasses(stack: AnyRec, options: StackExpression // In the build `base` is the authored object, and a member it declares is // the object walk's, located at the object: a cycle closing through a // declared formula keeps that location and is named once. On the door's - // one pass `base` is the target as served BEFORE the write (other - // packages' published extension fields included, carried as plain fields - // with no priority) and the object walk does not run, while the written - // entry, its sole extension, is folded over it. So the door judges the - // written entry's own definition of every name it adds, a name the target - // already serves included, and none is left out there. Where a sibling - // package adds the same name at the same priority (a tie, which the build - // drops on a declared target) or at a higher one (the build serves the - // sibling's), the door can refuse a cycle the build lets through; making - // the door read the build's winner is #33494. A member the target or a - // sibling package stored is never a name the entry adds, so the target's - // own cycle, a sibling's, and a formula that only reads a cycle are not - // this write's to answer for. + // one pass `base` is the target as served BEFORE the write and the object + // walk does not run, so no name is left out there. [#33494] The other + // packages' published extensions of the target are folded in with the + // written entry by priority (`storedExtensions`, the build's fold), so the + // door serves the definition the build serves: the written entry's where + // it decides a name, a sibling's where the sibling outranks it, none where + // they add it at the priority that decides it (a tie, left out as the + // build leaves it out on a declared target). A stored entry locates + // nothing ({@link extensionFormulaLoci}), so a cycle a sibling's + // definition closes through another field of the written entry is named + // on that field, and a member the target or a sibling package stored is + // never this write's: the target's own cycle, a sibling's, and a formula + // that only reads a cycle are not charged to it. const ownNames = new Set(base && !extensionWrite ? fieldEntries(base).map(([n]) => n) : []); issues.push(...formulaCycleIssues(target, fieldDefs, extensionFormulaLoci(target, entries, ownNames))); } diff --git a/packages/lint/src/validate-security-posture.test.ts b/packages/lint/src/validate-security-posture.test.ts index d2a97806401..bb1e7c195a0 100644 --- a/packages/lint/src/validate-security-posture.test.ts +++ b/packages/lint/src/validate-security-posture.test.ts @@ -2483,6 +2483,9 @@ describe('validateSecurityPosture — reads only keys the spec declares (meta-te // #31998: the role-word extension walk's finding path (`….fieldPatches.${fieldName}.label`), a template // segment and not a receiver. 'fieldPatches', + // #33494: the fold's `stored` parameter, the host's list of other packages' published extensions + // (`StoredObjectExtension[]`) — `.forEach`, a JS Array method; each entry is read by `collect` as `ext`. + 'stored', ]); expect(receivers.filter((r) => !tabled.has(r) && !PLUMBING.has(r))).toEqual([]); }); diff --git a/packages/metadata-protocol/src/protocol-authoring-gate.extension-write-fold.test.ts b/packages/metadata-protocol/src/protocol-authoring-gate.extension-write-fold.test.ts index 3f128e5da36..bebd7d0d2ea 100644 --- a/packages/metadata-protocol/src/protocol-authoring-gate.extension-write-fold.test.ts +++ b/packages/metadata-protocol/src/protocol-authoring-gate.extension-write-fold.test.ts @@ -13,7 +13,7 @@ import { describe, expect, it } from 'vitest'; // first load is paid at collection, never inside a case's clock // (`scripts/check-test-source-alias.mjs`). import '@objectstack/lint'; -import { objectExtensionWriteFold, withTargetFoldedWithout } from './protocol-authoring-gate.js'; +import { objectExtensionWriteFold, otherPackagesExtensionsOf, withTargetFoldedWithout } from './protocol-authoring-gate.js'; import { foldObjectExtendersFromRegistry } from './protocol-object-extender-fold.js'; describe('[#33072] objectExtensionWriteFold — which writes narrow the target, and to what', () => { @@ -77,3 +77,30 @@ describe('[#33072] foldObjectExtendersFromRegistry — what each package argumen expect(fold('p1', 'p2')).toEqual([{ onlyExtensionsOf: 'p1', withoutExtensionsOf: 'p2' }]); }); }); + +describe('[#33494] otherPackagesExtensionsOf — the target\'s other packages\' extensions, with their priorities', () => { + const contributors = [ + { ownership: 'own', packageId: 'com.acme.crm', priority: 100, definition: { name: 'crm_account', fields: { name: {} } } }, + { ownership: 'extend', packageId: 'com.acme.low', priority: 150, definition: { name: 'crm_account', fields: { low__c: {} } } }, + { ownership: 'extend', packageId: 'com.acme.crm.custom', priority: 200, definition: { name: 'crm_account', fields: { mine__c: {} } } }, + { ownership: 'extend', packageId: 'com.acme.off', priority: 250, definition: { name: 'crm_account', fields: { off__c: {} } } }, + { ownership: 'extend', packageId: 'com.acme.high', priority: 300, definition: { name: 'crm_account', fields: { s__c: {} } } }, + ]; + const registry = { + getObjectContributors: (fqn: string) => (fqn === 'crm_account' ? contributors : []), + isPackageDisabled: (id?: string) => id === 'com.acme.off', + }; + + it('every other package\'s `extend` contribution, in the registry\'s order, with its priority and fields; the owner, the written package and a disabled package left out', () => { + expect(otherPackagesExtensionsOf(registry, 'crm_account', 'com.acme.crm.custom')).toEqual([ + { extend: 'crm_account', priority: 150, fields: { low__c: {} }, packageId: 'com.acme.low' }, + { extend: 'crm_account', priority: 300, fields: { s__c: {} }, packageId: 'com.acme.high' }, + ]); + }); + + it('a registry that cannot answer (no contributors member, or a throw) states none', () => { + expect(otherPackagesExtensionsOf(undefined, 'crm_account', 'p')).toEqual([]); + expect(otherPackagesExtensionsOf({}, 'crm_account', 'p')).toEqual([]); + expect(otherPackagesExtensionsOf({ getObjectContributors: () => { throw new Error('boom'); } }, 'crm_account', 'p')).toEqual([]); + }); +}); diff --git a/packages/metadata-protocol/src/protocol-authoring-gate.ts b/packages/metadata-protocol/src/protocol-authoring-gate.ts index 04823e11c3c..626d4c88b31 100644 --- a/packages/metadata-protocol/src/protocol-authoring-gate.ts +++ b/packages/metadata-protocol/src/protocol-authoring-gate.ts @@ -56,6 +56,7 @@ import type { PackagedRuleCopyRefusal, RuntimeAuthoringIssue, RuntimeAuthoringVe import { savedItemNameRefusal } from '@objectstack/metadata/view-container-name'; import { PLURAL_TO_SINGULAR, SINGULAR_TO_PLURAL } from '@objectstack/spec/shared'; import type { IObjectQLEngine } from '@objectstack/spec/contracts'; +import type { StoredObjectExtension } from '@objectstack/lint/runtime'; /** * The `ObjectStackProtocolImplementation` members the functions below read — @@ -241,6 +242,56 @@ export function objectExtensionWriteFold( return { options: { withoutExtensionsOf: packageId }, target }; } +/** + * [#33494] The OTHER packages' published extensions of an `object_extension` + * write's target, as the registry holds them: each `extend` contribution + * (`getObjectContributors`) of a package other than `writtenPackage`, with its + * package, its merge priority and its fields, in the registry's own order + * (ascending priority, equal priorities in registration order). A disabled + * package's is left out, as every served fold withholds it + * (`isPackageDisabled`). The target as served carries their fields as plain + * fields with no priority; the gate folds the written entry among these by + * priority instead (`objectsAsServed` in `@objectstack/lint`, the build's own + * fold), so it judges the definition the build judges. `[]` for a registry + * that cannot answer (a metadata-only host, a test double): the write is then + * judged over the target as served, as before. + */ +export function otherPackagesExtensionsOf( + registry: unknown, + target: string, + writtenPackage: string, +): StoredObjectExtension[] { + const reg = registry as { + getObjectContributors?: (fqn: string) => readonly unknown[]; + isPackageDisabled?: (packageId?: string) => boolean; + } | null | undefined; + if (typeof reg?.getObjectContributors !== 'function') return []; + const disabled = (packageId: string | undefined): boolean => + typeof reg.isPackageDisabled === 'function' && reg.isPackageDisabled(packageId) === true; + const out: StoredObjectExtension[] = []; + try { + for (const contributor of reg.getObjectContributors(target)) { + if (contributor === null || typeof contributor !== 'object') continue; + const c = contributor as { ownership?: unknown; packageId?: unknown; priority?: unknown; definition?: unknown }; + if (c.ownership !== 'extend') continue; + const packageId = typeof c.packageId === 'string' ? c.packageId : undefined; + if (packageId === writtenPackage || disabled(packageId)) continue; + const definition = c.definition !== null && typeof c.definition === 'object' + ? c.definition as { fields?: unknown } + : {}; + out.push({ + extend: target, + ...(typeof c.priority === 'number' ? { priority: c.priority } : {}), + fields: definition.fields, + ...(packageId !== undefined ? { packageId } : {}), + }); + } + } catch { + return []; + } + return out; +} + /** * [#33072] `served` with the entry named `target` taken from `withoutWritten` * (the same registry list, folded without the written package's extensions): @@ -562,6 +613,13 @@ export async function judgeRuntimeAuthoringRules( ? packagedRuleCopyRefusalOf(this.engine, evt.name, evt.body) : undefined; + // [#33494] On an `object_extension` write, the target's other packages' + // published extensions with their priorities: the gate folds the written + // entry among them as the build does (see {@link otherPackagesExtensionsOf}). + const storedObjectExtensions = extensionWrite !== undefined + ? otherPackagesExtensionsOf(this.engine.registry, extensionWrite.target, extensionWrite.options.withoutExtensionsOf) + : undefined; + const verdict = evaluateRuntimeAuthoringGate({ type: singular, name: evt.name, @@ -594,6 +652,8 @@ export async function judgeRuntimeAuthoringRules( ...(hierarchyResolverMounted !== undefined ? { hierarchyResolverMounted } : {}), // [#28448] With it the gate refuses a rule copy that changes what the package owns. ...(packagedRuleCopyRefusal !== undefined ? { packagedRuleCopyRefusal } : {}), + // [#33494] With them the extension walk folds the written entry by priority. + ...(storedObjectExtensions !== undefined ? { storedObjectExtensions } : {}), }); return verdict; } diff --git a/packages/metadata-protocol/src/runtime-authoring-gate.ts b/packages/metadata-protocol/src/runtime-authoring-gate.ts index 1e431d562af..0a8e2c4542b 100644 --- a/packages/metadata-protocol/src/runtime-authoring-gate.ts +++ b/packages/metadata-protocol/src/runtime-authoring-gate.ts @@ -52,6 +52,7 @@ import { type AuthoringFinding, type RuntimePackageScope, type RuntimeStackContext, + type StoredObjectExtension, } from '@objectstack/lint/runtime'; // The ONE declaration of "which `config` key on which container node type holds // a nested region" (#4401, `spec/src/automation/region-slots.ts`). Four passes @@ -1423,6 +1424,17 @@ export function evaluateRuntimeAuthoringGate(args: { * language and nothing else: no verdict depends on it. */ userTextLocales?: readonly (string | undefined)[]; + /** + * [#33494] On an `object_extension` write: the target's OTHER packages' + * published extensions, as the registry holds them (package, priority, + * fields; a disabled package's left out). A fact only the host holds, of + * the #6285 kind: gathered by the impure caller and handed to the shared + * rules, whose extension walk folds the written entry among them by + * priority, as `os build` folds every package's entry. Absent, the written + * entry is folded over the target as served, every other package's field + * carried there with no priority. + */ + storedObjectExtensions?: readonly StoredObjectExtension[]; }): RuntimeAuthoringVerdict { const toIssue = issueOf(args.userTextLocales ?? []); // [#26188] The one finding a draft hears: a hierarchy scope this runtime @@ -1496,6 +1508,9 @@ export function evaluateRuntimeAuthoringGate(args: { ...(args.rlsMembershipResolverKeys !== undefined ? { rlsMembershipResolverKeys: args.rlsMembershipResolverKeys } : {}), + ...(args.storedObjectExtensions !== undefined + ? { storedObjectExtensions: args.storedObjectExtensions } + : {}), }); // [#6285] The gate-local refusal, folded into the SAME verdict set as the diff --git a/packages/runtime/src/domains/meta-object-extension-item.test.ts b/packages/runtime/src/domains/meta-object-extension-item.test.ts index e66a171ce47..6800034e727 100644 --- a/packages/runtime/src/domains/meta-object-extension-item.test.ts +++ b/packages/runtime/src/domains/meta-object-extension-item.test.ts @@ -749,6 +749,68 @@ describe('[#33153] the publish door refuses a formula cycle the extension adds, }, 60_000); }); +describe('[#33494] the publish door serves the winner `os build` serves when another package extends the same field', () => { + const formula = (expression: string) => ({ type: 'formula', label: 'F', expression, returnType: 'number' }); + const number = { type: 'number', label: 'Sibling' }; + /** A third package, registered as an extender of the account at the priority given. */ + const SIBLING = 'com.acme.sibling'; + const withSibling = async (fields: Record, priority: number) => { + const rig = await boot(); + rig.engine.registry.registerObjectExtension({ extend: TARGET, priority, fields }, SIBLING); + return rig; + }; + /** `os build`'s cycle findings over the base and both packages' entries, sibling first. */ + const atBuild = (sibling: Record, siblingPriority: number, written: unknown) => { + const stack = { + objects: baseManifest().objects, + packages: [ + { manifest: { objectExtensions: [{ extend: TARGET, priority: siblingPriority, fields: sibling }] } }, + { manifest: { objectExtensions: [written] } }, + ], + }; + return runAuthoringRules('build', { normalized: stack, parsed: stack } as any) + .filter((f) => f.rule === 'expression-invalid' && f.message.includes('reads its own value')) + .map((f) => f.where); + }; + + for (const [label, siblingPriority] of [['a tie (200/200)', 200], ['an outranked entry (sibling 300, written 200)', 300]] as const) { + it(`⭐ LIT — ${label}: the written self-reading formula is not served, so it publishes, as \`os build\` accepts it`, async () => { + const item = { extend: TARGET, priority: 200, fields: { s__c: formula('record.s__c * 2') } }; + expect(atBuild({ s__c: number }, siblingPriority, item)).toEqual([]); + + const rig = await withSibling({ s__c: number }, siblingPriority); + await rig.saveAndPublish(PAIR, item); + expect(await rig.rows()).toEqual([{ name: TARGET, package_id: PAIR, state: 'active' }]); + }, 60_000); + } + + it('⭐ LIT — a higher sibling\'s formula closing a cycle through the entry\'s other field is refused on that field, as `os build` refuses it', async () => { + const sibling = { s__c: formula('record.a__c + 1') }; + const item = { extend: TARGET, priority: 200, fields: { s__c: number, a__c: formula('record.s__c * 2') } }; + const where = "object 'crm_account' · objectExtensions[0] · field 'a__c' expression"; + expect(atBuild(sibling, 300, item)).toContain(where.replace('objectExtensions[0]', 'packages[1].manifest.objectExtensions[0]')); + + const rig = await withSibling(sibling, 300); + await rig.protocol.saveMetaItem({ type: TYPE, name: TARGET, item, mode: 'draft', packageId: PAIR }); + const err: any = await rig.protocol.publishMetaItem({ type: TYPE, name: TARGET, packageId: PAIR }).catch((e: any) => e); + expect(err, 'the publish was admitted').toBeInstanceOf(Error); + expect({ code: err.code, status: err.status }).toEqual({ code: 'INVALID_METADATA', status: 422 }); + const issues = (err.issues ?? []).filter((i: any) => i.rule === 'expression-invalid'); + expect(issues.map((i: any) => i.where), JSON.stringify(err.issues)).toEqual([where]); + expect(await rig.rows()).toEqual([{ name: TARGET, package_id: PAIR, state: 'draft' }]); + }, 60_000); + + it('⭐ CONTROL — an entry that outranks the sibling (written 300 over 200) with a self-reading formula is still refused', async () => { + const item = { extend: TARGET, priority: 300, fields: { s__c: formula('record.s__c * 2') } }; + const rig = await withSibling({ s__c: number }, 200); + await rig.protocol.saveMetaItem({ type: TYPE, name: TARGET, item, mode: 'draft', packageId: PAIR }); + const err: any = await rig.protocol.publishMetaItem({ type: TYPE, name: TARGET, packageId: PAIR }).catch((e: any) => e); + expect({ code: err?.code, status: err?.status }).toEqual({ code: 'INVALID_METADATA', status: 422 }); + expect((err.issues ?? []).filter((i: any) => i.rule === 'expression-invalid').map((i: any) => i.where)) + .toEqual(["object 'crm_account' · objectExtensions[0] · field 's__c' expression"]); + }, 60_000); +}); + describe('[#33217] the publish door judges an extension\'s `format` regex and `json_schema` schema as `os build` does', () => { const ruleBody = (rule: Record) => ({ extend: TARGET, diff --git a/packages/spec/src/migrations/entries/semantic/18.object-extension-formula-cycle-refused.ts b/packages/spec/src/migrations/entries/semantic/18.object-extension-formula-cycle-refused.ts index 27b47e334a5..dbc235b2598 100644 --- a/packages/spec/src/migrations/entries/semantic/18.object-extension-formula-cycle-refused.ts +++ b/packages/spec/src/migrations/entries/semantic/18.object-extension-formula-cycle-refused.ts @@ -13,6 +13,12 @@ import type { SemanticMigration } from '../../types.js'; // adds is refused at its entry. No D2 conversion: which read breaks the cycle // is a fact only the author holds, and a stored row is not re-judged until it // is published again. +// +// #33494: the door folds the written entry among the other packages' published +// extensions of its target by priority (the build's fold), so it judges the +// definition `os build` judges: a tie and an outranked entry are no longer +// refused there, and a higher sibling's definition closing a cycle through +// another field of the written entry is. The text below states that reading. export const entry: SemanticMigration = { id: 'object-extension-formula-cycle-refused', surface: @@ -30,16 +36,18 @@ export const entry: SemanticMigration = { + 'such a cycle among an object\'s declared formulas only, so one an extension adds was accepted and showed only ' + 'when records were read. It is now refused with the verdict and the sentence the object\'s own cycle gets ' + '(`expression-invalid`; at the door `422 INVALID_METADATA`), on each member the extension adds, located at the ' - + 'entry; a member the object declares keeps its location at the object. In `os build` one exception holds on ' - + 'an object the stack declares: a field two packages\' extensions add at the same priority is not judged, since ' - + 'which definition the registry serves is registration order, so a cycle through such a field is not found ' - + 'there (on an object the stack does not declare the later entry\'s definition is judged). The publish door ' - + 'judges the written entry\'s own definition of every field it adds, whatever priority another package\'s ' - + 'extension adds the same field at, so it can refuse a tie, or an entry another package outranks, that `os ' - + 'build` lets through.', + + 'entry; a member the object declares keeps its location at the object. The publish door folds the written ' + + 'entry among the other packages\' published extensions of its target by priority, as `os build` folds every ' + + 'package\'s entry, so both judge the same definition of each field: the written entry\'s where its priority ' + + 'decides the field, another package\'s where that one outranks it (a cycle that definition closes through ' + + 'another field of the written entry is refused on that field). One exception holds on an object the stack ' + + 'declares (at the door, one the deployment serves): a field two packages\' extensions add at the priority that ' + + 'decides it is not judged, since which definition the registry serves is registration order, so a cycle ' + + 'through such a field is not found (on an object the stack does not declare the later entry\'s definition is ' + + 'judged).', acceptanceCriteria: '`os build` reports no `expression-invalid` finding naming a formula cycle at an `objectExtensions` entry, and ' + 'publishing each such extension again answers 200 with no such issue. Each of its formulas reads a computed ' - + 'value on every row, save, in `os build` on a declared object, a cycle through a field two packages add at the ' - + 'same priority, which the build does not judge.', + + 'value on every row, save, on a declared object, a cycle through a field two packages add at the priority that ' + + 'decides it, which neither the build nor the door judges.', };