Skip to content

Commit 341c43a

Browse files
committed
docs(objectql): the update's reference forgiveness compares only stored values the caller may read
The changeset and the two pages that describe the forgiveness say that a column the caller may edit but not read holds no stored value for it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
1 parent 1c9158f commit 341c43a

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎.changeset/29029-lookup-user-caller-read.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
fix(objectql)!: a non-system write may name, in a `lookup` or `user` field, only a record the caller can read (#29029)
88

9-
Clause-②: yes (narrowing) — the write's reference check narrows: a non-system `lookup` or `user` value naming a record the caller cannot read is refused. The business-unit read widens: a delegated admin reads the business units inside the admin scope it holds, and no other.
9+
Clause-②: yes (narrowing) — the write's reference check narrows: a non-system `lookup` or `user` value naming a record the caller cannot read is refused, and an update's forgiveness of a value the row already stores compares only stored values the caller may read. The business-unit read widens: a delegated admin reads the business units inside the admin scope it holds, and no other.
1010
Metadata-protocol: none
1111

1212
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export or type changes. The refusal is the engine's own localized reference_not_found, so there is nothing for a migration to rewrite and no tombstone. -->
@@ -15,6 +15,8 @@ Metadata-protocol: none
1515

1616
After the upgrade, an insert or update that is not a system write is refused with `400 VALIDATION_FAILED` and the field's localized `reference_not_found` when a `lookup` or `user` value it supplies names a record the caller cannot read, before the record's validation rules run.
1717

18+
An update that carries back a `lookup`, `master_detail` or `user` value the row already stores is still not judged again, but that comparison reads only stored values the caller may read, by id and in bulk alike. In a column the caller may edit but not read (a field permission `{ readable: false, editable: true }`), every value is judged as new: one naming a record the caller cannot read is refused with `reference_not_found` even when the row already stores it. A caller who can read the column keeps the forgiveness, and a system write is unchanged.
19+
1820
A delegated admin whose admin scope covers a business-unit subtree can read the business units in that subtree, and no business unit outside it (`@objectstack/plugin-security`).
1921

2022
The parent-write-reach verifier's personas read every record of each object a probed detail's required reference names outside its master chain, so the create probe names records its writer reads (`@objectstack/verify`).

‎content/docs/api/error-catalog.mdx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ unregistered object, or an unreachable datasource on a check that does not read
328328
as the caller — fails **open** rather than inventing a rejection, and an update that carries back
329329
a value (or a member of a multi-valued field) the row already stores is not
330330
judged again, because the update does not add it; on a bulk update that holds
331-
only when every matched row already stores it.
331+
only when every matched row already stores it. That comparison reads only stored
332+
values the caller may read: a column the caller may edit but not read holds no
333+
stored value for it, so a value written there is judged like any other.
332334
</Callout>
333335

334336
### `DUPLICATE_VALUE`

‎content/docs/data-modeling/fields.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ rejected the same way, before the record's validation rules run. The
290290
same check runs on bulk updates. An update judges only the references it adds: a
291291
value the row already stores, carried back unchanged, is not judged again, so a
292292
deleted user's id left in a `user` field does not block later edits of the record.
293+
That comparison reads only stored values the caller may read: in a column the
294+
caller may edit but not read, every value is judged as new.
293295
294296
Clearing a relationship is not a dangling reference: `null`, `""` and `[]` all mean
295297
"no link". Which of them `deleteBehavior: 'set_null'` writes when the referenced

0 commit comments

Comments
 (0)