Skip to content

Commit 367f481

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-a9r6j4
2 parents c9778f0 + fecd2e9 commit 367f481

35 files changed

Lines changed: 1650 additions & 96 deletions
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
fix(console): the Users import wizard maps a manager column, sent to import-users as `manager_id`
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
`POST /api/v1/auth/admin/import-users` already reads a `manager_id` column (the manager's email, or phone number where phone sign-in is on, linked after every row lands), but the Users import wizard offered no such target column, so a file's manager column could not be mapped and never reached the request. The wizard now offers `manager_id`, labelled by the `sys_user` field (`Manager`), and its options panel explains the column (`console.identityImport.managerHint`, in every `@object-ui/i18n` pack). What the endpoint accepts is unchanged.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol): the publish probes skip a widget whose dataset does not exist instead of checking the read's envelope
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The by-name read `getMetaItem` answers an item that does not exist with its envelope, `item` empty, not with `undefined`. The publish probes' reader (`publishedItemReader`) fell back to that envelope when it carried no `item`, so a dashboard widget naming a dataset nothing holds was handed the envelope as its dataset. The widget was counted in `checked.widgets`, and its query ran over a body that binds no object, which could report a false `widget_query_failed` on the publish receipt and in `verify_build`. The reader now answers no body when the envelope carries no `item`, so such a widget takes the dangling-dataset path again: an L1 graph finding, not probed and not counted. A dataset that exists is read exactly as before.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/plugin-list': patch
3+
---
4+
5+
fix(plugin-list): the list toolbar no longer offers the "In a queue" toggle on a view whose own filter pins `owner_id`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The "In a queue" toggle adds `owner_id is_empty` and `queue is_not_empty` to the list's query. On a view whose own filter already requires an owner, such as a "My records" view filtered by `owner_id equals {current_user_id}`, the two conditions contradict each other, so turning the toggle on always showed an empty list. The toggle is now withheld when the view's filter has a top-level AND condition on `owner_id` with `equals` (a non-empty value), `in` (a list of non-empty values) or `is_not_empty`. A condition inside an OR group does not count, because the other members of the group can still match unowned records.
11+
12+
While the toggle is withheld it adds nothing to the query. If it was on when the user switched to such a view, it is turned off, so switching back to a view that offers it shows it off.
13+
14+
Nothing changes on views without an owner condition, and no metadata or server behaviour changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@object-ui/plugin-form': patch
3+
---
4+
5+
feat(plugin-form): a form dialog with no declared `columns` spreads a field-heavy form to three columns, and to four in a `full` dialog
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A record dialog whose form declares no `columns` drew every form two fields per row, however many fields it had. On a wide screen a long business form left most of the dialog empty. The dialog now picks its column count from the number of fields it shows:
11+
12+
- **Up to eight fields:** two per row, as before.
13+
- **Nine or more fields:** three per row, in the standard dialog sizes.
14+
- **Sixteen or more fields in a `full` dialog** (`modalSize: 'full'`): four per row.
15+
16+
The bounded `xl` dialog stops at three because its field area is already wider than the four-column breakpoint. Columns still follow the dialog's real width, so a narrow dialog and a phone show one column. Sections and the object's field groups that declare no `columns` get the same count. Long text, rich text, markdown, html and inline grid fields still take a whole row.
17+
18+
A declared `columns`, including `1`, is drawn as written, on the form and on each section. The dialog's inferred size (`lg` or `xl`) is unchanged. Full-page, tabbed and wizard forms are unchanged: a section with no `columns` still draws two per row there.
19+
20+
If your forms declare `columns: 2` only to keep the old dialog layout, you can remove it to get the wider layout.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/objectql': patch
3+
---
4+
5+
fix(objectql): a read-only secret field keeps its stored value on update
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A field the caller may not write keeps its stored value, whatever its type. This now holds for a `secret` field on both update paths, by id and by predicate (`multi: true`):
11+
12+
- A `secret` field locked by a TRUE `readonlyWhen`, or declared static `readonly`, takes no caller write. The stored reference is unchanged, and no `sys_secret` row is written for the value the caller sent.
13+
- The read-only strip reports the field like any other: `onFieldsDropped` names it (`readonly_when` or `readonly`), and `strictReadonlyWrites` refuses the write with `ERR_READONLY_FIELD_REJECTED`.
14+
- As for any `readonlyWhen` field, `isSystem` does not exempt a caller value on a locked `secret`; a system write still sets a static `readonly` one.
15+
16+
Unchanged: an unlocked `secret` is sealed and stored as a reference, and a value a `beforeUpdate` hook writes on a locked `secret` is kept.

