Repository navigation
Commit 05b28c1
docs(adr): ADR-0123 D2 records the two inserts its refusal now answers — the union-scope insert and the crossing operator's (#24918)
Fixes #24823
Clause-②: no
ADR-0123 D2's text was narrower than the runtime after two merged
changes. PR #24819 (`8a058d85a`) made the D2 refusal answer a
union-scope insert from a session with no active organization. PR #24868
(`98c3d00447`) made it answer a crossing platform operator's insert from
such a session. This PR records both in a dated amendment on the ADR. It
is docs only: one file, no package touched, no code, no test.
## What changed:
`docs/adr/0123-no-active-organization-session-semantics.md` only (+9 /
−2)
1. **Status block.** A dated `Amendment (2026-10-20)` blockquote under
the `**Status**:` line, in the shape PR #24756 gave ADR-0047
(`795ff708d`): a bold lead with its provenance in parentheses, then the
body. It records:
- both arms are D2's own refusal (`403 PERMISSION_DENIED`, naming the
missing active organization, D4), thrown from one place, anchored as
`packages/plugins/plugin-security/src/security-plugin.ts#refuseNoActiveOrganization`;
- neither arm changes an outcome. Each insert was already refused by the
engine's organization check (ADR-0131 D9) with `500
ERR_SYSTEM_WRITE_ORGANIZATION_REQUIRED`. Only the answer moved;
- arm 1, the union-scope insert (PR #24819), and its reason: a new row
lands in the active organization (ADR-0105 D5);
- arm 2, the crossing platform operator (PR #24868), and its reason:
crossing (ADR-0095 D3) lets the operator read every organization's rows
and update them where they are, but it gives a new row no organization.
ADR-0131 D9 refused that write already;
- the reach of both arms: they judge the stored image after the
`beforeInsert` chain. Reads, updates of existing rows, deletes, inserts
from a session with an active organization, and system contexts are
unchanged.
2. **D2's scope paragraph** keeps its text as written. A dated italic
pointer at its end says that the operator clause and the "empty
membership set" sentence bound the scope pre-test, not every write, and
it names the two inserts refused past them.
3. **Consequences, What does not change.** "Platform operators." is
struck in place, not deleted, as PR #24756 did on ADR-0047. It is
followed by the corrected entry ("Platform operators' reads, their
updates of existing rows, and their inserts from a session with an
active organization") and a dated italic note naming the changed insert.
No other ADR text moves. The `**Status**:` line, the TL;DR, D2's
bullets, D3, D4 and the "What changes" paragraph are untouched.
### Before / after
Scope paragraph, last sentence. Before (`origin/main` `a8b44d407`, line
60):
> Under `group`, "no organization scope" means an **empty membership
set**, matching ADR-0105 D2's own fail-closed rule.
After (line 67): the same sentence, then:
> *(Amended 2026-10-20 — the operator clause and the "empty membership
set" sentence bound the scope pre-test, not every write. Two inserts
from a session with no active organization, of a row that names no
organization, are refused past them: a `group` member's with a non-empty
membership set, and a platform operator's crossing the wall. See the
amendment in the status block above.)*
What does not change. Before (line 78): `Reads. System contexts.
Platform operators. Single-posture deployments …`
After (line 85): `Reads. System contexts. ~~Platform operators.~~
Platform operators' reads, their updates of existing rows, and their
inserts from a session with an active organization. *(Corrected by the
2026-10-20 amendment — …; see the status block above.)* Single-posture
deployments …`
Rendered locally with `marked` 16.4.2 (GFM):
- the amendment renders as one blockquote: a paragraph, a two-item
ordered list, a paragraph;
- `Platform operators.` renders inside a `del` element;
- the scope paragraph ends in the italic pointer.
A blank line follows the blockquote, so the `**Deciders**` / `**Builds
on**` / `**Consumers**` / `**Surfaced by**` lines stay one paragraph of
their own and are not folded into the quote by lazy continuation. One
visible side effect: the `**Status**:` line now renders as its own
paragraph, where before it ran into the Deciders paragraph.
## Premise readings (the dispatch's mechanism hypotheses H1–H3)
Base: the worktree was created at `origin/main` `a8b44d407`. The
dispatch named `fcb40ad67`. `git log fcb40ad..origin/main --
docs/adr/0123-no-active-organization-session-semantics.md` is empty, so
the ADR did not move between the two.
- **H1 holds, read from the merged code** (`security-plugin.ts` step 3.7
at `a8b44d407`), not from either PR's body:
- `git merge-base --is-ancestor 98c3d00 HEAD` exits 0. `8a058d85a` is
in `git log` of `security-plugin.ts` on the same tree.
- Union-scope arm, `insertLacksActiveOrganization`. It needs all four:
the operation is `insert`; `postureUsesUnionScope` holds; the caller's
own Layer 0 is non-null; `carriesActiveOrganization(context)` is false.
- Operator arm, `operatorInsertLacksActiveOrganization`. It needs all
three: the operation is `insert`; `callerCrossesTenantWall` holds (from
`computeWriteTenantWall`'s `crossedByPlatformAdmin`); there is no active
organization.
- Both arms throw `refuseNoActiveOrganization('caller', …)` inside the
`postHookWriteImageCheck` seam, and only when some stored row names no
organization.
- The enclosing guard requires `opCtx.context.userId`, and `isSystem`
short-circuits the middleware earlier, so system contexts never reach
either arm.
- Neither arm fires on `update` or `delete`.
- **H2 holds, with one reading added.** The ADR-0047 amendment
(`795ff708d`) puts a status-block blockquote under the `**Status**:`
line and strikes the affected text in place, followed by an italic
pointer. That is the form matched here. The repo has other forms too: a
`## Amendment (date, #n): …` section is the most common, and ADR-0099
carries an inline `> **Amendment note (date):**` beside the corrected
row. ADR-0123 had no amendment chain of its own to join.
- `check-adr-symbol-anchors` reads backticked `path#symbol` tokens. The
one anchor added (`security-plugin.ts#refuseNoActiveOrganization`) is
extracted from the new file and not from the base file. It resolves as
`declaration` (a `const` binding). A probe with an unknown symbol on the
same source resolves `null`. The gate's total went to 2370 anchors, all
resolving.
- Every other symbol named in the note is a bare identifier, which the
gate does not read. Each exists on `a8b44d407`.
- **H3 holds.** The scope paragraph was line 60 and the **What does not
change** line was line 78, on `fcb40ad67` and on `a8b44d407`.
## Gates: all at `e9913cb22`, the final commit
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` was re-derived on the actual diff, with no
paths. It gives the same 20 commands as the dispatch. Each ran with its
output redirected first and its exit captured before any read. `--ran`
reads `20 derived, 20 run, 0 NOT-MEASURED, 0 UNRUN`, a derived zero.
| command | exit |
|---|---|
| `node scripts/check-adr-links.mjs` | 0 — 770 relative link
destinations under docs/adr/ resolve |
| `node scripts/check-adr-links.mjs --self-test` | 0 |
| `node scripts/check-adr-symbol-anchors.mjs` | 0 — 2370 anchors across
142 records resolve, 0 line anchors |
| `node scripts/check-adr-symbol-anchors.mjs --self-test` | 0 |
| `node scripts/check-ci-filter-parity.mjs` | 0 |
| `node scripts/check-closing-keyword-parity.mjs` | 0 |
| `node scripts/check-closing-keyword-parity.mjs --self-test` | 0 |
| `node scripts/check-comment-mask-corpus.mjs` | 0 — 9691 files, 0
disagree |
| `pnpm --filter @objectstack/lint run check:doc-formula-expressions` |
0 |
| `pnpm check:adr-anchors` | 0 |
| `pnpm check:closed-ceremony-text` | 0 |
| `pnpm check:cross-package-test-inputs` | 0 |
| `pnpm check:doc-authoring` | 0 |
| `pnpm check:driver-memory-census` | 0 |
| `pnpm check:gitlink-declared` | 0 |
| `pnpm check:nul-bytes` | 0 — no raw ASCII control bytes |
| `pnpm check:pm-governed-merges` | 0 |
| `pnpm check:pm-prior-rulings` | 0 |
| `pnpm check:refd-timer-probe` | 0 |
| `pnpm check:watch-hint-literal` | 0 |
- `check:doc-formula-expressions` reads the built `@objectstack/formula`
/ `@objectstack/lint`. Those were built first, under the verify lock
(`turbo run build --concurrency=2`, 4/4 tasks, `VERDICT command-exit
0`).
- No package is touched, so there is no dependency-closure build, no
package test or typecheck, and no ablation: the change is documentation,
and no tested behaviour moves.
- There is no changeset: `docs/adr/**` publishes nothing, so this PR
carries `skip-changeset`.
- Not run locally, and owned by CI: the repo-wide scans and the families
outside the derived total.
## Acceptance notes
- **Two developer messages in step 3.7 still end "System contexts and
platform operators are unaffected."** One is on the scope pre-test's
refusal, the other on the union-scope arm's. Each is true of its own
arm, because a crossing operator never meets either of them; it meets
the operator arm, whose text says only "System contexts are unaffected."
Read as a claim about D2 as a whole, it no longer holds after this
amendment. This is an observation, not filed: a read-only inference,
with no public door measured. Carrier: none. This PR changes no code.
- **`canWriteObject`'s row-less create preview still answers `true`**
for both arms' callers. PR #24819 and PR #24868 each recorded this as a
known boundary in their own acceptance notes. The amendment does not
restate it. Carrier: none.
- **The `**Status**:` line is left alone.** It still reads "Accepted
(2026-08-13)". The dated amendment block carries the 2026-10-20 change,
as ADR-0047's amendment did.
## 维护者速读(草稿)
**改了什么**:只动了一个文件 ADR-0123(“已登录但没有当前组织”的会话语义),三处改动,都标了日期 2026-10-20:
- 文件顶部状态区下面加了一段修订说明,写明两种新被拒的“新建记录”情形以及各自的理由。
- D2 的适用范围那一段原文不动,只在段尾加一句指向修订说明的注。
- “不变的部分”里原来写着“平台运维人员”,现在用删除线划掉,改成更准确的说法,并加了注。
**为什么改**:两次已合并的修复让运行时的行为比 ADR 原文写的更宽:
- PR #24819:在 `group` 多组织模式下,没有当前组织的成员新建记录,现在返回 403
并说明“没有当前组织”。新记录要落在当前组织里,没有当前组织就无处可落。
- PR #24868:平台运维人员(可以跨组织墙的人)在没有当前组织时新建记录,现在也返回同一个 403。
这两种写入以前本来就被拒绝,只是返回的是看不出原因的 500。现在换成能看懂原因的
403。原文还写着“平台运维人员不受影响”,已经不准确。按第一指令 13,ADR 要如实反映已落地的行为;否则后来读 ADR 的人(和
AI)会误以为运维人员没有当前组织也能新建记录。
**风险与代价(含回滚)**:纯文档改动,没有运行时影响,不发包,没有 changeset。回滚就是 revert 这一个提交。
**席位意见**:
**你要做的**:审阅这处 ADR 修订;同意的话,在 PR 上点 Approve(席位随后落地)。
---
_Generated by [Claude
Code](https://claude.ai/code/session_01M82feuetLzrCiBz41BJb7L)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent be1fd31 commit 05b28c1
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
4 | 11 | | |
5 | 12 | | |
6 | 13 | | |
| |||
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
60 | | - | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
75 | 82 | | |
76 | 83 | | |
77 | 84 | | |
78 | | - | |
| 85 | + | |
79 | 86 | | |
80 | 87 | | |
81 | 88 | | |
| |||
0 commit comments