Skip to content

Commit 483976d

Browse files
committed
docs(plugins): changeset and approvals docs for the business-unit hierarchy reads (WIP)
Claude-Session: https://claude.ai/code/session_01JQwxbXcxCoeCAw1FyTWwwf Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6ad6774 commit 483976d

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
'@objectstack/plugin-sharing': patch
3+
'@objectstack/plugin-approvals': patch
4+
---
5+
6+
fix(plugins)!: a failed `sys_business_unit` read refuses instead of answering nobody, and a business unit with more than 1,000 child units keeps every child
7+
8+
Clause-②: no (narrowing)
9+
Metadata-protocol: none
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped and no metadata changes: the business-unit expansions read the unit rows they already read, to completion, and refuse a read that already failed. No author has anything to rewrite. -->
12+
13+
**BREAKING** only where a `sys_business_unit` read fails: the business-unit expansions used to answer nobody (an empty list) then, and now refuse.
14+
15+
The member reads of a business unit (`sys_business_unit_member`) read to completion and refuse on failure. The reads of the unit table they are keyed by did not: the check that the unit exists and is active, and the read of each unit's child units, still turned any read error into nobody, and the child-unit read stopped at 1,000 rows.
16+
17+
- **A failed unit read refuses.** In plugin-sharing, `BusinessUnitGraphService.descendants`, `expandUnitMembers` (every `business_unit` sharing recipient) and `expandUsers` (every `unit_and_subordinates` recipient) now throw when the unit's own row or a child-unit read fails. In plugin-approvals, the `department` / `business_unit` / `bu` approver and an `expression` approver with `resolveAs: 'department'` do the same.
18+
- Sharing: the expansion rejects, so that rule's reconcile or revoke pass fails, its callers log their existing per-rule warning, and the grants it already holds stay. Before, a failed unit read answered `[]` and that answer was kept for the rest of the pass, so the recompute a business-unit graph write triggers revoked every grant the rule gave.
19+
- Approvals: the approver slot falls back to its literal (`department:ID`) and logs `could not be expanded — a directory or read-filter lookup failed` with its `error`. Before, a failed seed read logged "expanded to nobody", and a failed child-unit read routed to the units that did read, with no signal.
20+
- Ownership queues: a `business_unit` or `unit_and_subordinates` queue specification whose unit read fails contributes nobody, the posture the queue declares for a failed expansion, and logs it once.
21+
- **Nothing is cached after a failed read.** The next expansion on the same pass reads again.
22+
- **Every child unit.** The child units of each unit are read in pages of 1,000 ordered by id until they are exhausted. A unit with more than 1,000 active child units used to lose the children past the 1,000th row, with all their members and descendants. A unit with fewer issues one read, as before.
23+
- **A missing object is still nobody.** A stack that never registers, or never creates, `sys_business_unit` keeps answering no members. That is judged by `isObjectAbsentError(error, 'sys_business_unit')`; any other error stays loud.
24+
25+
**The remedy.** None is needed. A refusal means the business-unit table could not be read: fix that read, and the next expansion succeeds.

‎content/docs/automation/approvals.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ What an entry that resolves to nobody leaves on the slate depends on its kind:
458458
`behavior` that needs every slot (`unanimous`) waits on it too. A `team`,
459459
`position`, `department` or `org_membership_level` entry whose holder read
460460
failed (`sys_team_member`, `sys_user_position`, `sys_business_unit_member`
461-
or `sys_member`) keeps its literal the same way. It logs `could not be
461+
or `sys_member`, and for a `department` also the `sys_business_unit` read of
462+
the unit and of its child units) keeps its literal the same way. It logs `could not be
462463
expanded — a directory or read-filter lookup failed` with the `error`,
463464
instead of `expanded to nobody`, and never routes to the holders that
464465
happened to read. An `expression` value whose `resolveAs` read failed keeps

0 commit comments

Comments
 (0)