‎content/docs/automation/queues-and-assignment-rules.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ A record **sits in** queue Q when its `owner_id` is empty and its `queue` column
117117

118118
The moment someone claims it, the queue path stops applying: the other members lose access unless another basis grants it. Ask the explain endpoint (`POST /api/v1/security/explain`) why a user sees a record and it reports the queue basis as its own reason (`queue_membership`) — see [Explaining a decision](/docs/permissions/explain).
119119

120-
In the Console, a list of an object that carries the `queue` column has an **In a queue** toggle in its toolbar. It narrows the list to parked records (`owner_id` empty and `queue` set); which of them you see is still the server's read filter, so a member sees what sits in their own queues.
120+
In the Console, a list of an object that carries the `queue` column has an **In a queue** toggle in its toolbar when your organization has at least one queue and the view's own filter does not require `owner_id` to hold a value (a top-level `equals`, `in` or `is_not_empty` condition on it, such as a "my records" view; one inside an OR group does not count), since a parked record has no owner. It narrows the list to parked records (`owner_id` empty and `queue` set); which of them you see is still the server's read filter, so a member sees what sits in their own queues.
121121

122122
## How a claim is spelled
123123

‎packages/metadata-protocol/src/build-probes-dataset-holders.test.ts‎

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ import { describe, expect, it } from 'vitest';
2121
// clocked window (`pnpm check:test-source-alias`).
2222
import '@objectstack/lint';
2323
import { PackageScopedNameRefusedError, type PackageScopedRefusal } from '@objectstack/core';
24+
import { assertEngineFindOnePredicate } from '@objectstack/metadata-core';
2425
import { publishedItemReader, runBuildProbes, type ProbeEngine, type ProbeItemProtocol } from './build-probes.js';
26+
import { ObjectStackProtocolImplementation } from './protocol.js';
27+
import { NO_PACKAGE_SCOPED_READS } from './no-package-scoped-reads.testkit.js';
2528

