Skip to content

feat(plugin-auth): serve the platform-admin roster from Setup → Users (#28793) - #29427

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-ymgvae
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-ymgvae

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Fixes #28793
Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:设置 → 用户 列表工具栏多了一个「平台管理员」入口,点开就是一张当前持有平台管理员资格的人员名单;列表本身不加列。
  • 为什么改:旧的 role 列移除后,列表上看不出谁是平台管理员;按裁决 C,用 last-admin guard 里现成的枚举器给出名单,每个人再用同一个判定 hasPlatformAdminStanding 逐个确认。
  • 风险与回滚:只读入口,只对平台管理员本人开放,组织管理员一律 403;guard 的行为不变(枚举代码原地抽成共享读取器)。回滚 = revert 本 PR。
  • 先看:packages/plugins/plugin-auth/src/last-admin-guard.ts(枚举器抽出与导出,风险点在 createStandingReader 与 standing 参数),packages/plugins/plugin-auth/src/platform-admin-roster.ts(调用者资格二次确认),packages/core/src/security/admin-standing-surface.ts(台账钉)。
  • 两分钟验证:pnpm --filter @objectstack/plugin-auth exec vitest run src/platform-admin-roster.pin.test.ts,预期 12 个用例全绿(名单与判定逐人一致、组织管理员被拒)。
  • 需要你做的:无,席位落地。

What changes

  • The enumerator is exported, not copied. last-admin-guard.ts's standing reads (scan, the ledger and Default Organization reads, anchorOwnerTest, resolveAdminUserIds) move, text unchanged, from inside registerLastAdminGuard into a module-level createStandingReader(engine, maxScan). The guard destructures them from it, so its behaviour is unchanged. The new export resolveAdminUserIds(engine, { standing, maxScan }) reads through the same reader: standing: 'administrators' (default) is the guard's population, and 'platform-admins' skips the organization owner and admin half. An overflowing read on the roster path throws the guard's existing 503 SERVICE_UNAVAILABLE read fault instead of a refusal worded for a write.
  • The route. POST /api/v1/auth/admin/list-platform-admins (auth-plugin.ts, same family as set-user-manager): gateAdmin first, then runPlatformAdminRoster (platform-admin-roster.ts). The handler confirms the caller through hasPlatformAdminStanding as well, because the shared gate still honours the legacy role scalar as a fallback and the roster names platform operators. A non-holder gets the gate's own 403 PERMISSION_DENIED body (PLATFORM_ADMIN_REFUSAL_MESSAGES[403]). It enumerates the candidates and keeps those the predicate confirms, then answers { count, admins: [{ id, name, email }], entries }. No body is read: platform standing belongs to no organization, and the console adds organizationId to every auth action. Ledgered in auth-route-ledger.ts.
  • The Setup entry. sys_user.list_platform_admins: one list_toolbar action posting to the route, visible: 'current_user.isPlatformAdmin == true' like the other platform-admin actions, refreshAfter: false, and a resultDialog drawing entries as a code-list. There is no ai block, because the action postdates the ADR-0011 identity-actions assessment and an unassessed action stays human-only. Translated in the four packs (zh-CN, ja-JP and es-ES written by hand, regenerated with check-i18n-bundles --write).
  • The ledger pin. ADMIN_STANDING_PLATFORM_ENUMERATION (admin-standing-surface.ts) names the enumerator and sorts every input of the administrator derivation into candidateSources (sys_user_permission_set, OS_PLATFORM_OWNER_EMAIL) or notCandidates. The core test holds that classification to exactly the declared deriving tables and non-table inputs. plugin-auth's platform-admin-roster.pin.test.ts requires a sole-source fixture per candidate that the enumerator finds. A third source is red at one of the two until the enumerator reads it.
  • Route shape chosen: the precedent is set_user_manager / POST /admin/set-user-manager: a type: 'api' sys_user action to an ObjectStack /admin/* mount behind gateAdmin. It is POST because ActionSchema.method has no GET member.

Forced test edits, each a list a new mount must join:

  • auth-route-ledger.conformance.test.ts: the hand-written objectstack-mount list gains the route.
  • packages/qa/dogfood/test/admin-route-nonadmin-refusal.dogfood.test.ts: the /admin/ sweep's expectation table gains the route (objectstack-gate bucket, empty body), because a derived route with no entry fails the suite by name.
  • packages/qa/dogfood/test/admin-platform-admin-standing.dogfood.test.ts: the platform-admin /admin/ sweep's ADMITTED list and payload table gain the route. Before that, the sweep failed by name on the new mount: POST /api/v1/auth/admin/list-platform-admins: expected [ Array(1) ] to deeply equal [] (unclassified). The same file gains C-28793, which pins the booted stack's answer: the platform admin's own id is on the roster, the plain-member target is not, and count and entries agree with admins.

The widening (Clause-②: yes (widening)) is a new public route plus the new exports resolveAdminUserIds and ADMIN_STANDING_PLATFORM_ENUMERATION. Nothing an existing caller relied on changed, so the level stays patch.

Tests

Package suites ran at head 6b5dd985 (origin/main merged once); the two named dogfood runs below are at 365488e5. Every run went through os-verify-lock.

  • pnpm --filter @objectstack/plugin-auth test: Test Files 212 passed (212), Tests 3655 passed, 10 skipped (3665).
  • pnpm --filter @objectstack/platform-objects test: Test Files 109 passed (109), Tests 1507 passed (1507).
  • pnpm --filter @objectstack/core test: Test Files 129 passed (129), Tests 2913 passed (2913).
  • typecheck on the three packages: exit 0 (plugin-auth's test layer is held at its ledgered 88 errors and 23 signatures).
  • Dogfood, run locally because the dogfood shards are skipped on PRs and in the merge queue (packages/qa/dogfood, built dists of plugin-auth, platform-objects and core at this head):
    • pnpm exec vitest run test/admin-route-nonadmin-refusal.dogfood.test.ts: Test Files 1 passed (1), Tests 7 passed (7).
    • pnpm exec vitest run test/admin-platform-admin-standing.dogfood.test.ts: Test Files 1 passed (1), Tests 8 passed (8). Before this head's classification it was 1 failed (the unclassified-route assertion above).
    • pnpm exec vitest run over the other files that sweep /admin/ routes, the auth route ledger, or sys_user actions and api-action doors: route-ledger-live-mount-parity, discovery-auth-families, admin-ledger-decision-metadata, api-action-door-forward, mcp-system-object-action-exposure, mcp-oauth-api-action-forward, showcase-anonymous-deny-surfaces, admin-identity-audit-trail, admin-credential-lifecycle (each .dogfood.test.ts). Run together with the standing file at 6b5dd985 (no runtime source differs from 365488e5; only the standing test and the changeset changed): Test Files 1 failed | 9 passed (10), Tests 1 failed | 147 passed (148). The 9 files account for all 141 of their tests passing, and the 1 failure was the standing file's unclassified-route assertion, which is fixed at this head.
  • New: platform-admin-roster.pin.test.ts (12 tests, real ObjectQL on better-sqlite3 with the real hasPlatformAdminStanding), sys-user-platform-admin-roster-action.test.ts (4), and 4 classification tests in admin-standing-surface.test.ts.
Ablations (each restored, blob == HEAD and git diff HEAD empty)
  1. The caller check in runPlatformAdminRoster was replaced with if (false). Four refusal cases went red, expected 200 to be 403 (org owner, plain member, unverified owner address, unknown id).

  2. The standing === 'platform-admins' ? [] : guard on the membership read was removed. the platform-admin population leaves an organization owner out went red. The roster agreement stayed green, because the predicate confirmation drops the org owner, which is the second layer working. The first attempt was refused by ablation-replace (the replacement was a substring of the anchor, so it did not land) and was redone with a distinct replacement.

  3. The owner-email half was disabled (emails.length < 0). Five went red, including agreement (expected [ 'usr_grant' ] to deeply equal [ 'usr_grant', 'usr_owner' ]) and the sole-source OS_PLATFORM_OWNER_EMAIL case.

  4. sys_member was dropped from notCandidates. The core classification test went red (the declared list holds sys_member, the classified list does not).

  5. Cross-package: a third candidate sys_ablation_third_source was added to candidateSources. Core was rebuilt, and ablation-dist-preflight showed the marker present in 2 built files. The plugin-auth pin went red: 'sys_ablation_third_source' is a declared platform-admin candidate source with no fixture here: teach the enumerator …. On restore core was rebuilt, and the preflight --absent showed the marker absent from all 14 built files with the tree clean.

  6. Live stack: the predicate confirmation in resolvePlatformAdminRoster was made unreachable (String(id) === 'ablation-28793-never' && …), and plugin-auth was rebuilt. ablation-dist-preflight found the marker in 2 built files. admin-platform-admin-standing.dogfood.test.ts went red on C-28793 only (1 failed, 7 passed): the roster omits the platform admin: {"success":true,"data":{"count":0,"admins":[],"entries":[]}}. On restore plugin-auth was rebuilt, --absent showed the marker gone from all 20 built files, and the source blob was back to HEAD. A first attempt used a comment marker, which esbuild strips (the preflight reported it absent from dist), and -t skipped the identity control. Both were void readings and both were redone.

Acceptance notes

  • A platform administrator reaches the roster from Setup → Users in one step: the toolbar entry opens the result dialog.
  • The ui renders it with no ui change (measured). A scratch render of the console's ActionResultDialog with this action's resultDialog and the route's answer drew one list row per entry, with the code text equal to entries (ui/ vitest, 1 passed; the file was deleted after the run). The rows are plain text with per-row copy and Copy all. They are not links to the user records, which would be a ui follow-up if wanted.
  • The roster agrees user by user with hasPlatformAdminStanding. The fixture holds a Default Organization grant, a verified owner address, an unverified one, an expired grant, another organization's grant held by that organization's owner, and a plain member.
  • A non-platform-admin caller is refused, an organization owner included, with the gate's 403 body and no data.
  • The Users list page's request count is unchanged: no sys_user field and no read hook are added, and the list columns stay pinned in sys-user-list-columns.test.ts.
  • Open PR overlap: fix(plugin-security): a View All / Modify All set reads every field of its object, so an app field mask no longer hides fields from admins #29387 also edits packages/core/src/security/index.ts (an export list), so expect at most a mechanical conflict there. No open PR touches last-admin-guard.ts, admin-standing-surface.ts, sys-user.object.ts or the route ledger.
  • The bucket-count prose at the top of the dogfood sweep (objectstack-gate (11 routes)) was already stale before this change (12 entries) and now reads 13. It was left alone as prose outside this diff's purpose.

Verification

Local gate battery (dispatch-gates --commands, reconciled with --ran)

Derived at 6b5dd985: 72 families, 72 run. --ran reconciliation with the recorded exit codes: 71 run, 1 NOT-MEASURED, 0 UNRUN.

  • 70 commands exited 0.
  • node scripts/check-plugin-teardown-shape.mjs --self-test first exited 3 (PREREQUISITE NOT MET: the shallow clone cannot reach its pinned positive-control commit 621a48760). After that one object was fetched it exited 0.
  • pnpm check:dual-build-cjs-loads: the self-test passes (93 cases), then the scan exits 3 (PREREQUISITE NOT MET: ten packages outside this diff's build closure have no dist/, @objectstack/studio, client-react and others). NOT MEASURED locally, because it needs a full pnpm build. It is CI's reading (Lint & Repo Gates).

Lint: eslint --no-inline-config over the 16 touched ts/mjs files, exit 0.


Generated by Claude Code

Export the last-admin guard's enumerator (resolveAdminUserIds) with a
platform-admins scope, serve its candidates confirmed by
hasPlatformAdminStanding at POST /api/v1/auth/admin/list-platform-admins
to a caller who holds that standing, add the sys_user list toolbar entry,
and pin the enumerator's candidate sources in the admin-standing ledger.

Claude-Session: https://claude.ai/code/session_01ADHkmQKiS3hSX11hKXCKNN
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/core, @objectstack/platform-objects, @objectstack/plugin-auth, touching 30 documentable anchor(s).

12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via INTERNAL_ERROR (literal, a string literal in registerAuthRoutes), SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/api/error-catalog.mdx (via INTERNAL_ERROR (literal, a string literal in registerAuthRoutes), SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/api/index.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/automation/webhooks.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/permissions/authorization.mdx (via registerLastAdminGuard (symbol, a top-level function), SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/permissions/sharing-rules.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/plugins/development.mdx (via INTERNAL_ERROR (literal, a string literal in registerAuthRoutes))
  • content/docs/protocol/kernel/error-handling.mdx (via INTERNAL_ERROR (literal, a string literal in registerAuthRoutes), SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/protocol/objectui/actions.mdx (via list_toolbar (literal, a string literal in actions))
  • content/docs/ui/actions.mdx (via list_toolbar (literal, a string literal in actions))
  • content/docs/ui/pages.mdx (via list_toolbar (literal, a string literal in actions))
  • content/docs/ui/print-pages.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))

⛔ 5 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via INTERNAL_ERROR (literal, a string literal in registerAuthRoutes), SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/releases/v17/17-3.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/releases/v17/17-4.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))
  • content/docs/releases/v17/17-7.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster), list_toolbar (literal, a string literal in actions))
  • content/docs/releases/v18/18-2.mdx (via INTERNAL_ERROR (literal, a string literal in registerAuthRoutes), SERVICE_UNAVAILABLE (literal, a string literal in runPlatformAdminRoster))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 2 anchor(s) matched too much of the corpus to be a work list: sys_user (symbol, 48 pages), PERMISSION_DENIED (literal, 51 pages)
  • 5 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 60 of 216 client-bound route-ledger rows — the other 156 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 156: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 101 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 50 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 0e0ddacda7dd4004283bd45610dfb5443dcf9ecd → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 873211988e90663a336c3f9f1e6df655943d439b — the merge of head 365488e517ed42a5afda08be6107ec5a5631da5d into base 0e0ddacda7dd4004283bd45610dfb5443dcf9ecd, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 873211988e90663a336c3f9f1e6df655943d439b && git checkout 873211988e90663a336c3f9f1e6df655943d439b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0e0ddacda7dd4004283bd45610dfb5443dcf9ecd 365488e517ed42a5afda08be6107ec5a5631da5d && git checkout -B drift-repro 0e0ddacda7dd4004283bd45610dfb5443dcf9ecd && git merge --no-ff 365488e517ed42a5afda08be6107ec5a5631da5d

node scripts/docs-audit/affected-docs.mjs --json 0e0ddacda7dd4004283bd45610dfb5443dcf9ecd

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 0e0ddacda7dd4004283bd45610dfb5443dcf9ecd → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…ep, pin its live answer (#28793)

admin-platform-admin-standing's /admin/ sweep failed by name on the new
mount (unclassified). It joins ADMITTED with its empty payload, and a
C-28793 case pins the booted stack's answer: the platform admin is on
the roster and the plain member is not.

The changeset declares Clause-②: yes (widening): a new public route and
new exports.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmQKiS3hSX11hKXCKNN
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1

维护者速读

  • 改了什么:设置 → 用户 列表工具栏多一个「平台管理员」入口,打开就是当前持有平台管理员资格的人员名单。新路由 POST /api/v1/auth/admin/list-platform-admins,只有平台管理员本人能读,组织管理员一律 403。
  • 为什么改:旧 role 列移除后,列表上看不出谁是平台管理员(裁决 C:用 last-admin guard 现成的枚举器,每人再用 hasPlatformAdminStanding 逐个确认)。
  • 风险与回滚:只读入口。guard 行为不变(枚举代码原地抽成共享读取器)。名单只会比判定窄,不会比它宽。回滚即 revert。
  • 先看:packages/plugins/plugin-auth/src/last-admin-guard.ts(createStandingReader)、platform-admin-roster.ts(调用者资格二次确认)。
  • 两分钟验证:pnpm --filter @objectstack/plugin-auth exec vitest run src/platform-admin-roster.pin.test.ts,12 条全绿。
  • 需要你做的:无,席位落地。

席位意见:与 diff 相符。第 2 轮把声明改正为 Clause-②: yes (widening)(新增路由与导出)。本地补跑 dogfood 抓到一处未登记的挂载点,已修。

席位核对

ACCEPT · domain:server seat 5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1 · 2026-11-02T14:59Z · head 365488e517 · Fixes #28793

  1. Shape: draft against main, Fixes #28793. A patch changeset for plugin-auth, platform-objects and core. Clause-②: yes (widening), Metadata-protocol: none. Not governed: 887 changed lines, 18 files. Face TIER_DEFAULT.
  2. Against the order: ruling C. The roster comes from the guard's own enumerator, and each user is confirmed by hasPlatformAdminStanding. Only a platform-admin caller may read it. No sys_user field is added. Read in the diff.
  3. Accepted deviations: two forced test edits (the conformance mount list and the dogfood /admin/ sweep table). Round 2 adds a third: the platform-admin-standing dogfood classification, plus case C-28793. Assignee os-steve follows AGENTS.md.
  4. Gates: the dev reports 72 derived gates (71 run, 1 NOT-MEASURED that CI reads); plugin-auth 3655, platform-objects 1507 and core 2913 green; typecheck 0. Dogfood runs locally, because the dogfood shards are skipped on PRs: admin-route-nonadmin-refusal 7/7 and admin-platform-admin-standing 8/8 at this head, plus 9 sweep files 141/141. Six ablations each went red. The seat readies the PR only when no check-run on this head is red or running.
  5. Out of scope: an ADR-0011 assessment of the action (it stays human-only, with no ai block). Roster rows as links (optional ui follow-up, not filed).
  6. Landing: pr_ready + automerge_enable through the relay once Lint & Repo Gates and TypeScript Type Check read success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants