Repository navigation
fix(platform-objects): Create User picks its permission set from a list, and a refused grant says in one line what to pick - #30701
Conversation
…st, and a refused grant says in one line what to pick - create_user's permissionSet param declares widget: 'permission-ref', so the action dialog draws the grant column's picker (sets listed by label, the name submitted); the stale "params do not inherit" comment is retired. - Studio's ActionPreview asks paramToField which widget the dialog draws, so an authored widget previews as the dialog draws it. - plugin-security's shared grant refusal is one business line; when the refused value is a set's label it names that set's name (agent ceiling sets never suggested). plugin-auth's Create User prefix keeps "no user was created" and hands the reason on as its own sentence. Claude-Session: https://claude.ai/code/session_016WV4cwFtiPisvhAkegNCLQ Co-authored-by: Claude <noreply@anthropic.com>
…e source Claude-Session: https://claude.ai/code/session_016WV4cwFtiPisvhAkegNCLQ Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check6 anchor(s) derived from 3 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 30 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 64b44c351f4bda1c93927f2f38a754a1451d1cf2 && git checkout 64b44c351f4bda1c93927f2f38a754a1451d1cf2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ab44ec94b0362bafdf5f610b1d121655cd39a5fa d2c87c847b27345cabccba07a6076fc1caac716c && git checkout -B drift-repro ab44ec94b0362bafdf5f610b1d121655cd39a5fa && git merge --no-ff d2c87c847b27345cabccba07a6076fc1caac716c
node scripts/docs-audit/affected-docs.mjs --json ab44ec94b0362bafdf5f610b1d121655cd39a5fa |
|
domain:server#3 · os-elon-musk · session_016WV4cytQjG9X1CrCgytUM5 ACCEPT · #30117 · 2026-11-06T00:11Z · Head-sha: 席位核对
|
Requested by Elon · project thread
domain:server#3 · os-elon-musk · session_016WV4cwFtiPisvhAkegNCLQ
Fixes #30117
Clause-②: no (no new export, error code, accept set or schema key: a platform-objects param uses the existing
ActionParamSchema.widget; the refusal keeps400 VALIDATION_FAILED/reference_not_found, only its sentence changes)Metadata-protocol: none
维护者速读
widget: 'permission-ref',就是授权表本身用的选择器);Studio 的动作预览也画成下拉,和真实对话框一致。grant-permission-set-name.ts的grantSetNotInCatalogMessage/setsLabelled,sys-user.object.ts的permissionSet参数,ActionPreview.tsx的runtimeWidgetFor。What changes
packages/platform-objects/src/identity/sys-user.object.ts.create_user's inlinepermissionSetparam addswidget: 'permission-ref'and keepstype: 'text': the action dialog (since ui: resolveActionParams and paramToField pass a param widget through, so an action dialog draws the permission-set picker (#30117 slice 2) #30260) draws the grant column's own picker, a searchable list of the permission sets each shown by its label, submitting the chosen set's name. The stale comment "its picker is a widget hint params do not inherit" is retired. The param stays inline, so the dialog never needs plugin-security metadata to open.ui/packages/app-shell/src/views/metadata-admin/previews/ActionPreview.tsx.runtimeWidgetFornow asksparamToFielditself (with the authoredwidget) which widget the dialog draws, instead ofresolveParamWidgetType(type), so the preview's answer isauthoredWidgetKey(param) ?? resolveParamWidgetType(type), the dialog's expression, by construction (note 6662463937 line 2). Apermission-refanswer is mocked as a disabled picker ("Select LABEL"); an unregistered widget name degrades to thetypecontrol, as in the dialog.paramToField.tsis not edited.packages/plugins/plugin-security/src/grant-permission-set-name.ts. The shared refusal sentence (grantSetNotInCatalogMessage) is one line:'Repair Technician' is the label of the permission set named 'asset_repair_technician': choose it from the list, or enter 'asset_repair_technician'.There is no permission set named 'xyz': choose one from the list.The catalog is listed only on a refusal (
setsLabelled); agent ceiling sets (MCP_AGENT_PERMISSION_SETS) are never suggested, the same exclusion the picker makes; a listing that throws leaves the plain sentence and is reported atwarn. A label is still never accepted as a name.packages/plugins/plugin-auth/src/admin-user-endpoints.ts.grantRefusalkeeps "The permission set was not assigned, so no user was created" and hands the reason on as its own sentence (.instead of:), so the composed answer reads as two sentences. Status, code,fieldsand the rollback are unchanged.patch, both declaration lines:@objectstack/platform-objects,@objectstack/plugin-security,@objectstack/plugin-auth,@object-ui/app-shell.Why
Before (measured at
origin/mainb77c160a)maincreate_user.params.permissionSet{ type: 'text' }, no widget{ type: 'text', widget: 'permission-ref' }ActionParamDialog.test.tsxCONTROL cell, #30260)runtimeWidgetFor→resolveParamWidgetType('text'))data-testid="action-preview-permission-ref"'Repair Technician'(Create User)The permission set was not assigned, so no user was created: Permission Set: no permission set is named 'Repair Technician'. sys_user_permission_set.permission_set takes the machine name of a permission set in the security catalog (a package's set, a built-in, or one saved through the metadata door), never a record id: write the name of an existing permission set, or declare the set first.The permission set was not assigned, so no user was created. 'Repair Technician' is the label of the permission set named 'asset_repair_technician': choose it from the list, or enter 'asset_repair_technician'.Who the picker lists
permission-reflistsGET /api/v1/meta/permissionminus the agent ceiling sets; it is not filtered per caller. Create User is visible only to a platform administrator (current_user.isPlatformAdmin), a tenant-level administrator whom the ADR-0090 D12 gate admits for every set except the agent ceilings, which the picker leaves out. So for this action's audience the listed sets are the grantable sets. The picker does not narrow per delegate on other surfaces; that is the picker's existing behaviour and not changed here.The suggestion stays inside the caller's grant reach
The name check runs only after the D12 gate admitted the write. An organization administrator or a delegate naming a value the catalog does not hold is refused by the gate itself (
delegated-admin-gate.test.ts, "not in the security catalog"), and a caller who administers nothing is refused 403 too, so neither hears a set name. Past the gate stand only tenant-level administrators. Pinned below.Verification
Tests added or changed (all green locally):
plugin-securitygrant-permission-set-name.test.ts, new describe "the refusal says, in one line, what to pick instead" (7 cells, realObjectQL+ SQL driver +SecurityPlugin): plain sentence with no developer vocabulary; label → name; case/space-insensitive match; shared label lists both; agent ceiling never suggested; caller refused by the D12 gate hears no set name (403, nothing stored); unlistable catalog still refuses with the plain sentence and warns. Every cell asserts nothing is stored. File: 23 passed.plugin-authadmin-user-endpoints.test.ts: the refusal's composed message,fieldsand rollback; the param pin addswidget: 'permission-ref'. 99 passed.platform-objectssys-user-create-user-email-required.test.ts, new top-level describe pinning the param on the SOURCE (plugin-auth's pin reads the built dist, see ablation B2). 6 passed.uiActionDesigner.paramVocabulary.test.tsx, new top-level describe (4 cells): the dialog's adapter answerspermission-ref; the preview draws the picker; CONTROL without widget is a text box; an unregistered widget degrades to the text box. 23 passed.qa/dogfoodcreate-user-permission-set.dogfood.test.ts(real showcase boot, real route): G2 pins the composed message; new G4 sends the labelShowcase Contributorand gets 400 namingshowcase_contributor, zero users. 4 passed.Ablations (old behaviour put back, red seen, restored):
Received: "Permission Set: no permission set is named 'qa_nowhere'. sys_user_permission_set.permission_set takes the machine name …").Received: "There is no permission set named 'QA Alpha': choose one from the list.").Received: "'QA Agent Reader' is the label of the permission set named 'mcp_agent_data_read': …").:joiner: plugin-auth refusal cell red.@objectstack/platform-objectsdist), which is why the source pin C1 exists; C1 red (- "widget": "permission-ref").widget: the preview picker cell red (Unable to find an element by: [data-testid="action-preview-permission-ref"]).Gates (head
b5c69de7):node scripts/pm/dispatch-gates.mjs --ranreconciles 71 derived families: 70 run, all exit 0; 1 NOT MEASURED,node scripts/check-plugin-teardown-shape.mjs --self-testexit 3 (its positive control is pinned to commit621a4876, unreachable in this shallow clone; checker-health only). Also exit 0:pnpm lint;typecheckandtestfor@objectstack/platform-objects,@objectstack/plugin-security,@objectstack/plugin-auth. Record:gates-ran-b5c69de7.txtin the seat's project folder.Skills-docs: none owed by this diff.
git grep -n "create_user\|permissionSet" -- skillshas no hit;content/docs/**has no copy of the refusal sentence.content/docs/permissions/authentication.mdx("Create a User Directly") documentscreate-userwithout the optionalpermissionSetat all, a gap that predates this PR; follow-up candidate.Deviations
packages/qa/dogfood/test/create-user-permission-set.dogfood.test.ts(test-only, outside the order's list), accepted by the seat for the end-to-end label case.ActionPreviewmockspermission-refas a picker, one key past the eightPARAM_TYPE_OPTSthe preview's mock vocabulary covered, because a text box there would still contradict the dialog.pnpm testacross the monorepo was not run; the four moved packages' suites, the ui previews/designer suites and the dogfood file were.Acceptance notes
Permission Setrow still shows the granted set's name, not its label (resultDialog.fieldspathpermissionSet); not in the card's ask.labelis the source string.ui/packages/app-shell/src/views/metadata-admin/AssignedUsersSection.test.tsxmocks a server message with the old wording as its fixture; it pins that the form shows the server's words, whatever they are, so it is left as is.Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses.main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code