Skip to content

Commit 417a139

Browse files
committed
test(ui): count the sharing-rule object picker in the widget registry censuses
Claude-Session: https://claude.ai/code/session_01FEkQ5ntiCZev2cDL6r5VLw Co-authored-by: Claude <noreply@anthropic.com>
1 parent dccc261 commit 417a139

7 files changed

Lines changed: 37 additions & 4 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/fields': patch
3+
'@object-ui/components': patch
4+
'@object-ui/app-shell': patch
5+
'@object-ui/cli': patch
6+
'@objectstack/plugin-sharing': patch
7+
---
8+
9+
feat(console): the sharing-rule object picker lists only the objects a rule can take effect on, business objects first
10+
11+
Clause-②: yes (widening) — `field:shareable-object-ref` joins `@object-ui/fields`' registered widget keys (`RegisteredFieldWidgetType`) and the console's known schema types; nothing is narrowed and no translation key is added.
12+
Metadata-protocol: none
13+
14+
The object field of a new sharing rule listed every registered object, most of them platform `sys_*` objects, including ones a save refuses with `SHARING_NOT_ENABLED` and the credential and session objects. It now lists only what `GET /api/v1/sharing/shareable-objects` answers: the objects a rule saved on would take effect on, business objects first and then platform objects, each group by label, in the order the server sends.
15+
16+
- **The widget (`@object-ui/fields`).** `field:shareable-object-ref` reads the list through the host's authenticated fetch (`SchemaRendererContext.apiFetch`) and stores the object's name, as `object-ref` does, with the same `Label (name)` spelling. A stored name the list does not hold stays on screen as its own option, so editing a rule never drops it. The read-only face is `object-ref`'s.
17+
- **When the list is not served.** A `403` (the caller is not a sharing-rule administrator), a `501` (sharing rules do not run on this deployment), any other failed or unreadable answer, and a host with no authenticated fetch all give the `object-ref` picker over every registered object, as before. The field is never an empty picker; the save doors still decide which object a rule may name.
18+
- **The declaration (`@objectstack/plugin-sharing`).** `sys_sharing_rule.object_name` declares `widget: 'shareable-object-ref'` (was `object-ref`). A console without the widget draws the field as a text box, as with any unregistered widget.
19+
- **The list cell, the record form and the grid.** The new key draws the same object label cell as `object-ref` (`@object-ui/app-shell`), the record form hands it the data source its fallback reads (`@object-ui/components`), and it is not edited inline in a grid cell, like the other widget-hint pickers.

‎ui/examples/schema-catalog/test/form-field-channel-census-12130.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ const DECLARED_BY_12130: Readonly<Record<string, readonly string[]>> = {
368368
// recorder sees. The effects file measures where it lands, type by type.
369369
className: [
370370
'checkboxes', 'currency', 'filter-condition', 'multiselect', 'object-ref', 'password',
371-
'percent', 'radio', 'rating', 'recipient-picker', 'tags',
371+
'percent', 'radio', 'rating', 'recipient-picker', 'shareable-object-ref', 'tags',
372372
],
373373
};
374374

