Skip to content

Commit 6b5895b

Browse files
committed
fix(objectql,cli): carry boot's falsy-key skip into the shared view-container judge; fixtures boot accepts
viewContainerNameRefusal now answers undefined for a container whose derived object key is falsy, the entry registerMetadataCollections warns about and skips before the name check, so os validate cannot refuse what boot skips. Pinned by a control that boot registers nothing and throws nothing. Every CLI test fixture whose views: container carried a name other than its bound object (two red integration pins among them) now names the object, so each is a stack the server loads. The changeset grades @objectstack/objectql minor with Clause-② yes for its two new root exports, and the gate-parity remedy text names VALIDATE_ONLY_GATES. Claude-Session: https://claude.ai/code/session_01UYBdGBzWSrAMzpW8ah3GbP Co-authored-by: Claude <noreply@anthropic.com>
1 parent a6e3662 commit 6b5895b

14 files changed

Lines changed: 93 additions & 31 deletions

‎.changeset/20331-validate-view-container-name.md‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
'@objectstack/cli': patch
3-
'@objectstack/objectql': patch
3+
'@objectstack/objectql': minor
44
---
55

66
fix(cli): `os validate` refuses a `views:` container whose own `name` disagrees with the object it binds to, the stack the server refuses at boot (#20331)
77

8-
Clause-②: no
8+
Clause-②: yes
99

1010
A view container is registered under the object it binds to. When its own `name`
1111
is set to something else, for example `{ name: 'order_line', object: 'my_app_order_line', list: { … } }`,
@@ -21,10 +21,13 @@ unchanged.
2121

2222
**Fix:** remove the container's `name`, or set it to the object name the message names.
2323

24-
`@objectstack/objectql` exports the check as `viewContainerNameRefusal(container, sourceLabel, ownerId)`,
25-
with its type `ViewContainerNameRefusal`. It returns the refusal the boot registrar
26-
throws, or `undefined`. The boot registrar now calls this function. What it refuses,
27-
its message and its `VALIDATION_ERROR` / `400` envelope are unchanged.
24+
**New in `@objectstack/objectql` (the widening):** two new exports on the package's
25+
root entry, `viewContainerNameRefusal(container, sourceLabel, ownerId)` and its
26+
return type `ViewContainerNameRefusal`. The function returns the refusal the boot
27+
registrar throws, or `undefined`. It returns `undefined` for a container whose
28+
derived object key is empty, because the boot registrar skips that entry with a
29+
warning and never refuses it. The boot registrar now calls this function. What it
30+
refuses, its message and its `VALIDATION_ERROR` / `400` envelope are unchanged.
2831

2932
Not changed: `os build` does not run this check, so it still writes an artifact
3033
carrying such a container, and the server refuses that artifact when it loads it.

‎packages/cli/test/build-text-face-advisory-count.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ const ordersObjects = [{
187187
}];
188188
const ordersViews = [
189189
{
190-
name: 'bc_account_list', label: 'Account List', object: 'bc_account',
190+
name: 'bc_account', label: 'Account List', object: 'bc_account',
191191
list: { label: 'Account List', columns: ['name', 'industry'] },
192192
},
193193
{
194-
name: 'bc_order_list', label: 'Order List', object: 'bc_order',
194+
name: 'bc_order', label: 'Order List', object: 'bc_order',
195195
list: { label: 'Order List', columns: ['name', 'account'] },
196196
},
197197
];

‎packages/cli/test/format-zod-union.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const TOOLTIP_ALIAS_STACK = {
185185
manifest: { id: 'com.example.union-probe', name: 'Union Probe', namespace: 'union_probe', version: '1.0.0', type: 'app' },
186186
views: [
187187
{
188-
name: 'union_probe_view',
188+
name: 'union_probe_obj',
189189
object: 'union_probe_obj',
190190
list: {
191191
name: 'union_probe_list',

‎packages/cli/test/info-detail-package-fold.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const OBJECTS = [
9191

9292
const VIEWS = [
9393
{
94-
name: 'ob_order_views',
94+
name: 'ob_order',
9595
object: 'ob_order',
9696
list: {
9797
label: 'Orders',

‎packages/cli/test/lint-handwritten-checks-package-fold.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const definitions = () => ({
103103
],
104104
views: [
105105
{
106-
name: 'probe_view',
106+
name: 'probe_order',
107107
object: 'probe_order',
108108
list: { label: 'order list', columns: ['number'] }, // convention/label-case
109109
},

‎packages/cli/test/lint-label-case-localized.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ const stackWithApp = (label: unknown) => ({
9292

9393
const stackWithListLabel = (label: unknown) => ({
9494
manifest: MANIFEST,
95-
views: [{ name: 'invoice_views', object: 'invoice', list: { label, type: 'grid', columns: ['name'] } }],
95+
views: [{ name: 'invoice', object: 'invoice', list: { label, type: 'grid', columns: ['name'] } }],
9696
});
9797

9898
const stackWithNamedListLabel = (label: unknown) => ({
9999
manifest: MANIFEST,
100100
views: [{
101-
name: 'invoice_views',
101+
name: 'invoice',
102102
object: 'invoice',
103103
listViews: { all: { label, type: 'grid', columns: ['name'] } },
104104
}],

‎packages/cli/test/lint-per-package-authoring-parity.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ const ordersObjects = [{
152152
}];
153153
const ordersViews = [
154154
{
155-
name: 'pp_account_list', label: 'Account List', object: 'pp_account',
155+
name: 'pp_account', label: 'Account List', object: 'pp_account',
156156
list: { label: 'Account List', columns: ['name', 'industry'] },
157157
},
158158
{
159-
name: 'pp_order_list', label: 'Order List', object: 'pp_order',
159+
name: 'pp_order', label: 'Order List', object: 'pp_order',
160160
list: { label: 'Order List', columns: ['name', 'account'] },
161161
},
162162
];

‎packages/cli/test/lint-per-package-authoring-seam.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ function twoPackageArtifact(): Record<string, unknown> {
136136
],
137137
views: [
138138
{
139-
name: 'pp_account_list',
139+
name: 'pp_account',
140140
label: 'Account List',
141141
object: 'pp_account',
142142
list: { label: 'Account List', columns: ['name', 'industry'] },
143143
},
144144
{
145-
name: 'pp_order_list',
145+
name: 'pp_order',
146146
label: 'Order List',
147147
object: 'pp_order',
148148
list: { label: 'Order List', columns: ['name', 'account'] },

‎packages/cli/test/union-fold-command-parity.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,17 @@ const perPackageOnlyStack = (): Record<string, unknown> => {
203203
account: { name: 'account', type: 'lookup', label: 'Account', reference: 'ob_account' },
204204
},
205205
}];
206+
// [#20331] Each container's `name` IS the object it binds to: the boot
207+
// registrar refuses a container whose own `name` disagrees with that key,
208+
// and `os validate` now refuses it too, so a `*_list` name here would make
209+
// this a stack the server cannot load.
206210
const ordersViews = [
207211
{
208-
name: 'ob_account_list', label: 'Account List', object: 'ob_account',
212+
name: 'ob_account', label: 'Account List', object: 'ob_account',
209213
list: { label: 'Account List', columns: ['name', 'industry'] },
210214
},
211215
{
212-
name: 'ob_order_list', label: 'Order List', object: 'ob_order',
216+
name: 'ob_order', label: 'Order List', object: 'ob_order',
213217
list: { label: 'Order List', columns: ['name', 'account'] },
214218
},
215219
];

‎packages/cli/test/validate-build-gate-parity.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,10 @@ describe('os validate is the read-only superset of os build (#3782, #4409)', ()
836836
`${unclassified.join(', ')}.\n` +
837837
`Every call site must land in exactly one ledger. If it is an artifact-level gate, wire it ` +
838838
`into BOTH commands and add it to SHARED_NON_REGISTRY_GATES; if it genuinely cannot run ` +
839-
`read-only, add it to BUILD_ONLY_GATES with a reason; if it is not a gate at all, add it to ` +
840-
`NOT_A_GATE under the reason that says so. Registering it in ` +
841-
`packages/lint/src/authoring-rules.ts instead is better than all three — then all THREE ` +
839+
`read-only, add it to BUILD_ONLY_GATES with a reason; if validate.ts runs it and compile.ts ` +
840+
`deliberately does not, add it to VALIDATE_ONLY_GATES with the reason the build lacks it; if ` +
841+
`it is not a gate at all, add it to NOT_A_GATE under the reason that says so. Registering it in ` +
842+
`packages/lint/src/authoring-rules.ts instead is better than all four — then all THREE ` +
842843
`authoring commands get it and no roster row is needed.`,
843844
).toEqual([]);
844845
});

0 commit comments

Comments
 (0)