2629
const ALPHA = 'com.qa.alpha';
2730
const BETA = 'com.qa.beta';
@@ -186,3 +189,116 @@ describe('[#31700] the probes read a widget\'s dataset from the publishing packa
186189
expect(issue!.fix).toContain('would be a cycle, so move the dashboard into that package');
187190
});
188191
});
192+
193+
/**
194+
* [#34560] A widget whose dataset does not exist, read through the REAL
195+
* by-name read: `getMetaItem` answers a missing item with its envelope
196+
* (`{ type, name, item: undefined, lock, editable, … }`), never a throw and
197+
* never `undefined`. The reader the publish uses (`publishedItemReader`, over
198+
* the protocol facade) must hand the probes no body for it, so the widget
199+
* takes the dangling-dataset path (an L1 graph finding, skipped here): it is
200+
* not counted in `checked.widgets`, no dataset query runs, and no
201+
* `widget_query_failed` is reported. The doubles above answer `undefined` for
202+
* a missing item, which is why none of them reached this.
203+
*
204+
* The protocol here is `ObjectStackProtocolImplementation` itself over a
205+
* registry double (the shape `protocol.item-execution-read.test.ts` drives),
206+
* so the envelope is the one the read builds, not a hand-copied one.
207+
*/
208+
describe('[#34560] a missing widget dataset under the real getMetaItem envelope is skipped, not checked', () => {
209+
const APP = 'com.qa.app';
210+
const REGISTRY_ITEMS: Record<string, unknown> = {
211+
'dashboard board': {
212+
name: 'board',
213+
widgets: [
214+
{ id: 'w_missing', dataset: 'missing_ds', values: ['total'] },
215+
{ id: 'w_own', dataset: 'own_ds', values: ['total'] },
216+
],
217+
},
218+
'dataset own_ds': { name: 'own_ds', object: 'task_item', measures: [{ name: 'total', aggregate: 'count' }] },
219+
};
220+
const held = (type: string, name: string): unknown => {
221+
const item = REGISTRY_ITEMS[`${type} ${name}`];
222+
return item === undefined ? undefined : structuredClone(item);
223+
};
224+
225+
function realProtocol() {
226+
const engine: Record<string, unknown> = {
227+
registry: {
228+
...NO_PACKAGE_SCOPED_READS,
229+
// `dataset` is read by package (ADR-0150 D3), as
230+
// `SchemaRegistry` reads it: `own_ds` is held by package APP,
231+
// and `missing_ds` by no one, so its read answers no item.
232+
readsByPackage: (type: string): boolean => type === 'dataset' || NO_PACKAGE_SCOPED_READS.readsByPackage(type),
233+
packageScopedHoldersOf: (type: string, name: string): string[] =>
234+
type === 'dataset' && held(type, name) !== undefined ? [APP] : [],
235+
getPackageScopedItem: (type: string, name: string, packageId: string): unknown =>
236+
packageId === APP ? held(type, name) : undefined,
237+
getItem: (type: string, name: string) => held(type, name),
238+
getObject: () => undefined,
239+
listItems: () => [],
240+
getPackage: () => undefined,
241+
getArtifactItem: () => undefined,
242+
isPackageDisabled: () => false,
243+
isObjectPackageDisabled: () => false,
244+
registerItem: () => undefined,
245+
registerObject: () => undefined,
246+
applyNavContributions: (app: unknown) => app,
247+
},
248+
writeEpoch: { current: 0, bump: () => 1, subscribe: () => () => {} },
249+
registerMiddleware: () => undefined,
250+
find: async () => [],
251+
findOne: async (table: string, q: Record<string, unknown> = {}) => {
252+
assertEngineFindOnePredicate(table, q as never);
253+
return null;
254+
},
255+
};
256+
const services = new Map<string, unknown>();
257+
return new ObjectStackProtocolImplementation(engine as never, () => services as Map<string, never>) as unknown as ProbeItemProtocol;
258+
}
259+
260+
// The publish reads FROM the publishing package (`request.packageId`);
261+
// with no package the dataset is read by name. Both arms of the reader.
262+
for (const publisher of [APP, undefined]) {
263+
const arm = publisher === undefined ? 'read by name' : `read from package ${publisher}`;
264+
265+
it(`${arm}: the real read answers a missing dataset with its envelope, and the reader hands the probes no body`, async () => {
266+
const protocol = realProtocol();
267+
const envelope = (await protocol.getMetaItem({
268+
type: 'dataset', name: 'missing_ds', ...(publisher !== undefined ? { packageId: publisher } : {}),
269+
})) as Record<string, unknown>;
270+
expect(envelope, 'the by-name read answers an envelope, not undefined').toBeTypeOf('object');
271+
expect(envelope).toMatchObject({ type: 'dataset', name: 'missing_ds' });
272+
expect(Object.prototype.hasOwnProperty.call(envelope, 'item')).toBe(true);
273+
expect(envelope.item).toBeUndefined();
274+
expect(await publishedItemReader(protocol, publisher)('dataset', 'missing_ds')).toBeUndefined();
275+
});
276+
277+
it(`${arm}: the widget takes the L1 skip path: not counted, not queried, no widget_query_failed`, async () => {
278+
const queried: unknown[] = [];
279+
const report = await runBuildProbes({
280+
engine,
281+
getItem: publishedItemReader(realProtocol(), publisher),
282+
analytics: {
283+
// Refuses a body that binds no object, as a dataset query
284+
// over nothing can only fail: the shape of the false
285+
// `widget_query_failed` the envelope used to produce.
286+
queryDataset: async (dataset: any) => {
287+
queried.push(dataset?.name);
288+
if (typeof dataset?.object !== 'string') throw new Error('dataset binds no object');
289+
return { rows: [{ total: 1 }] };
290+
},
291+
},
292+
published: [{ type: 'dashboard', name: 'board' }],
293+
});
294+
expect({ checked: report.checked.widgets, codes: report.issues.map((i) => i.code), queried })
295+
.toEqual({ checked: 1, codes: [], queried: ['own_ds'] });
296+
});
297+
298+
it(`${arm}: CONTROL — a dataset the real read finds is handed over as its body`, async () => {
299+
const body = await publishedItemReader(realProtocol(), publisher)('dataset', 'own_ds');
300+
expect(body).toMatchObject({ name: 'own_ds', object: 'task_item' });
301+
expect(body).not.toHaveProperty('item');
302+
});
303+
}
304+
});

‎packages/metadata-protocol/src/build-probes.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,14 @@ export function publishedItemReader(
274274
const address = protocol.resolveCallerPackageAddress({ type, name, callerPackageId: publishingPackageId });
275275
if (address.kind === 'package') packageId = address.packageId;
276276
}
277-
const wrapper = (await protocol.getMetaItem({ type, name, ...(packageId !== undefined ? { packageId } : {}) })) as
277+
const envelope = (await protocol.getMetaItem({ type, name, ...(packageId !== undefined ? { packageId } : {}) })) as
278278
| { item?: unknown }
279279
| undefined;
280-
return wrapper?.item ?? wrapper ?? undefined;
280+
// [#34560] The by-name read answers a missing item with its envelope,
281+
// `item` empty, never `undefined`: the body is the envelope's `item`
282+
// alone, so a dataset nothing holds reads as no body (the widget
283+
// plane's dangling-dataset skip), never as the envelope itself.
284+
return envelope?.item;
281285
};
282286
}
283287

0 commit comments

Comments
 (0)