Skip to content

Commit 88f1d55

Browse files
committed
fix(ui): read the Export verdict through isObjectExportOffered in @object-ui/core
The three Export entries (ObjectGrid, ListView, the dataset report's ReportExportControl) called resolveEffectiveCrudAffordances themselves, which the affordance-to-grant census refuses outside its home modules. The verdict now lives in managedBy.ts as isObjectExportOffered, beside isObjectInlineEditable, and each entry reads it. Behaviour is unchanged: the resolved exportCsv bit, ANDed with the effective `export` operation. Export is a read, so it gets no AFFORDANCE_GRANTS row: can(object, 'export') answers allowRead in MePermissionsProvider, and the caller's allowExport already reaches the client through the effective `export` operation, which the server derives from list and allowExport. The helper is a new name on @object-ui/core's published entry, so the changeset grades core minor and declares Clause-② yes. Docs, READMEs and the liveness evidence name the helper. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxUmEWpcN3eh4vH1WY
1 parent 4443783 commit 88f1d55

12 files changed

Lines changed: 118 additions & 23 deletions

File tree

‎.changeset/35619-user-actions-export-csv-enforced.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
'@objectstack/spec': minor
3+
'@object-ui/core': minor
34
'@object-ui/plugin-grid': minor
45
'@object-ui/plugin-list': minor
56
'@object-ui/plugin-report': minor
@@ -8,7 +9,7 @@
89

910
feat: an object's `userActions.exportCsv: false` hides the console's Export entry
1011

11-
Clause-②: no
12+
Clause-②: yes
1213
Metadata-protocol: semantic
1314

1415
`userActions.exportCsv` on an object now does what the Studio object form says it does. Set to `false`, the console offers no Export entry for that object's records, in any format:
@@ -17,7 +18,7 @@ Metadata-protocol: semantic
1718
- the list view hides Export in both toolbar forms, the wide toolbar's button and the Display panel's export footer;
1819
- a dataset report hides its Export control when the dataset's base object sets it.
1920

20-
Every surface reads one verdict, `resolveEffectiveCrudAffordances(objectSchema, effectiveApiOperations).exportCsv` from `@object-ui/core`: the authored `exportCsv` over the object's `managedBy` default, ANDed with the caller's effective `export` API operation. Before this change the surfaces read only the effective operation, so `exportCsv: false` changed nothing.
21+
Every surface reads one verdict, the new `isObjectExportOffered(objectSchema, effectiveApiOperations)` from `@object-ui/core`: the authored `exportCsv` over the object's `managedBy` default, ANDed with the caller's effective `export` API operation. Before this change the surfaces read only the effective operation, so `exportCsv: false` changed nothing. Export is a read, so the verdict is not a row of `AFFORDANCE_GRANTS` and asks no `can(object, verb)`: the caller's export grant reaches the console through the effective `export` operation, which the server derives from `list` and `allowExport`.
2122

2223
Nothing changes for an object that does not author the key: every `managedBy` bucket still defaults `exportCsv` to `true` (ADR-0103), so its Export entry stays. The setting hides the entry and is not a permission: no export request is refused because of it, and who may export is still the permission set's `allowExport`. The report reads the base object's definition through the report's data source, and a report whose source cannot serve one keeps its Export control.
2324

‎content/docs/frontend/plugins/plugin-list.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ The list's Export entry (the wide toolbar's button and the Display panel's
7878
footer) follows the object as well as the view. An object that sets
7979
`userActions.exportCsv: false` gets no Export entry, in any format; the object
8080
grid and a dataset report on that object hide theirs too. All three read one
81-
verdict, `resolveEffectiveCrudAffordances(objectDef, effectiveApiOperations).exportCsv`
82-
from `@object-ui/core`: the authored switch over the object's `managedBy`
81+
verdict, `isObjectExportOffered(objectDef, effectiveApiOperations)` from
82+
`@object-ui/core`: the authored switch over the object's `managedBy`
8383
default, ANDed with the caller's effective `export` API operation. Unset, the
8484
switch is on in every bucket. It hides the entry and is not a permission: who
8585
may export is the permission set's `allowExport`.

