From 4a009bde663f96703eb8e075ed91845bb6ca0e0e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 22:47:03 +0000 Subject: [PATCH 1/6] fix(console): Studio condition editors list fields by their label ConditionBuilder's labelSubjects now defaults to true, so the hook, action, page-block and generic widget condition mounts name a field subject by its label with its CEL spelling as the hint. A label that only repeats the field name reads as the spelling alone. Claude-Session: https://claude.ai/code/session_01ADHkmRcktQEQx7ViBAPoK5 Co-authored-by: Claude --- .../34122-condition-subjects-label-first.md | 11 ++ ...ConditionWidget.conditionSubjects.test.tsx | 33 ++++++ .../ConditionBuilder.mountScope.test.tsx | 100 +++++++++++++++++- ...ditionBuilder.subjectLabels-27521.test.tsx | 28 ++++- .../inspectors/ConditionBuilder.tsx | 15 ++- 5 files changed, 175 insertions(+), 12 deletions(-) create mode 100644 .changeset/34122-condition-subjects-label-first.md diff --git a/.changeset/34122-condition-subjects-label-first.md b/.changeset/34122-condition-subjects-label-first.md new file mode 100644 index 00000000000..42f70e621c7 --- /dev/null +++ b/.changeset/34122-condition-subjects-label-first.md @@ -0,0 +1,11 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/console': patch +--- + +fix(console): Studio condition editors list fields by their label + +Clause-②: no — field labels shown first; no surface added +Metadata-protocol: none + +The subject list of every Studio condition editor now offers a field by its label, with its CEL path (`record.status`) beside it as secondary text: a hook's "Run only when", an action's "Visible when" and "Disabled when", a page block's "Visible when", and the generic condition field of the metadata forms. The flow Entry condition and the object Validations panel already did. A field with no label, or whose label only repeats its name, still reads as its path. The compiled condition is unchanged. diff --git a/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx index e562508c430..808bd76909b 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx @@ -286,3 +286,36 @@ describe('conditionSubjectsForMetadataType — the per-type derivation (objectui } }); }); + +/* ── Field subjects read by label (objectstack#34122) ────────────────────── */ + +describe('the generic condition mount names a field subject by its label (objectstack#34122)', () => { + /** The bound object's field catalog as the host loads it: one labelled field, one not. */ + const context: WidgetContext = { + objectFields: { + status: 'loaded', + data: [ + { name: 'status', label: 'Status', type: 'text' }, + { name: 'code', type: 'text' }, + ], + }, + }; + + it('a field reads by its label, its spelling as the hint', async () => { + // `ux-conventions.labels-over-machine-names`: the widget passes no + // `labelSubjects`, so this is the builder's default as the mount gets it. + render(); + const group = await screen.findByRole('group', { name: /Run only when/ }); + await userEvent.click(within(group).getAllByRole('combobox')[0]); + const option = await screen.findByRole('option', { name: 'Status record.status' }); + expect(option.querySelector('.font-mono')).toHaveTextContent(/^record\.status$/); + }); + + it('CONTROL: a field with no label reads as its spelling alone', async () => { + render(); + const group = await screen.findByRole('group', { name: /Run only when/ }); + await userEvent.click(within(group).getAllByRole('combobox')[0]); + const option = await screen.findByRole('option', { name: 'record.code' }); + expect(option.querySelector('.font-mono')).toBeNull(); + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.mountScope.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.mountScope.test.tsx index 09f232767eb..f47cb9743c8 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.mountScope.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.mountScope.test.tsx @@ -78,9 +78,19 @@ import '@objectstack/formula'; // the real network. The verdict under test does not depend on the catalog: the // engine reports a bare reference from the SCOPE, not from the field list // (measured with `fields: []` and with `fields: undefined` — identical). -const state = vi.hoisted(() => ({ - metadataClient: { get: vi.fn(async () => undefined), list: vi.fn(async () => [] as unknown[]), withPreviewDrafts() { return this; } }, -})); +// `objects` is empty for every scope case; only the subject-label cases at the +// foot of this file serve an object definition through it. +const state = vi.hoisted(() => { + const objects: Record = {}; + return { + objects, + metadataClient: { + get: vi.fn(async (type: string, name: string) => (type === 'object' ? objects[name] : undefined)), + list: vi.fn(async () => [] as unknown[]), + withPreviewDrafts() { return this; }, + }, + }; +}); vi.mock('../useMetadata', () => ({ useMetadataClient: () => state.metadataClient, })); @@ -379,3 +389,87 @@ describe('mounts that pass no `scope` are byte-for-byte unchanged (objectui#8167 await expectAccepted(box); }); }); + +/* ── Field subjects read by label at every mount (objectstack#34122) ───── */ + +/** + * objectstack#34122 — each mount's subject dropdown names a field by its label, + * with the CEL spelling beside it as the hint + * (`ux-conventions.labels-over-machine-names`). No mount passes + * `labelSubjects`: the builder's default is on, so these cases pin the default + * as every mount receives it. A field with no label reads as its spelling. + */ +describe('every mount names a field subject by its label (objectstack#34122)', () => { + /** `invoice`, as the object-field catalog serves it: one labelled field, one not. */ + const INVOICE = { name: 'invoice', fields: { status: { type: 'text', label: 'Status' }, code: { type: 'text' } } }; + + afterEach(() => { + delete state.objects.invoice; + }); + + /** The builder labelled `label`, with one row added; its subject dropdown opened. */ + function openSubjects(label: string): void { + const root = builderLabelled(label); + fireEvent.click(within(root).getByRole('button', { name: 'Add condition' })); + fireEvent.keyDown(within(root).getAllByRole('combobox')[0], { key: 'ArrowDown' }); + } + + /** The labelled field reads `Status`, its spelling `record.status` the hint. */ + async function expectLabelFirst(): Promise { + const option = await screen.findByRole('option', { name: 'Status record.status' }, { timeout: 4000 }); + expect(option.querySelector('.font-mono')).toHaveTextContent(/^record\.status$/); + } + + /** CONTROL — the unlabelled field reads as its spelling alone, with no hint. */ + async function expectSpellingOnly(): Promise { + const option = await screen.findByRole('option', { name: 'record.code' }, { timeout: 4000 }); + expect(option.querySelector('.font-mono')).toBeNull(); + } + + for (const label of ['Visible when', 'Disabled when'] as const) { + it(`an action's "${label}" reads a field by its label, its spelling as the hint`, async () => { + state.objects.invoice = INVOICE; + render(); + openSubjects(label); + await expectLabelFirst(); + await expectSpellingOnly(); + }); + } + + it("a hook's condition reads a field by its label, its spelling as the hint", async () => { + state.objects.invoice = INVOICE; + render(); + openSubjects('Run only when (optional CEL)'); + await expectLabelFirst(); + await expectSpellingOnly(); + }); + + it("a record page block's Visible when reads a field by its label, its spelling as the hint", async () => { + state.objects.invoice = INVOICE; + const draft = PageSchema.parse({ + name: 'invoice_page', + label: 'Invoice', + type: 'record', + object: 'invoice', + template: 'default', + regions: [{ name: 'main', components: [{ type: 'text', id: 'b1' }] }], + }) as unknown as Record; + render( + {}} + onClearSelection={() => {}} + onSelectionChange={() => {}} + onBlockingIssuesChange={() => {}} + readOnly={false} + locale={'en-US' as never} + />, + ); + openSubjects('Visible when (CEL)'); + await expectLabelFirst(); + await expectSpellingOnly(); + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx index dcd70d1539d..c1fa20b2966 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx @@ -8,9 +8,9 @@ * under the placeholder "field / context", while the list-view filter in the * same product showed labels. A field subject now reads by its label, with the * spelling the CEL uses beside it; the compiled CEL is unchanged. A field with - * no label keeps its spelling, and the context subjects are as before. The - * label is the mount's choice (`labelSubjects`): a mount that lists spellings - * keeps them. + * no label keeps its spelling, and the context subjects are as before. Labels + * are the default (objectstack#34122); a mount that must list spellings passes + * `labelSubjects={false}`. */ import '@testing-library/jest-dom/vitest'; @@ -35,7 +35,7 @@ const FIELDS = [ { name: 'code', type: 'text' }, ]; -function mount(includePrevious = false, labels = true) { +function mount(includePrevious = false, labels: boolean | undefined = true) { const onChange = vi.fn(); render( { + it('a mount that passes no `labelSubjects` reads labels: the default is on (objectstack#34122)', async () => { + mount(false, undefined); + const texts = (await openSubjects()).map((o) => o.textContent); + expect(texts).toContain('Estimated Hoursrecord.estimated_hours'); + expect(texts).toContain('record.code'); + }); + + it('a label that only repeats the field name is no label: the field reads as its spelling (objectstack#34122)', async () => { + // The object-field catalog fills an unlabelled field's label with its name. + render( + , + ); + fireEvent.click(screen.getByRole('button', { name: t('engine.inspector.condition.add', 'en-US') })); + const option = (await openSubjects()).find((o) => o.textContent?.includes('record.code'))!; + expect(option.textContent).toBe('record.code'); + expect(option.querySelector('.font-mono')).toBeNull(); + }); + + it('CONTROL — a mount that opts out of labels lists the spellings', async () => { mount(false, false); const texts = (await openSubjects()).map((o) => o.textContent); expect(texts).toContain('record.estimated_hours'); diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx index 90d12c3fd48..40845f46e22 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx @@ -846,7 +846,7 @@ function initFrom(value: string, valueOf: SubjectValueOf): { rows: Row[]; join: return { rows: [], join: '&&', raw: !!value }; } -export function ConditionBuilder({ label, value, onCommit, objectName, fields: fieldsProp, disabled, onBlockingIssuesChange, subjects, scope, roots, scopeIssue, labelSubjects = false, verdictPath }: { +export function ConditionBuilder({ label, value, onCommit, objectName, fields: fieldsProp, disabled, onBlockingIssuesChange, subjects, scope, roots, scopeIssue, labelSubjects = true, verdictPath }: { label?: string; value: string; onCommit: (cel: string) => void; @@ -934,7 +934,10 @@ export function ConditionBuilder({ label, value, onCommit, objectName, fields: f scopeIssue?: boolean; /** * The subject dropdown names a field by its label, with the CEL spelling - * beside it. Off by default, so a mount that lists spellings keeps them. + * beside it (`ux-conventions.labels-over-machine-names`); a field with no + * label reads as its spelling. On by default, because every mount's subjects + * are the fields of the object it edits. A mount whose spelling must stay + * primary passes `false` and says why at the mount. */ labelSubjects?: boolean; /** @@ -967,7 +970,11 @@ export function ConditionBuilder({ label, value, onCommit, objectName, fields: f // With `labelSubjects`, a field reads by its label, its spelling beside it. const named = (spelling: string, label: string | undefined) => labelSubjects && label ? { value: spelling, label, hint: spelling } : { value: spelling, label: spelling, hint: undefined }; - const fieldOpts = visible.map((f) => named(`${fieldPrefix}${f.name}`, f.label)); + // A label that only repeats the field's name is no label: the object-field + // catalog (`useObjectFields`) fills an unlabelled field's label with its + // name, and such a field reads as its spelling alone. + const labelOf = (f: { name: string; label?: string }) => (f.label && f.label !== f.name ? f.label : undefined); + const fieldOpts = visible.map((f) => named(`${fieldPrefix}${f.name}`, labelOf(f))); // The whole-record `previous` comes first: `previous == null` is how an // author branches on the create leg of a create-or-update trigger, and it // reads as the head of the group rather than as one more field. @@ -977,7 +984,7 @@ export function ConditionBuilder({ label, value, onCommit, objectName, fields: f ...visible.map((f) => named( `previous.${f.name}`, - f.label ? tFormat('engine.inspector.condition.previousField', locale, { field: f.label }) : undefined, + labelOf(f) ? tFormat('engine.inspector.condition.previousField', locale, { field: labelOf(f) }) : undefined, ), ), ] From c31d3c85d1d116f0fd217239dcdd0614b37f5053 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 00:28:11 +0000 Subject: [PATCH 2/6] test(console): existing condition pins find a field subject by its label-first name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The subject dropdown now names a field by its label with the CEL spelling as the hint, so the pins that found or listed options by bare spelling read the spelling from the hint, or find the option by its label-first accessible name. The changeset carries the claim's Clause-② line verbatim. Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY Co-authored-by: Claude --- .../34122-condition-subjects-label-first.md | 2 +- .../ConditionBuilder.contextSubjects.test.tsx | 4 +++- .../ConditionBuilder.nullGuard-27513.test.tsx | 2 +- .../ConditionBuilder.subjectVocabulary.test.tsx | 16 +++++++++++++--- ...ConditionBuilder.typedEmptyOps-11894.test.tsx | 2 +- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.changeset/34122-condition-subjects-label-first.md b/.changeset/34122-condition-subjects-label-first.md index 42f70e621c7..c4cb4365d76 100644 --- a/.changeset/34122-condition-subjects-label-first.md +++ b/.changeset/34122-condition-subjects-label-first.md @@ -5,7 +5,7 @@ fix(console): Studio condition editors list fields by their label -Clause-②: no — field labels shown first; no surface added +Clause-②: no (`@object-ui/app-shell` is `"private": true`; flipping the `labelSubjects` default reaches no published export) Metadata-protocol: none The subject list of every Studio condition editor now offers a field by its label, with its CEL path (`record.status`) beside it as secondary text: a hook's "Run only when", an action's "Visible when" and "Disabled when", a page block's "Visible when", and the generic condition field of the metadata forms. The flow Entry condition and the object Validations panel already did. A field with no label, or whose label only repeats its name, still reads as its path. The compiled condition is unchanged. diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.contextSubjects.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.contextSubjects.test.tsx index 69236ea8cb1..25ae3804c3c 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.contextSubjects.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.contextSubjects.test.tsx @@ -94,7 +94,9 @@ async function defaultSubjects(): Promise { />, ); await userEvent.click(container.querySelectorAll('[role="combobox"]')[0] as HTMLElement); - return (await screen.findAllByRole('option')).map((o) => o.textContent ?? ''); + // A field subject reads by its label, its spelling the `.font-mono` hint + // (objectstack#34122); read the spelling, which is what the engine judges. + return (await screen.findAllByRole('option')).map((o) => (o.querySelector('.font-mono') ?? o).textContent ?? ''); } /** The CONTEXT half of the default vocabulary — what is not a catalog field. */ diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.nullGuard-27513.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.nullGuard-27513.test.tsx index 8a0b9acf8b7..dffa42caa38 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.nullGuard-27513.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.nullGuard-27513.test.tsx @@ -102,7 +102,7 @@ describe('an ordering comparison on a field compiles behind a null guard (object it('the card flow — Add condition, the optional number, greater than, 40 — writes the guarded shape', async () => { const { container } = render(); fireEvent.click(screen.getByRole('button', { name: /Add condition/ })); - await pick(comboboxes(container)[0], 'record.estimated_hours'); + await pick(comboboxes(container)[0], 'Estimated Hours record.estimated_hours'); await pick(comboboxes(container)[1], 'greater than'); fireEvent.change(screen.getByPlaceholderText('value'), { target: { value: '40' } }); diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectVocabulary.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectVocabulary.test.tsx index 29a55fa3005..c1751414f55 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectVocabulary.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectVocabulary.test.tsx @@ -212,12 +212,22 @@ beforeAll(() => { } }); -/** Open the row's SUBJECT dropdown and read back every subject it offers. */ +/** + * An option's CEL spelling. A field subject reads by its label with the + * spelling beside it as the hint (objectstack#34122), so the spelling is that + * hint; a subject with no label (`previous`, the context) is its spelling. + */ +function spellingOf(option: HTMLElement): string { + const hint = option.querySelector('.font-mono'); + return (hint ?? option).textContent ?? ''; +} + +/** Open the row's SUBJECT dropdown and read back the spelling of every subject it offers. */ async function subjectOptions(container: HTMLElement): Promise { const trigger = container.querySelectorAll('[role="combobox"]')[0] as HTMLElement; await userEvent.click(trigger); const opts = await screen.findAllByRole('option'); - return opts.map((o) => o.textContent ?? ''); + return opts.map(spellingOf); } /** A mounted builder holding exactly one row, ready to have its subject read. */ @@ -283,7 +293,7 @@ describe('#6296 DEFAULT-PATH INVARIANCE — the record-scoped consumers are unto const { container, onCommit } = mountOneRow(); const opts = await subjectOptions(container); expect(opts).toContain('record.amount'); - await userEvent.click(screen.getByRole('option', { name: 'record.amount' })); + await userEvent.click(screen.getByRole('option', { name: 'Amount record.amount' })); expect(onCommit).toHaveBeenCalledWith("record.amount == 'x'"); }); diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.typedEmptyOps-11894.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.typedEmptyOps-11894.test.tsx index 79e46485743..fde35ba7844 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.typedEmptyOps-11894.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.typedEmptyOps-11894.test.tsx @@ -294,7 +294,7 @@ describe('a new row starts on a typed operator, not `truthy`', () => { fireEvent.click(screen.getByText('Add condition')); expect(lastOpTrigger(container).textContent).toBe('equals'); await userEvent.click(comboboxes(container)[0]); - await userEvent.click(await screen.findByRole('option', { name: 'record.due_date' })); + await userEvent.click(await screen.findByRole('option', { name: 'Due date record.due_date' })); const cel = committed(); expect(cel).toBe("record.due_date == ''"); expect(evaluate(cel, { due_date: null })).toEqual({ ok: true, value: false }); From 5ea462073c56c6c4ed7f3be2083777b883ac1676 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 00:29:59 +0000 Subject: [PATCH 3/6] test(console): the default-on pin renders the builder without labelSubjects Handing the file's mount helper an undefined took the helper's own default and passed true explicitly, so the builder's default was never read: the pin stayed green with the default flipped back off. Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY Co-authored-by: Claude --- .../ConditionBuilder.subjectLabels-27521.test.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx index c1fa20b2966..fb00db8003c 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx @@ -35,7 +35,7 @@ const FIELDS = [ { name: 'code', type: 'text' }, ]; -function mount(includePrevious = false, labels: boolean | undefined = true) { +function mount(includePrevious = false, labels = true) { const onChange = vi.fn(); render( { - mount(false, undefined); + // Rendered here rather than through `mount`: handing `mount` an + // `undefined` would take ITS default (`true`) and pass that explicitly, + // so the builder's own default would never be read. + render(); + fireEvent.click(screen.getByRole('button', { name: t('engine.inspector.condition.add', 'en-US') })); const texts = (await openSubjects()).map((o) => o.textContent); expect(texts).toContain('Estimated Hoursrecord.estimated_hours'); expect(texts).toContain('record.code'); From 060a33c371e476b53d1d2ce337ffc3605286ff0c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 01:00:56 +0000 Subject: [PATCH 4/6] test(console): edited condition pins pay their dynamic-import loads at collection Each test file this change edits reaches a dynamic import of @objectstack/lint, @objectstack/formula or @object-ui/core through the builder; a module-top side-effect import pays that load during collection, as check:test-source-alias asks of every edited file. Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY Co-authored-by: Claude --- .../ConditionWidget.conditionSubjects.test.tsx | 4 ++++ .../inspectors/ConditionBuilder.contextSubjects.test.tsx | 4 ++++ .../inspectors/ConditionBuilder.mountScope.test.tsx | 4 ++++ .../inspectors/ConditionBuilder.nullGuard-27513.test.tsx | 4 ++++ .../ConditionBuilder.subjectLabels-27521.test.tsx | 6 ++++++ .../inspectors/ConditionBuilder.subjectVocabulary.test.tsx | 6 ++++++ .../ConditionBuilder.typedEmptyOps-11894.test.tsx | 5 +++++ 7 files changed, 33 insertions(+) diff --git a/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx index 808bd76909b..e5a908497aa 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx @@ -44,6 +44,10 @@ * ever reaches the mounts that legitimately bind `user`. */ +// The builder reaches a dynamic `import()` of each module below: its first load +// is paid here, at collection, never inside a case's clocked window +// (`check:test-source-alias`). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { describe, it, expect, vi, afterEach } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.contextSubjects.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.contextSubjects.test.tsx index 25ae3804c3c..a20420caef3 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.contextSubjects.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.contextSubjects.test.tsx @@ -50,6 +50,10 @@ * `CONTEXT_SUBJECTS`. An over-narrowing reddens here rather than shipping. */ +// The builder reaches a dynamic `import()` of each module below: its first load +// is paid here, at collection, never inside a case's clocked window +// (`check:test-source-alias`). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { describe, it, expect, vi, afterEach } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.mountScope.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.mountScope.test.tsx index f47cb9743c8..8ac1a0f2358 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.mountScope.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.mountScope.test.tsx @@ -60,6 +60,10 @@ * disabled by a predicate the spec prescribes. */ +// The builder reaches a dynamic `import()` of each module below: its first load +// is paid here, at collection, never inside a case's clocked window +// (`check:test-source-alias`). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { describe, it, expect, vi, afterEach } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.nullGuard-27513.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.nullGuard-27513.test.tsx index dffa42caa38..0f9597b8526 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.nullGuard-27513.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.nullGuard-27513.test.tsx @@ -20,6 +20,10 @@ * ordering comparison on a catalog field. */ +// The builder reaches a dynamic `import()` of each module below: its first load +// is paid here, at collection, never inside a case's clocked window +// (`check:test-source-alias`). +import '@object-ui/core'; import * as React from 'react'; import { describe, it, expect, afterEach, beforeAll, vi } from 'vitest'; import { render, screen, cleanup, fireEvent } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx index fb00db8003c..aa9365f4d91 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectLabels-27521.test.tsx @@ -13,6 +13,12 @@ * `labelSubjects={false}`. */ +// The builder reaches a dynamic `import()` of each module below: its first load +// is paid here, at collection, never inside a case's clocked window +// (`check:test-source-alias`). +import '@objectstack/formula'; +import '@objectstack/lint'; +import '@object-ui/core'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { describe, it, expect, afterEach, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectVocabulary.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectVocabulary.test.tsx index c1751414f55..876c76da480 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectVocabulary.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.subjectVocabulary.test.tsx @@ -43,6 +43,12 @@ * `Builder` toggle would be on screen. */ +// The builder reaches a dynamic `import()` of each module below: its first load +// is paid here, at collection, never inside a case's clocked window +// (`check:test-source-alias`). +import '@objectstack/formula'; +import '@objectstack/lint'; +import '@object-ui/core'; import * as React from 'react'; import { describe, it, expect, afterEach, beforeAll, vi } from 'vitest'; import { render, cleanup, screen, fireEvent } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.typedEmptyOps-11894.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.typedEmptyOps-11894.test.tsx index fde35ba7844..fae60a0d5f2 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.typedEmptyOps-11894.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.typedEmptyOps-11894.test.tsx @@ -17,6 +17,11 @@ * ill typed, not only if its spelling moves. */ +// The builder reaches a dynamic `import()` of each module below: its first load +// is paid here, at collection, never inside a case's clocked window +// (`check:test-source-alias`). +import '@objectstack/lint'; +import '@object-ui/core'; import * as React from 'react'; import { describe, it, expect, afterEach, beforeAll, vi } from 'vitest'; import { render, screen, cleanup, fireEvent, waitFor } from '@testing-library/react'; From e8de7f08968b6a0173dc8a22608ce97faa75febc Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 01:12:47 +0000 Subject: [PATCH 5/6] fix(console): the previous-value subject label type-checks under the name-only rule labelOf returns string | undefined, so reading it twice left tFormat's argument typed as possibly undefined; read it once into a local. Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY Co-authored-by: Claude --- .../metadata-admin/inspectors/ConditionBuilder.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx index 40845f46e22..918ea2ff6d3 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx @@ -981,12 +981,13 @@ export function ConditionBuilder({ label, value, onCommit, objectName, fields: f const previousOpts = includePrevious ? [ { value: 'previous', label: 'previous', hint: undefined }, - ...visible.map((f) => - named( + ...visible.map((f) => { + const label = labelOf(f); + return named( `previous.${f.name}`, - labelOf(f) ? tFormat('engine.inspector.condition.previousField', locale, { field: labelOf(f) }) : undefined, - ), - ), + label ? tFormat('engine.inspector.condition.previousField', locale, { field: label }) : undefined, + ); + }), ] : []; const contextOpts = contextSubjects.map((c) => ({ value: c.value, label: c.label ?? c.value, hint: undefined })); From b6d441814b1939061eb5bc252387de0bcd70dc81 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 01:15:07 +0000 Subject: [PATCH 6/6] test(console): the generic-mount label pin hands the widget a complete context WidgetContext requires conditionScope; the pin declares the record scope a record-scoped host hands down, so the test program type-checks. Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY Co-authored-by: Claude --- .../metadata-admin/ConditionWidget.conditionSubjects.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx index e5a908497aa..53e134f9c6b 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ConditionWidget.conditionSubjects.test.tsx @@ -296,6 +296,7 @@ describe('conditionSubjectsForMetadataType — the per-type derivation (objectui describe('the generic condition mount names a field subject by its label (objectstack#34122)', () => { /** The bound object's field catalog as the host loads it: one labelled field, one not. */ const context: WidgetContext = { + conditionScope: 'record', objectFields: { status: 'loaded', data: [