Repository navigation
Commit 32fe321
docs(adr): ADR-0093 D3 amendment note, bulk import joins the administrator's current organization (#35035)
Fixes #34809
Clause-②: no
Metadata-protocol: none
> **Governed / Tier H.** The diff touches `docs/adr/**` only, a Tier H
row of `GOVERNED_SURFACES`. The note sits under the record's `Decisions`
heading, the status line gains an entry, and the behaviour it describes
is the admin user import (auth). So the low-risk add-only arm does not
apply: it lands by the maintainer's hand or an authorized approval, and
this area never readies, queues or arms it.
## 维护者速读
- 改了什么:ADR-0093 的 D3 修订(2026-10-24)末段下面,加一条带日期(2026-11-17)的修订说明;状态行末尾加一条
Amended。原裁决句一字未动。说明记录的是:有墙(多组织)模式下,批量导入的每一行用户都加入管理员当前所在的组织。
- 为什么改:你在 #34535 裁了 B(裁决记录 6942842013),PR #34750(合并提交
`36af6b05a7`)已经落地。ADR 那一句还写着批量导入在多组织下不绑定任何组织,和代码相左。
- 风险与回滚:纯文档,没有代码,不发布任何东西;回滚即 revert 本 PR。另有一处要知道:在开的 PR #34909
也在同一条状态行末尾追加了一句,两边在这一行上有文本冲突;后落地的一方合 main 时把两句都留下即可。
- 先看:`docs/adr/0093-tenancy-mode-and-membership-lifecycle.md` 第 276–307
行的修订说明。风险点是 upsert 那一条:它写明「已属于其他组织的已有用户,被 CSV 匹配到时也会加入管理员当前组织」。再看第 3
行状态行末尾新增的一句。
- 两分钟验证:`node scripts/check-adr-symbol-anchors.mjs && node
scripts/check-adr-links.mjs && node scripts/adr-index.mjs
--check`,预期三条都以 0 退出,最后一条印 `adr-index: OK`。
- 需要你做的:按 Tier H 审读并批准本 PR。
## What changes
One file, `docs/adr/0093-tenancy-mode-and-membership-lifecycle.md`, +34
/ −1:
- **An add-only dated note under the D3 amendment (2026-10-24)**, in the
record's own `Amendment note (date, ruling)` blockquote form (the form
of its 2026-11-11 note under D8). It says the amendment's closing
sentence no longer holds for bulk import, and records what PR #34750
landed for `POST /api/v1/auth/admin/import-users`. It cites maintainer
ruling 6942842013 (option B) and merge commit `36af6b05a7`.
- **The ruled 2026-10-24 sentence is not rewritten.** The note states
that the sentence stands as ruled for the reconciler and for the other
creation paths it names (self sign-up, SSO JIT, host hooks).
- **The status line gains one `Amended` entry** dated 2026-11-17, as the
two later amendments of this record did (2026-11-08 and 2026-11-11).
This is the one modified line of the diff: the entry is appended to the
single status line.
- `docs/adr/README.md` is unchanged. `node scripts/adr-index.mjs
--check` answers that it is current (the index shows only the head of a
status line).
## Tests
None: the diff is one ADR. Nothing published moves, so no changeset
(`skip-changeset`).
## Acceptance notes
**The landed facts, FROM → TO, each read at `origin/main`
`4443014630`.** "Walled posture" is `tenancy.isolationActive === true`,
the predicate
`packages/plugins/plugin-auth/src/admin-user-endpoints.ts#multiOrgCreationJoinsCurrentOrganization`
reads.
| Fact in the note | Before `36af6b05a7` | At `main` | Where it is read
| Pin |
|:--|:--|:--|:--|:--|
| Settled before any row is written, on a dry run too | no settlement |
`settleCurrentOrganizationJoin` runs before `runImport`, with no
`dryRun` branch before it |
`packages/plugins/plugin-auth/src/admin-import-users.ts#runAdminImportUsers`
| the two `no current organization` cases (`dryRun` false and true) |
| No current organization | `200`, rows created in no organization |
`400 NO_ACTIVE_ORGANIZATION`, Create User's sentence, nothing created |
`packages/plugins/plugin-auth/src/admin-user-endpoints.ts#settleCurrentOrganizationJoin`
| same cases, asserted equal to the settlement's own answer; dogfood I2
|
| No unit of work wired, or no `addMember` on better-auth's API | `200`,
rows created | `501 NOT_IMPLEMENTED`, nothing created | same function
(`!seam` or `addMember` not a function) | `a host with no unit of work,
or no organization plugin` |
| Created row: account and join are one unit of work | account only, no
membership | `createUser` and `joinCurrentOrganization` inside
`join.seam.runAtomically` | `inRowUnit` in `runAdminImportUsers`;
`packages/plugins/plugin-auth/src/admin-user-endpoints.ts#joinCurrentOrganization`
| `every created row joins`; dogfood I1 |
| A refused join | n/a | row `failed` with the vendor's code, account
rolled back, no temporary password, no invitation, other rows land |
`inRowUnit` rethrows `CreationRefused` as the row's error; the password
and the invitation target are recorded after the unit returns | `a row
whose join is refused`, `a refused row under the temporary policy`;
dogfood I1 |
| Upsert-matched existing user | profile updated, no membership | joined
in the same unit as its profile update; a refused join fails the row and
leaves the profile; an existing member is not added twice | `updateData`
in `runAdminImportUsers` calls `inRowUnit('existing', …)` | the two
`upsert:` cases |
| A dry run that is not refused | joins nothing | joins nothing |
`runImport` with `dryRun` writes no row | `a dry run with a current
organization joins nothing` |
| Single mode, a degraded wall included | no join | no join; no session
read, no transaction | `multiOrgCreationJoinsCurrentOrganization`
answers false | `CONTROL single-org (or a degraded wall)` |
The unit pins are the multi-org describe of
`packages/plugins/plugin-auth/src/admin-import-users-manager-pass.test.ts`;
the dogfood pins are I1 and I2 of
`packages/qa/dogfood/test/create-user-organization-join.dogfood.test.ts`.
**Where the note differs from the card's drafted paragraph, and why:**
- The draft edited the ruled sentence (it took `bulk import` out of the
list). The claim's form is add-only, so the sentence is untouched and
the note says where it no longer holds.
- `no organization plugin` is written as the code tests it: no
`addMember` on better-auth's API. `no unit of work` is the host wiring
no seam for the creation.
- `multi mode` is written `under a walled posture`, the amendment's own
words for the predicate, because a degraded wall is multi-requested and
does not join.
- Added from the merged PR's table and the code: a refused row gets no
temporary password and no invitation and the other rows go on; a dry run
that is not refused joins nothing; an existing member is not added
twice.
- Added, and worth the approver's eye: the upsert bullet says the
matched user joins `whichever other organizations that user already
belongs to`. This is read from the code, not from a pin: the membership
probe in `joinCurrentOrganization` asks only about the current
organization, and the import matches users across the deployment. The
contract review of PR #34750 (6946273468) raised the same consequence
for the approver.
- Added: the unit of work is named as the engine transaction with the
limit ADR-0119 D1 declares (a default driver without `beginTransaction`
runs the callback with no rollback). The seam's own comment in
`auth-plugin.ts` states that limit, and the same contract review lists
it as inherited from Create User.
- `501` on a dry run is true by the code path (the settlement precedes
`runImport` whatever `dryRun` says); the pin covers `400` on a dry run
and `501` on a real run.
**Nothing moved in review after PR #34750's table was written.** The PR
has no review comment and no submitted review; its last two commits type
a test harness and repair one docs anchor. `git log
36af6b0..4443014` over the four files above, `auth-plugin.ts` and
`reconcile-membership.ts` answers 0 commits, and `git merge-base
--is-ancestor 36af6b0 4443014` answers exit 0.
**Notes for the seat, not acted on here:**
- Ruling record 6942842013 says the sentence `is rewritten by the
implementing PR`. The claim chose the add-only note instead. This PR
follows the claim; the difference from the ruling's letter is the
approver's to accept.
- The ruled sentence says SSO JIT and host hooks bind nothing in multi
mode, while D3's table and D7 say those flows own membership there. The
note repeats the sentence as ruled and does not reword it. Observation
only; no card.
- **Overlap.** `node scripts/pm/overlap-check.mjs --branch=HEAD` answers
exit 1: this branch merges cleanly with `origin/main` (`6d2db1d7ef`) and
conflicts with open PR #34909 in this file. The conflict is the status
line alone (each side appends one `Amended` entry to the same line); the
D1 and D7 hunks of that PR and the D3 hunk here merge cleanly. Whichever
lands second merges `main` and keeps both entries. The claim recorded no
open PR on this file; that reading was wrong at claim time.
## Verification
Head `1a6abb30dd`, one commit on `origin/main` `4443014630`.
<details><summary>Derived gates on 1a6abb3: 21 derived, 21 run, 0
NOT-MEASURED, 0 UNRUN</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 21 commands from the one changed
path. Each ran with stdin closed and its exit recorded before any pipe;
all 21 answered exit 0. `node scripts/pm/dispatch-gates.mjs --ran` on
that record: `21 derived famil(ies) accounted for — 21 run, 0
NOT-MEASURED`.
- `pnpm check:adr-symbol-anchors`: `3756 anchors across 158 records
resolve`. The note carries 5 of them (3 symbol, 2 file-level), read with
the gate's own `extractAnchors`.
- `node scripts/check-adr-links.mjs`: `1151 relative link destination(s)
under docs/adr/ resolve`.
- `pnpm check:adr-index`: `OK — docs/adr/README.md is current, every
record parsed`.
- `pnpm check:adr-anchors`, `pnpm check:doc-authoring`, `pnpm
check:nul-bytes`, `pnpm check:pm-governed-merges`, `pnpm
check:pm-prior-rulings`: exit 0.
- `pnpm --filter @objectstack/lint run check:doc-formula-expressions`
first answered exit 3 (prerequisite: `@objectstack/formula` and
`@objectstack/lint` not built in this worktree). After `turbo run build`
of those two under the verify lock (`VERDICT command-exit 0`), it
answered exit 0.
- Not run locally, left to CI: the repo-wide lint, the type-check lanes
and the test shards. No package is touched.
</details>
<details><summary>Governed reading</summary>
`node scripts/pm/dispatch-gates.mjs --tier`: model tier MANDATORY for
`docs/adr/**`; changed lines 35 (+34 / −1), under the 3000 threshold.
The `check-governed-merges.mjs --pr` reading is posted in the report on
#34809 once this PR has a number.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzgwLiKcfujYUug7sPs -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent c21945d commit 32fe321
1 file changed
Lines changed: 34 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
276 | 309 | | |
277 | 310 | | |
278 | 311 | | |
| |||
0 commit comments