‎packages/spec/liveness/object.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
"status": "live",
246246
"verifiedAt": "2026-11-19",
247247
"evidence": "packages/spec/src/data/object.zod.ts#resolveCrudAffordances (collapses `obj.userActions` onto the managedBy bucket's default row, the one resolution of the five CRUD entries); ui/packages/core/src/utils/managedBy.ts#resolveEffectiveCrudAffordances (hands the object's `userActions` to it and intersects the answer with the server's effective API operations)",
248-
"note": "Drilled 2026-11-19 when `transfer` (the Change Owner switch, ruling 7000907189 point 1, card #35401) landed beside the five CRUD entries with a different verdict: the container used to carry one blanket `live` (\"objectui ObjectGrid per-object CRUD.\") and was recorded in undrilled-containers.baseline.json, so its children had no verdict of their own. Each child below is graded by its own reader, measured at this tree: create/import/edit/delete read through resolveCrudAffordances by the server write guard, the apiMethods reconciliation, the /me/permissions clamp and the console's affordance rows; exportCsv by the console's export entries through resolveEffectiveCrudAffordances (see its row; it was graded dead on 2026-11-19 and flipped live on 2026-11-21 when those entries were wired, #35619); transfer by nothing yet (planned).",
248+
"note": "Drilled 2026-11-19 when `transfer` (the Change Owner switch, ruling 7000907189 point 1, card #35401) landed beside the five CRUD entries with a different verdict: the container used to carry one blanket `live` (\"objectui ObjectGrid per-object CRUD.\") and was recorded in undrilled-containers.baseline.json, so its children had no verdict of their own. Each child below is graded by its own reader, measured at this tree: create/import/edit/delete read through resolveCrudAffordances by the server write guard, the apiMethods reconciliation, the /me/permissions clamp and the console's affordance rows; exportCsv by the console's export entries through isObjectExportOffered (see its row; it was graded dead on 2026-11-19 and flipped live on 2026-11-21 when those entries were wired, #35619); transfer by nothing yet (planned).",
249249
"children": {
250250
"create": {
251251
"status": "live",
@@ -271,7 +271,7 @@
271271
"status": "live",
272272
"verifiedAt": "2026-11-21",
273273
"evidenceScope": "in-repo",
274-
"evidence": "ui/packages/core/src/utils/managedBy.ts#resolveEffectiveCrudAffordances (hands the object's `userActions` to resolveCrudAffordances and ANDs the resolved `exportCsv` with the effective `export` API operation: the one export verdict every entry below reads); ui/packages/plugin-grid/src/ObjectGrid.tsx#ObjectGrid (`objectExportOffered`: the toolbar Export menu, its handler and the table's own CSV button); ui/packages/plugin-list/src/ListView.tsx#ListView (`exportPermitted`: the wide toolbar's Export, the Display panel's export footer and the export handler); ui/packages/plugin-report/src/ReportExport.tsx#ReportExportControl (the dataset report's Export, on the query answer's base object, whose definition it reads through the report's data source)",
274+
"evidence": "ui/packages/core/src/utils/managedBy.ts#isObjectExportOffered (the resolved `exportCsv` bit, through resolveEffectiveCrudAffordances, which hands the object's `userActions` to resolveCrudAffordances and ANDs the bit with the effective `export` API operation: the one export verdict every entry below reads); ui/packages/plugin-grid/src/ObjectGrid.tsx#ObjectGrid (`objectExportOffered`: the toolbar Export menu, its handler and the table's own CSV button); ui/packages/plugin-list/src/ListView.tsx#ListView (`exportPermitted`: the wide toolbar's Export, the Display panel's export footer and the export handler); ui/packages/plugin-report/src/ReportExport.tsx#ReportExportControl (the dataset report's Export, on the query answer's base object, whose definition it reads through the report's data source)",
275275
"note": "Flipped dead → live 2026-11-21 (#35619, ruling 7035537883: enforce). `exportCsv: false` hides the whole export entry, every format, matching the `exportCsv → export` operation mapping in resolveEffectiveCrudAffordances; the bucket defaults (ADR-0103, `exportCsv: true` in every bucket) are unchanged, so an object that does not author the key keeps its entry. It is a console affordance, not a permission: no server door reads it (plugin-security's WRITE_OP_AFFORDANCE, the spec's MANAGED_WRITE_VERB_AFFORDANCE and core's clampManagedObjectWrites map only create/edit/delete), and who may export stays the permission set's allowExport through the effective `export` operation. RelatedList (ui/packages/plugin-detail/src/RelatedList.tsx) offers no export entry at this tree: its table is drawn with `exportable: false`, its enlarged grid carries no `exportOptions`, and its toolbar has no export control, so there is nothing there to gate. Pinned per surface by the `*-35619` render tests beside each reader, each with a CONTROL that the default still shows the entry."
276276
},
277277
"transfer": {

‎ui/packages/core/README.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,29 @@ sites it found with no row yet formed a frozen backlog, which the pin now holds
248248
empty: a new one cannot be added, so a write affordance gets its row when it
249249
lands.
250250

251+
### The Export verdict (`isObjectExportOffered`)
252+
253+
Every Export entry on an object's records (a grid's Export menu and its table's
254+
own CSV button, a list view's Export, a dataset report's Export control) reads
255+
one verdict, `isObjectExportOffered(objectSchema, effectiveApiOperations)`. It
256+
is the resolved `exportCsv` bit: the object's `userActions.exportCsv` over its
257+
`managedBy` default, ANDed with the server's effective `export` operation when a
258+
set is handed down. Every bucket defaults the bit on, so an object closes its
259+
Export entry, in every format, only by setting `userActions.exportCsv: false`.
260+
261+
Export is a read, not a write, so it has no row in `AFFORDANCE_GRANTS` and asks
262+
no `can(object, verb)`. The caller's export grant, the permission set's
263+
`allowExport`, reaches the client through the effective `export` operation,
264+
which the server derives from `list` and that grant.
265+
266+
```typescript
267+
import { isObjectExportOffered } from '@object-ui/core'
268+
269+
isObjectExportOffered({ managedBy: 'append-only' }) // true
270+
isObjectExportOffered({ userActions: { exportCsv: false } }) // false
271+
isObjectExportOffered({ managedBy: 'platform' }, ['get', 'list']) // false: no `export` served
272+
```
273+
251274
### Undo snapshot for an update (`captureUpdateUndoData`)
252275

253276
An `undoable` update restores exactly the fields it wrote, from their values

‎ui/packages/core/src/utils/managedBy.test.ts‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
isWriteOptedIn,
66
isSystemWritable,
77
isObjectInlineEditable,
8+
isObjectExportOffered,
89
normalizeUserAction,
910
userActionPredicates,
1011
type UserActionsOverride,
@@ -234,6 +235,47 @@ describe('isObjectInlineEditable — effective API operations (#3546)', () => {
234235
});
235236
});
236237