‎ui/packages/fields/src/__tests__/cellRenderers.objectLiteral-8596.test.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ const OBJECT_LITERAL_CENSUS: ReadonlyArray<readonly [type: string, text: string,
297297
// the text cell's face for it, exactly as `text` does.
298298
['object-ref', '[Object]', false],
299299
['recipient-picker', '[Object]', false],
300+
// objectstack#31217: the sharing-rule object picker's key, the same default
301+
// text face as `object-ref`.
302+
['shareable-object-ref', '[Object]', false],
300303
// ── objectstack#27861: the registry-name read faces ─────────────────────
301304
// `{}` names no item, so nothing is asked and both draw the text cell's
302305
// face for it, exactly as `text` does.
@@ -364,6 +367,7 @@ const POPULATED_CENSUS: ReadonlyArray<readonly [type: string, value: unknown]> =
364367
['grid', [[1]]],
365368
['record_pointer_card', { objectName: 'invoice', recordId: 'inv_1' }],
366369
['object-ref', 'crm_account'],
370+
['shareable-object-ref', 'crm_account'],
367371
['recipient-picker', 'sales_manager'],
368372
['position-ref', 'sales_manager'],
369373
['permission-ref', 'admin_full_access'],

‎ui/packages/fields/src/__tests__/widget-aria-invalid-registry-e2e.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ import { GeolocationField } from '../widgets/GeolocationField';
132132
import { SignatureField } from '../widgets/SignatureField';
133133
import { QRCodeField } from '../widgets/QRCodeField';
134134
import { ObjectRefField } from '../widgets/ObjectRefField';
135+
import { ShareableObjectRefField } from '../widgets/ShareableObjectRefField';
135136
import { FilterConditionField } from '../widgets/FilterConditionField';
136137
import { RecipientPickerField } from '../widgets/RecipientPickerField';
137138
import {
@@ -189,6 +190,7 @@ const WIDGETS: Record<string, ComponentType<any>> = {
189190
signature: SignatureField,
190191
qrcode: QRCodeField,
191192
'object-ref': ObjectRefField,
193+
'shareable-object-ref': ShareableObjectRefField,
192194
'filter-condition': FilterConditionField,
193195
'recipient-picker': RecipientPickerField,
194196
'position-ref': PositionRefField,

‎ui/packages/fields/src/__tests__/widget-dom-leak-e2e.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ import { GeolocationField } from '../widgets/GeolocationField';
142142
import { SignatureField } from '../widgets/SignatureField';
143143
import { QRCodeField } from '../widgets/QRCodeField';
144144
import { ObjectRefField } from '../widgets/ObjectRefField';
145+
import { ShareableObjectRefField } from '../widgets/ShareableObjectRefField';
145146
import { FilterConditionField } from '../widgets/FilterConditionField';
146147
import { RecipientPickerField } from '../widgets/RecipientPickerField';
147148
import {
@@ -208,6 +209,7 @@ const WIDGETS: Record<string, ComponentType<any>> = {
208209
signature: SignatureField,
209210
qrcode: QRCodeField,
210211
'object-ref': ObjectRefField,
212+
'shareable-object-ref': ShareableObjectRefField,
211213
'filter-condition': FilterConditionField,
212214
'recipient-picker': RecipientPickerField,
213215
'position-ref': PositionRefField,

‎ui/packages/plugin-detail/src/__tests__/inlineEditTypeCoverage.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ describe('inline-edit type coverage — every type has exactly one decision (#42
238238
// (objectstack#31062).
239239
'permission-ref', 'position-ref',
240240
'recipient-picker', 'record', 'repeater', 'richtext', 'secret',
241+
// objectstack#31217: the sharing-rule object picker, an `object-ref` arm.
242+
'shareable-object-ref',
241243
'summary', 'vector',
242244
],
243245
// `owner` stood between `number` and `percent` until objectui#4814

‎ui/packages/plugin-detail/src/__tests__/summaryChip.badgeFitCensus-8464.test.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ const CENSUS: ReadonlyArray<readonly [type: string, text: string, verdict: Verdi
162162
// cell's face: the coerced name, plain inline text.
163163
['object-ref', 'Acme Corp', 'fit'],
164164
['recipient-picker', 'Acme Corp', 'fit'],
165+
// The sharing-rule object picker's key (objectstack#31217): `object-ref`'s
166+
// default text face, the coerced name.
167+
['shareable-object-ref', 'Acme Corp', 'fit'],
165168
// The registry-name read faces (objectstack#27861): no data source lists a
166169
// registry here, so both draw the coerced name, plain inline text.
167170
['position-ref', 'Acme Corp', 'fit'],
@@ -348,14 +351,15 @@ describe('objectui#8464 — the Badge-fit census: A is not free, and here is whi
348351
}
349352
});
350353

351-
it('THE FIT SIDE IS LOAD-BEARING — the 41 fitting kinds draw text and no artefact', async () => {
354+
it('THE FIT SIDE IS LOAD-BEARING — the 42 fitting kinds draw text and no artefact', async () => {
352355
// Refusing EVERY type also satisfies every refusal assertion above; this is
353356
// the half that is red for it.
354357
const fitting = CENSUS.filter(([, , v]) => v === 'fit');
355358
// 36 → 38: `object-ref` and `recipient-picker` joined the fit side
356359
// (objectui#12613); 38 → 40: `position-ref` and `permission-ref`
357-
// (objectstack#27861); 40 → 41: `filter-condition` (objectstack#30209).
358-
expect(fitting.length, 'the fitting side is not empty').toBe(41);
360+
// (objectstack#27861); 40 → 41: `filter-condition` (objectstack#30209);
361+
// 41 → 42: `shareable-object-ref` (objectstack#31217).
362+
expect(fitting.length, 'the fitting side is not empty').toBe(42);
359363

360364
for (const [type] of fitting) {
361365
const { container } = renderChip(type);

0 commit comments

Comments
 (0)