You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plugin-auth: admin import-users does not join created users to the importing admin's current organization in multi-org mode #34535
Filing gate ①: class a, from the final report 6933432108 of card #33113 (PR #34531), passed on by area o2-D. Dedupe: import-users organization, joinCurrentOrganization import.
维护者速读
现象:多组织模式下,管理员在控制台单个新建用户时,新用户会加入管理员当前所在的组织;用 POST /api/v1/auth/admin/import-users 批量导入的用户不会。
grep -n "joinCurrentOrganization" packages/plugins/plugin-auth/src/admin-user-endpoints.ts: create-user joins the current organization.
grep -n "joinCurrentOrganization\|createUser" packages/plugins/plugin-auth/src/admin-import-users.ts: import-users only calls authApi.createUser (no join).
reconcile-membership.ts returns none in multi mode, so nothing joins the user later.
Change
Make import-users go through the same membership step create-user uses, as one shared helper and not a second copy. Pin it with a multi-org test: an imported user is a member of the importing admin's current organization, and a positions row on it validates.
Done when
The pin test passes in multi mode, and single-org mode behaviour is unchanged.
In multi-org mode, users created by admin import-users never join the importing admin's organization, although single create does. Hosted is multi-org, and the maintainer's p1 ruling on #33113 exists so that a hosted demo organization, or a customer onboarding staff, gets people from one CSV. Imported users missing from the organization defeat that, so p1 in the focus theme.
Inbox: needs a maintainer decision · 2026-11-17T03:51Z
Area o2-D read the code before claiming (on origin/main97defd606, nothing written, no claim). Doing what the card asks would reverse the text of an accepted ruling, so the card moves pm:queue → needs-user-decision. The seat does not decide this.
2026-11-17T08:28Z Ruled. Steve chose an option on this project's decision card for #34535 at 2026-11-17T08:25:13Z. Option text verbatim: 「B 入当前组织,被拒行不建号」 — 「和单个新建同一规矩;名额满的行明确报错且不发邀请;无当前组织整单拒。算收窄,工作量 M 到 L。」. It answers the inbox analysis 6937705452 (which recommended A; the maintainer chose B). Freshness: no comment on this card is newer than that analysis, and the body was not edited after it.
Ruled: B
Governing text: ADR-0093 D3 (its sentence on imported users is rewritten by the implementing PR); the single-create ruling that a refused join creates no account.
What to build. In multi-organization mode, import-users joins each row's user to the importing admin's current organization in the same unit of work that creates the account (reuse joinCurrentOrganization, the single-create path). A row whose join is refused (for example the member cap) creates no account, sends no invitation, and reports the refusal on its row; the other rows go on. No current organization ⇒ the whole import is refused 400 NO_ACTIVE_ORGANIZATION. Narrowing ⇒ L1 + L2 + Tier H.
Seat reading on the one point the option text leaves open (an execution detail, within the maintainer's veto window): a CSV row that matches an existing user is joined to the current organization too, under the same rule (refused ⇒ that row reports it, no invitation). One rule per row keeps the two doors alike, and a re-import after the cap is raised then heals the rows that were refused.
Claim: PM loop (area o2-D, repo:objectstack#2; built in a card thread that reports to the area; the card thread adds its Thread session and Branch below this claim when it starts)
Session: session_01ADHkmRXuRn93HphKp7kXEz
Account: os-steve
Branch: named by the card thread on its first post (claude/project-thread-*)
Domain: domain:server
Seat: repo:objectstack#2
File surface: packages/plugins/plugin-auth/src/admin-import-users.ts (each row joins the importing admin's current organization in the unit of work that creates or matches its user; refused join ⇒ no account, no invitation, refusal on the row; no current organization ⇒ whole request 400 NO_ACTIVE_ORGANIZATION), admin-user-endpoints.ts (joinCurrentOrganization / the multi-org predicate reused, not copied; only if it needs a non-throwing or per-row shape), auth-plugin.ts (wiring), their tests, content/docs/permissions/authentication.mdx, ui/packages/app-shell/src/views/IdentityImportPanels.tsx and i18n packs only if the import result's new row field is shown, .changeset/ (stop on breach). docs/adr/0093-*.md (the D3 amendment sentence on imported users) is outside an implementing card's surface: the card thread names the sentence and the seat files the ADR edit (large-card-order).
Container & model: L, card thread, effort: high
Clause-②: no (narrowing)
Metadata-protocol: none
Responsibility: ruling 6942842013 (maintainer B, 2026-11-17T08:25Z, and the seat's reading on matched existing users); ADR-0093 D3 amendment (the single-create rule: a refused join creates no account)
Thread-read: 6942842013
Premise: holds (on origin/main dc66d33admin-import-users.ts creates through authApi.createUser with no join; reconcile-membership.ts binds nothing in multi mode; create-user joins via joinCurrentOrganization)
Serial constraints cleared: PR #34531 (#33113) and #34649 (#34536) on the same file merged. No open PR touches plugin-auth/src/admin-import-users.ts, admin-user-endpoints.ts, auth-plugin.ts or docs/adr/0093* (open PR file lists read at 08:47Z).
Pre-claim lane: domain:server; large-card trigger: a narrowing (a file main answers 200 for is refused whole without a current organization, and a refused-join row no longer creates its user) ⇒ (narrowing) BREAKING, ADR-0087 disposition, contract-tier L2, dogfood battery on the PR head, landing through the seat's governed step.
Pre-claim deps: no Blocked-by: line.
Prior rulings read: ADR-0093 D3 amendment (2026-10-24) and D1, ruling 6942842013, ruling 6920428750 (#33113, per-row positions), area options 34535-options.md; thread: none; repo: objectstack-ai/objectstack
{
"issue": 34535,
"status": "done",
"pr": "https://github.com/objectstack-ai/objectstack/pull/34750",
"head": "6bfc975899a1ed10282cfe967eb01ed3ad7e8ea8",
"branch": "claude/project-thread-55tnyt",
"session": "session_01ADHkmQ6fcQhYhhjvBoSuKn",
"gates": "local: dispatch-gates --commands derived 108 on 6bfc9758, 108/108 exit 0, --ran: 108 derived, 108 run, 0 NOT-MEASURED, 0 UNRUN (file objectstack-seat2/34535-gates-ran.txt); plugin-auth test 282 files / 5916 passed, typecheck exit 0; dogfood battery on 870ce227 (docs-only delta to final head) VERDICT command-exit 0, Test Files 478 passed | 3 skipped, Tests 4057 passed | 68 skipped; CI on 6bfc9758 read at hand-back: required contexts green except Test Core shards still in progress",
"dogfood_battery": "870ce227 · VERDICT command-exit 0 (42m07s) · Test Files 478/481 (3 skipped) · Tests 4057/4125 (68 skipped) · no failures; final head adds only a docs anchor line no dogfood test reads",
"line_budget": "n/a — no skills/** or governed text touched",
"deviations": [
"packages/qa/dogfood/test/create-user-organization-join.dogfood.test.ts is outside the claim's named test paths: it is the existing real-engine harness for this exact join, so the I1/I2 pins went there (AGENTS.md shared-harness rule)",
"Three refusal cells beyond the ruling text, all create-user's same rule and accepted by the area before coding: 501 whole when no unit of work or no addMember; dryRun refused whole with no current organization; an upsert-matched user's profile update rolls back with a refused join",
"dogfood battery ran on 870ce227; the final head 6bfc9758 differs by one docs anchor line",
"a mis-scoped redirect wrote the gate list to /gates-cmds.txt and /gates-cmds.err at the container root (outside the repo; not removed, the removal was refused by the safety check)"
],
"files_changed": [
".changeset/34535-import-users-current-organization.md +21 -0",
"content/docs/permissions/authentication.mdx +13 -0",
"packages/plugins/plugin-auth/src/admin-import-users-manager-pass.test.ts +253 -4",
"packages/plugins/plugin-auth/src/admin-import-users.ts +112 -14",
"packages/plugins/plugin-auth/src/admin-user-endpoints.ts +76 -40",
"packages/plugins/plugin-auth/src/auth-plugin.ts +11 -0",
"packages/qa/dogfood/test/create-user-organization-join.dogfood.test.ts +66 -0"
],
"security_findings": "none",
"api_writes": "3 — pr_create (#34750), issue_patch (#34750 body), this os-dev-report comment",
"mcp_calls": "5 — issue_read x2, pull_request_read x3 (get_check_runs, get, get_check_runs)"
}
One path joins the surface, a forced move the area accepts:
packages/qa/dogfood/test/create-user-organization-join.dogfood.test.ts: the existing real-route, real-walled-posture harness for create-user's organization join. The dogfood pins for this card (I1: three rows under a membership cap of 3, the third refused and its account gone from sys_user; I2: no current organization ⇒ 400, no user) belong in that shared harness rather than a new file under the claim's plugin-auth test paths.
Nothing else moves; the PR's other six paths are inside the claimed surface. Declarations unchanged: Clause-②: no (narrowing), Metadata-protocol: none, Skills-docs: none, ADR-0087 not-required (no-migration-prescription). Review: L1 accepted on this head; contract-tier L2 in review; landing through the seat's governed step. The ADR-0093 D3 sentence is carded as #34809.
Small-flaw rule (maintainer 2026-11-17 12:34Z): when review leaves only small flaws, the PR may merge first and each flaw gets its own card; a governed PR still needs os-zhuang's approval.
Lease lease:o2-D removed in this stroke; the assignee and pm:dispatched stay for seat 3's takeover claim to swap.
Activity
objectstack-fleet commentedon Nov 17, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Path: none
Triage: first touch → p1 (from suggested p2) · theme: zh-CN / install (hosted onboarding) · 2026-11-17T00:26Z
⛔ Not a claim.
In multi-org mode, users created by admin import-users never join the importing admin's organization, although single create does. Hosted is multi-org, and the maintainer's p1 ruling on #33113 exists so that a hosted demo organization, or a customer onboarding staff, gets people from one CSV. Imported users missing from the organization defeat that, so p1 in the focus theme.
objectstack-fleet commentedon Nov 17, 2026
repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA
Inbox: needs a maintainer decision · 2026-11-17T03:51Z
Area
o2-Dread the code before claiming (onorigin/main97defd606, nothing written, no claim). Doing what the card asks would reverse the text of an accepted ruling, so the card movespm:queue→needs-user-decision. The seat does not decide this.维护者速读 · 待裁
一句话问题: 卡要求多组织模式下 CSV 导入的用户加入管理员当前所在的组织。但 ADR-0093 D3 的修订(2026-10-24,你的「25626 按当前组织」)原文写着批量导入在多组织模式下「不绑定任何组织」。照卡做就要改这句裁决。
现状(读码): 单个新建用户(create-user)在多组织模式下会加入当前组织,加入被拒就整次不建;CSV 导入只建号、不加入任何组织。托管版是多组织,所以 #33113 想要的「一份 CSV 建好带岗位的员工」在托管版上走不通:岗位列会逐行报
refused,用户照建,但不属于任何组织。Governing text: ADR-0093 D3 修订原文 "every other creation path (self sign-up, bulk import, SSO JIT, host hooks), still binds nothing in multi mode";ADR-0093 D1;你在 #33113 的裁决 6920428750(「C,只加岗位列,p1」,只讲岗位列,没讲组织)。
os-decision-facets
① 项目长远合理性:A 让导入和单个新建走同一个加入判断,只是失败时逐行报告,与导入一贯的「坏行不连累整批」一致;B 一致性最强但带来收窄;C 留下两条创建路径行为不同。
② 实际业务拉动:#33113 是你点名的 p1,目标就是托管版(多组织)用 CSV 建带岗位的员工;今天在托管版走不通,有实测拉动。
③ 防 AI 犯错:A 和 B 都让「导入的用户在当前组织里」成为默认结果,作者不必另写加入步骤;C 要求每次导入后手工补,最容易漏。
④ 创业阶段不扩散:A 不加新写法、不加新字段,只是让现有导入走已有的加入判断;B 多一套收窄流程;C 最省但目标落空。
Prior rulings read: ADR-0093 D1/D3(含 2026-10-24 修订)、D7、D8;ADR-0068 D3;ADR-0131 D3;ADR-0135 D9;#33113 裁决 6920428750。
推荐:A(区与席位一致)。只看①就选 A;②③④ 是否翻转:否,有实测拉动,A 也不扩散。
裁后执行: 选 A ⇒ 本卡回
pm:queue,由区 o2-D 认领,一个 PR 里修订 ADR-0093 D3 那一句并实现(受管面,交你审批)。选 B ⇒ 同上,另加收窄流程(ADR-0087 条目和 battery)。选 C ⇒ 本卡改为文档卡,在content/docs/permissions/authentication.mdx写明多组织下导入后的加入步骤。objectstack-fleet commentedon Nov 17, 2026
repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA
2026-11-17T08:28Z Ruled. Steve chose an option on this project's decision card for #34535 at 2026-11-17T08:25:13Z. Option text verbatim: 「B 入当前组织,被拒行不建号」 — 「和单个新建同一规矩;名额满的行明确报错且不发邀请;无当前组织整单拒。算收窄,工作量 M 到 L。」. It answers the inbox analysis 6937705452 (which recommended A; the maintainer chose B). Freshness: no comment on this card is newer than that analysis, and the body was not edited after it.
Ruled: B
Governing text: ADR-0093 D3 (its sentence on imported users is rewritten by the implementing PR); the single-create ruling that a refused join creates no account.
What to build. In multi-organization mode,
import-usersjoins each row's user to the importing admin's current organization in the same unit of work that creates the account (reusejoinCurrentOrganization, the single-create path). A row whose join is refused (for example the member cap) creates no account, sends no invitation, and reports the refusal on its row; the other rows go on. No current organization ⇒ the whole import is refused 400NO_ACTIVE_ORGANIZATION. Narrowing ⇒ L1 + L2 + Tier H.Seat reading on the one point the option text leaves open (an execution detail, within the maintainer's veto window): a CSV row that matches an existing user is joined to the current organization too, under the same rule (refused ⇒ that row reports it, no invitation). One rule per row keeps the two doors alike, and a re-import after the cap is raised then heals the rows that were refused.
objectstack-fleet commentedon Nov 17, 2026
repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz
Claim: PM loop (area o2-D, repo:objectstack#2; built in a card thread that reports to the area; the card thread adds its Thread session and Branch below this claim when it starts)
Session:
session_01ADHkmRXuRn93HphKp7kXEzAccount:
os-steveBranch: named by the card thread on its first post (
claude/project-thread-*)Domain:
domain:serverSeat:
repo:objectstack#2File surface:
packages/plugins/plugin-auth/src/admin-import-users.ts(each row joins the importing admin's current organization in the unit of work that creates or matches its user; refused join ⇒ no account, no invitation, refusal on the row; no current organization ⇒ whole request400 NO_ACTIVE_ORGANIZATION),admin-user-endpoints.ts(joinCurrentOrganization/ the multi-org predicate reused, not copied; only if it needs a non-throwing or per-row shape),auth-plugin.ts(wiring), their tests,content/docs/permissions/authentication.mdx,ui/packages/app-shell/src/views/IdentityImportPanels.tsxand i18n packs only if the import result's new row field is shown,.changeset/(stop on breach).docs/adr/0093-*.md(the D3 amendment sentence on imported users) is outside an implementing card's surface: the card thread names the sentence and the seat files the ADR edit (large-card-order).Container & model:
L, card thread,effort: highClause-②: no (narrowing)
Metadata-protocol: none
Responsibility: ruling 6942842013 (maintainer B, 2026-11-17T08:25Z, and the seat's reading on matched existing users); ADR-0093 D3 amendment (the single-create rule: a refused join creates no account)
Thread-read: 6942842013
Premise: holds (on origin/main dc66d33
admin-import-users.tscreates throughauthApi.createUserwith no join;reconcile-membership.tsbinds nothing in multi mode; create-user joins viajoinCurrentOrganization)Serial constraints cleared: PR #34531 (#33113) and #34649 (#34536) on the same file merged. No open PR touches
plugin-auth/src/admin-import-users.ts,admin-user-endpoints.ts,auth-plugin.tsordocs/adr/0093*(open PR file lists read at 08:47Z).Pre-claim lane:
domain:server; large-card trigger: a narrowing (a filemainanswers200for is refused whole without a current organization, and a refused-join row no longer creates its user) ⇒(narrowing)BREAKING, ADR-0087 disposition, contract-tier L2, dogfood battery on the PR head, landing through the seat's governed step.Pre-claim deps: no
Blocked-by:line.Prior rulings read: ADR-0093 D3 amendment (2026-10-24) and D1, ruling 6942842013, ruling 6920428750 (#33113, per-row positions), area options 34535-options.md; thread: none; repo: objectstack-ai/objectstack
objectstack-fleet commentedon Nov 17, 2026
repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz
Claim registration · #34535 (claim 6943200727)
Thread session:
session_01ADHkmQ6fcQhYhhjvBoSuKnBranch:
claude/project-thread-55tnytobjectstack-fleet commentedon Nov 17, 2026
repo:objectstack#2 · os-steve · session_01ADHkmQ6fcQhYhhjvBoSuKn
os-dev-report
{ "issue": 34535, "status": "done", "pr": "https://github.com/objectstack-ai/objectstack/pull/34750", "head": "6bfc975899a1ed10282cfe967eb01ed3ad7e8ea8", "branch": "claude/project-thread-55tnyt", "session": "session_01ADHkmQ6fcQhYhhjvBoSuKn", "gates": "local: dispatch-gates --commands derived 108 on 6bfc9758, 108/108 exit 0, --ran: 108 derived, 108 run, 0 NOT-MEASURED, 0 UNRUN (file objectstack-seat2/34535-gates-ran.txt); plugin-auth test 282 files / 5916 passed, typecheck exit 0; dogfood battery on 870ce227 (docs-only delta to final head) VERDICT command-exit 0, Test Files 478 passed | 3 skipped, Tests 4057 passed | 68 skipped; CI on 6bfc9758 read at hand-back: required contexts green except Test Core shards still in progress", "dogfood_battery": "870ce227 · VERDICT command-exit 0 (42m07s) · Test Files 478/481 (3 skipped) · Tests 4057/4125 (68 skipped) · no failures; final head adds only a docs anchor line no dogfood test reads", "line_budget": "n/a — no skills/** or governed text touched", "deviations": [ "packages/qa/dogfood/test/create-user-organization-join.dogfood.test.ts is outside the claim's named test paths: it is the existing real-engine harness for this exact join, so the I1/I2 pins went there (AGENTS.md shared-harness rule)", "Three refusal cells beyond the ruling text, all create-user's same rule and accepted by the area before coding: 501 whole when no unit of work or no addMember; dryRun refused whole with no current organization; an upsert-matched user's profile update rolls back with a refused join", "dogfood battery ran on 870ce227; the final head 6bfc9758 differs by one docs anchor line", "a mis-scoped redirect wrote the gate list to /gates-cmds.txt and /gates-cmds.err at the container root (outside the repo; not removed, the removal was refused by the safety check)" ], "files_changed": [ ".changeset/34535-import-users-current-organization.md +21 -0", "content/docs/permissions/authentication.mdx +13 -0", "packages/plugins/plugin-auth/src/admin-import-users-manager-pass.test.ts +253 -4", "packages/plugins/plugin-auth/src/admin-import-users.ts +112 -14", "packages/plugins/plugin-auth/src/admin-user-endpoints.ts +76 -40", "packages/plugins/plugin-auth/src/auth-plugin.ts +11 -0", "packages/qa/dogfood/test/create-user-organization-join.dogfood.test.ts +66 -0" ], "security_findings": "none", "api_writes": "3 — pr_create (#34750), issue_patch (#34750 body), this os-dev-report comment", "mcp_calls": "5 — issue_read x2, pull_request_read x3 (get_check_runs, get, get_check_runs)" }Stamped 2026-11-17T10:53Z.
Generated by Claude Code
objectstack-fleet commentedon Nov 17, 2026
repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz
File surface amended · #34535 · 2026-11-17T11:02Z (claim 6943200727, registration 6943280954; PR #34750 at
6bfc975899a1ed10282cfe967eb01ed3ad7e8ea8; card report 6945990787; L1 ACCEPT 6946152446)One path joins the surface, a forced move the area accepts:
packages/qa/dogfood/test/create-user-organization-join.dogfood.test.ts: the existing real-route, real-walled-posture harness for create-user's organization join. The dogfood pins for this card (I1: three rows under a membership cap of 3, the third refused and its account gone fromsys_user; I2: no current organization ⇒ 400, no user) belong in that shared harness rather than a new file under the claim'splugin-authtest paths.Nothing else moves; the PR's other six paths are inside the claimed surface. Declarations unchanged:
Clause-②: no (narrowing),Metadata-protocol: none,Skills-docs: none, ADR-0087not-required (no-migration-prescription). Review: L1 accepted on this head; contract-tier L2 in review; landing through the seat's governed step. The ADR-0093 D3 sentence is carded as #34809.objectstack-fleet commentedon Nov 17, 2026
repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz
Hand-off · 2026-11-17T12:39Z · repo:objectstack#2 → repo:objectstack#3 (maintainer order 2026-11-17 12:33–12:34Z)
pm:awaiting-merge).6bfc975899a1ed10282cfe967eb01ed3ad7e8ea8.activity-text-predicate.dogfood.test.ts), inherited from the speculative stack rooted at fix(audit): a search the server widens never names a column the caller may not query #34817 (anchor Queue-flake anchor: test/activity-text-predicate.dogfood.test.ts #34829); this PR's diff does not touch that surface. Re-enqueue after fix(audit): a search the server widens never names a column the caller may not query #34817 is fixed or leaves the queue. No code change owed.Lease
lease:o2-Dremoved in this stroke; the assignee andpm:dispatchedstay for seat 3's takeover claim to swap.