238+
describe('isObjectExportOffered — the one export verdict (objectstack#35619)', () => {
239+
it('an object that does not author exportCsv offers export in every bucket', () => {
240+
for (const managedBy of MANAGED_BY_BUCKETS) {
241+
expect(isObjectExportOffered({ managedBy }), managedBy).toBe(true);
242+
}
243+
expect(isObjectExportOffered(null)).toBe(true);
244+
expect(isObjectExportOffered(undefined)).toBe(true);
245+
});
246+
247+
it('exportCsv false closes it, in every bucket; exportCsv true keeps it open', () => {
248+
for (const managedBy of MANAGED_BY_BUCKETS) {
249+
expect(isObjectExportOffered({ managedBy, userActions: { exportCsv: false } }), managedBy).toBe(false);
250+
expect(isObjectExportOffered({ managedBy, userActions: { exportCsv: true } }), managedBy).toBe(true);
251+
}
252+
});
253+
254+
it('a closing userActions on another verb leaves it open', () => {
255+
expect(isObjectExportOffered({ managedBy: 'platform', userActions: { edit: false, delete: false, create: false } })).toBe(true);
256+
});
257+
258+
it('an effective set without `export` closes it; one with `export` keeps the bit as authored', () => {
259+
expect(isObjectExportOffered({ managedBy: 'platform' }, ['get', 'list'])).toBe(false);
260+
expect(isObjectExportOffered({ managedBy: 'platform' }, [])).toBe(false);
261+
expect(isObjectExportOffered({ managedBy: 'platform' }, ['list', 'export'])).toBe(true);
262+
// The set never re-opens what the object closed.
263+
expect(isObjectExportOffered({ managedBy: 'platform', userActions: { exportCsv: false } }, ['list', 'export'])).toBe(false);
264+
});
265+
266+
it('is the resolved exportCsv bit, for every bucket, authored value and effective set', () => {
267+
const sets: Array<readonly string[] | undefined> = [undefined, [], ['list'], ['list', 'export']];
268+
for (const managedBy of MANAGED_BY_BUCKETS) {
269+
for (const exportCsv of [undefined, true, false]) {
270+
const obj = exportCsv === undefined ? { managedBy } : { managedBy, userActions: { exportCsv } };
271+
for (const ops of sets) {
272+
expect(isObjectExportOffered(obj, ops)).toBe(resolveEffectiveCrudAffordances(obj, ops).exportCsv);
273+
}
274+
}
275+
}
276+
});
277+
});
278+
237279
/**
238280
* [#5142] The `import` half of the toolbar-scope predicate pair.
239281
*

‎ui/packages/core/src/utils/managedBy.ts‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,35 @@ export function resolveEffectiveCrudAffordances(
202202
return out;
203203
}
204204

205+
/**
206+
* Whether the console offers an object's Export entry: every format, on its
207+
* grids, list views and dataset reports (objectstack#35619). Every Export entry
208+
* reads this one verdict.
209+
*
210+
* It is the resolved `exportCsv` bit: the object's `userActions.exportCsv` over
211+
* its `managedBy` default (ADR-0103 offers export in every bucket, so `false`
212+
* is the only way to close it), ANDed with the server's effective `export`
213+
* operation when a set is handed down.
214+
*
215+
* Export is a read, not a write, so it has no row in `AFFORDANCE_GRANTS` and
216+
* asks no `can(object, verb)`. The caller's export grant, the permission set's
217+
* opt-in `allowExport`, reaches the client through the effective `export`
218+
* operation, which the server derives from `list` ∧ `allowExport`. A
219+
* `can(object, 'export')` question would read `allowRead` instead. The setting
220+
* hides an entry and refuses no export request.
221+
*
222+
* @param effectiveApiOperations OPTIONAL server-resolved effective API operation
223+
* set for this object (`/me/permissions` `apiOperations`, objectstack#3391).
224+
* `undefined` (old backend / unrestricted object / no provider) leaves the
225+
* object's own bit as the verdict.
226+
*/
227+
export function isObjectExportOffered(
228+
obj: SchemaLike | null | undefined,
229+
effectiveApiOperations?: readonly string[] | null,
230+
): boolean {
231+
return resolveEffectiveCrudAffordances(obj, effectiveApiOperations).exportCsv;
232+
}
233+
205234
/** True only when a `userActions` flag (bare boolean or #2614 object form) opts the write in. */
206235
export function isWriteOptedIn(v: UserActionOverride | undefined | null): boolean {
207236
return v === true || (typeof v === 'object' && v !== null && v.enabled === true);

‎ui/packages/plugin-grid/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,8 +1132,8 @@ const persistence = (
11321132
The toolbar's Export menu (offered when the schema declares `exportOptions`) and
11331133
the table's own CSV button (`operations.export: true`) are both offered only
11341134
while the object's resolved export verdict is open:
1135-
`resolveEffectiveCrudAffordances(objectSchema, effectiveApiOperations).exportCsv`
1136-
from `@object-ui/core`, which is the object's `userActions.exportCsv` over its
1135+
`isObjectExportOffered(objectSchema, effectiveApiOperations)` from
1136+
`@object-ui/core`, which is the object's `userActions.exportCsv` over its
11371137
`managedBy` default, ANDed with the caller's effective `export` API operation.
11381138
An object that sets `userActions.exportCsv: false` gets neither entry, in any
11391139
format; one that does not set it keeps them, since every `managedBy` bucket

‎ui/packages/plugin-grid/src/ObjectGrid.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ import {
7171
AlertDialogHeader,
7272
AlertDialogTitle,
7373
} from '@object-ui/components';
74-
import { captureUpdateUndoData, resolveConditionalFormatting, declaredNameField, buildExportFileName, resolveAffordance, resolveAffordanceGrant, resolveFieldAffordance, resolveEffectiveCrudAffordances, type SchemaLike, isExpandableFieldType, isUnmaterializedFieldType, readObjectSortability, isPlatformSortableField, filterPlatformSortableSort, filterRefusalSubject, FilterOperatorError, resolveRecordSourceConfig, resolveRecordSourceObjectName, partitionRowsByPredicate, csvBlob, readActionPayload } from '@object-ui/core';
74+
import { captureUpdateUndoData, resolveConditionalFormatting, declaredNameField, buildExportFileName, resolveAffordance, resolveAffordanceGrant, resolveFieldAffordance, isObjectExportOffered, type SchemaLike, isExpandableFieldType, isUnmaterializedFieldType, readObjectSortability, isPlatformSortableField, filterPlatformSortableSort, filterRefusalSubject, FilterOperatorError, resolveRecordSourceConfig, resolveRecordSourceObjectName, partitionRowsByPredicate, csvBlob, readActionPayload } from '@object-ui/core';
7575
import { usePermissions } from '@object-ui/permissions';
7676
import {
7777
RECORD_OVERLAY_DEFAULT_WIDTH,
@@ -1084,17 +1084,17 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
10841084

10851085
// [objectstack#35619] The object's export verdict, read by every export entry
10861086
// this grid draws — the toolbar's Export menu, its handler and the table's own
1087-
// CSV button. `resolveEffectiveCrudAffordances` folds the object's
1087+
// CSV button. `isObjectExportOffered` (`@object-ui/core`) folds the object's
10881088
// `userActions.exportCsv` over its `managedBy` default (`false` hides every
10891089
// format) with the server's effective `export` operation, so neither half is
10901090
// spelled here. It describes the OBJECT, from `objectSchema` alone, and is not
10911091
// a grant: who may export is the permission set's `allowExport`, which reaches
10921092
// this grid through the effective operation set. With no object definition in
10931093
// hand the bucket default applies, which offers export in every bucket.
1094-
const objectExportOffered = resolveEffectiveCrudAffordances(
1094+
const objectExportOffered = isObjectExportOffered(
10951095
objectSchema as SchemaLike | null | undefined,
10961096
effectiveApiOps,
1097-
).exportCsv;
1097+
);
10981098

10991099
// [#5143] Whether THIS principal may edit THIS object's rows in place — the
11001100
// single verdict behind every inline-edit affordance this grid renders

‎ui/packages/plugin-list/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,8 @@ The Export entry (the wide toolbar's button and the Display panel's footer) is
687687
offered when the view declares `exportOptions` and three things allow it: the
688688
view's `allowExport` and `operations.export` are not `false`, and the object's
689689
resolved export verdict is open. That verdict is
690-
`resolveEffectiveCrudAffordances(objectDef, effectiveApiOperations).exportCsv`
691-
from `@object-ui/core`: the object's `userActions.exportCsv` over its
690+
`isObjectExportOffered(objectDef, effectiveApiOperations)` from
691+
`@object-ui/core`: the object's `userActions.exportCsv` over its
692692
`managedBy` default, ANDed with the caller's effective `export` API operation.
693693
An object that sets `userActions.exportCsv: false` therefore gets no Export
694694
entry in any format; one that does not set it keeps the entry, since every

0 commit comments

Comments
 (0)