Repository navigation
fix(platform-objects): hide Resend Invitation on a cloud-managed environment - #33956
Conversation
…ronment A resend is a call to invite-member, which a cloud-managed environment refuses with 409; give resend_invitation the features.cloudManaged gate its siblings carry and book it in PUBLIC_AUTH_FEATURES.cloudManaged. Claude-Session: https://claude.ai/code/session_01ADHkmSvqbEXcD82ahq7W2C Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 173 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 5d2149f9fa2dae4dfe3a2acd91f98927118d75b9 && git checkout 5d2149f9fa2dae4dfe3a2acd91f98927118d75b9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bc6b7ffd454ba9c2c420975c84a400779cb02262 3e0188a72d7d3258a40489bc0aa36cfa3344d515 && git checkout -B drift-repro bc6b7ffd454ba9c2c420975c84a400779cb02262 && git merge --no-ff 3e0188a72d7d3258a40489bc0aa36cfa3344d515
node scripts/docs-audit/affected-docs.mjs --json bc6b7ffd454ba9c2c420975c84a400779cb02262
|
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf Contract reviewServed-tier: Inputs read: card #33758 (body, the Claim 6895913757, the os-dev-report 6896465232; no ruling and no earlier record on the card), PR #33956 (body, 5 files, net diff against Check-runs on the head, read at 2026-11-15T15:01Z: 20 ① Derived judgments
② Semver level
Clause-②: no. The plain arm is the right one: ③ Boundary flags
④ Design judgment
No must-fix, no should-fix. No nit. Implemented-by: VERDICT: PASS |
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf Red check read ·
|
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf 席位核对Verdict: ACCEPT · head
|
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf Regen-provenance: 6896513034 · The head moved only by a merge-only sync of |
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf 落地Landing approved by the maintainer in the seat thread at 2026-11-15T16:10Z ("批准席位 本班复核通过的 PR 执行 --land"). The ACCEPT head
State change: on MERGED, |
…holds (objectstack-ai#33991) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbSUQWB2j9eHYsRcrCiq1X1C)_ Fixes objectstack-ai#33200 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - **改了什么:** 「设置上级」(Set Manager) 现在只拒绝真正由 SCIM 目录同步的人;只通过 SSO 登录、背后没有目录的人,管理员可以照常改上级。按钮对平台管理员在每一行用户上都显示。 - **为什么改:** 托管环境里第一次通过平台 SSO 登录的人都会被标成 `idp_provisioned`,旧规则把他们全当成「目录持有」,登录后上级就再也改不了,按上级流转的审批跟不上组织调整。按裁决记录 6895645364 选项 A 修。 - **风险与回滚:** 只放宽:以前能成功的请求没有一个变成拒绝。SCIM 判定多读一次 `sys_scim_subject`,读失败返回 500 且不写入。回滚即 revert 本 PR。 - **先看:** `admin-set-user-manager.ts` 的 refusal 5 判断(`applyUserManagerLink`);`scim-sso-adoption.ts` 新导出的 `isHeldByScimDirectory`;`sys-user.object.ts` 的 `set_user_manager` `visible`。 - **两分钟验证:** `pnpm --filter @objectstack/plugin-auth exec vitest run src/admin-set-user-manager.test.ts`,预期 38 个全过,其中 "an SSO-only identity ... is SET like a local one" 为 200 并写入 `manager_id`。 - **需要你做的:** 无,席位落地。 ## What changes Built to the maintainer ruling recorded in 6895645364 (option A: only identities a SCIM directory holds stay locked). - **`POST /api/v1/auth/admin/set-user-manager` (refusal 5).** It refused on `sys_user.source = 'idp_provisioned'` alone. ADR-0135 D4 stamps that value on every federated link without a local password, so a person who only signs in through SSO carried it with no directory behind them. The refusal now also needs a `sys_scim_subject` row. The answer for a SCIM-held identity keeps its envelope (`403 PERMISSION_DENIED`, `details.reason: 'idp_provisioned'`), and the message says to change the manager in the directory. It no longer claims a sync would revert the value, because nothing projects the SCIM `manager` attribute onto the column today. The self, cycle, depth and cross-organization refusals are unchanged. - **One predicate, imported.** `scim-sso-adoption.ts` now exports `isHeldByScimDirectory(engine, userId)`. It is the same `sys_scim_subject` read its adoption judge already ran as condition 2, moved into an exported function. The judge calls it, and so does the endpoint. A missing `sys_scim_subject` table reads as "not held" at the endpoint. Any other read failure propagates, so the mount answers 500 and writes nothing. - **The `source` term stays a conjunct.** A SCIM-provisioned user with a local password is `env_native` under D4 and was accepted before. Requiring the SCIM row alone would have refused that user, so the endpoint still checks `source` too, and no request that was served before is refused now. - **Bulk import and demo staff.** Both run `applyUserManagerLink`, so their `manager_id` links follow the same rule with no code change. The import docblock now says who is refused. - **`sys_user.set_user_manager` visibility** is `current_user.isPlatformAdmin == true`. No column on the row says "held by SCIM", so the button is shown on every row and the endpoint refuses a SCIM-held one with its message. No new field or key. - **Lint prescription.** `os explain approval-approvers-may-resolve-empty` now says the operation refuses an identity a SCIM directory holds, and that an identity that only signs in through SSO is set like any other. The docblock in `validate-approval-approvers.ts` says the same. - **Docs.** `content/docs/automation/approvals.mdx`, `content/docs/capabilities/approvals.mdx` and `content/docs/permissions/authentication.mdx` state the narrowed refusal. - ⛔ The `idp_provisioned` stamp (ADR-0135 D4) and the password refusals are untouched. ## Tests On head `fa70eaa06`: - `admin-set-user-manager.test.ts`, refusal 5 rewritten. SCIM-held SET and CLEAR give 403 `PERMISSION_DENIED` / `idp_provisioned`, write nothing, and read `sys_scim_subject` for that user. SSO-only SET and CLEAR give 200, and `update` gets `{ id, manager_id }`. An SSO-only self-assignment is still a 400 `self_assignment`. `env_native` gives 200, also with a SCIM subject, and the SCIM table is not read. A missing table gives 200. A failed read rejects and writes nothing. - `admin-import-users-manager-pass.test.ts`: a SCIM-held row is refused with `idp_provisioned`. An SSO-only row is `linked`, and `manager_id` is written. The no-fork pin also asserts that the importer spells neither `sys_scim_subject` nor `isHeldByScimDirectory`. - `demo-staff.test.ts`: the refusal fixture is now a SCIM-held identity. - `sys-user-set-manager-action.test.ts` and `platform-objects.test.ts`: the action is offered on an `idp_provisioned` row and on the sparse face. It is hidden from a non-admin. It reads no record column, which has a positive control on the standing term. - `validate-approval-approvers.test.ts`: the new prescription is present, and the old `source 'idp_provisioned'` sentence is absent. <details><summary>Suite runs</summary> - `@objectstack/plugin-auth` full suite (locked, before the demo-staff fixture fix): 276/277 files. The one red was `demo-staff.test.ts`, whose fixture is fixed in the next commit. Re-run: `demo-staff.test.ts` + `demo-staff-provisioning.test.ts` 32/32. - Targeted: plugin-auth 3 files 76/76; platform-objects 2 files 169/169; lint 1 file 64/64. - `@objectstack/platform-objects` full: 122 files, 1994 tests passed. `@objectstack/lint` full: 212 files, 9026 tests passed. - Typecheck exit 0 for plugin-auth (all three legs, incl. `check:test-typecheck`), platform-objects and lint. - Dependent: `@objectstack/runtime` `platform-admin-action-gate.test.ts` 16/16. </details> <details><summary>Ablations (each mutation landed by ablation-replace.mjs, restored to the HEAD blob)</summary> - A1, refuse on `source` alone (the old predicate): 7 red, incl. every SSO-only pin in both endpoint and import suites. - A2, no refusal 5 at all: 4 red, incl. SCIM-held SET, CLEAR and the import row. - A3, refuse on the SCIM row alone (drop the `source` conjunct): 1 red, "env_native ... even one that owns a SCIM subject". - A4, swallow every SCIM read failure: 1 red, "a FAILED SCIM-subject read is never read as no directory". - A5, put the `record.source` term back on `visible`: 5 red across `sys-user-set-manager-action.test.ts` and `platform-objects.test.ts`. - A6, put the old lint sentence back: 1 red, "GRADES the routes". - A7, missing table rethrows: 1 red, "a missing sys_scim_subject table means no directory". </details> ## Acceptance notes - SCIM-held users stay unchangeable from both sides until the SCIM `manager` projection lands. The ruling records this and the separate card objectstack-ai#33918 carries it. - The action's `helpText` still lists the four other refusals and not the SCIM one. The endpoint message names the directory. Changing `helpText` would move nine translation bundles, so it is left as it is. - `details.reason` keeps the value `idp_provisioned` so no client keyed on it changes. Only the predicate behind it narrowed. ## Verification - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 105 derived families. 101 exit 0. 3 exit 3 (prerequisite not met, NOT MEASURED, left to CI): `check:skill-examples`, `check:dual-build-cjs-loads`, `check:i18n`. 1 not run: `check:type-check-debt`, because the verify lock was held by another run for more than 60 minutes. `--ran` reconciliation agrees. - `--tier`: no path-derived mandate. The same verdict as merged objectstack-ai#33646 and objectstack-ai#33769. - eslint on the changed `.ts` files: exit 0. `check-nul-bytes`: OK. - `git merge-tree --write-tree` of this head against `origin/main`, objectstack-ai#33956, objectstack-ai#33268 and branch `claude/area-A2-33828`: clean, no conflicted paths. Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
Requested by Steve · project thread
Fixes #33758
Clause-②: no — it narrows where one action is offered; no acceptance set or public export widens
Metadata-protocol: none
维护者速读
packages/platform-objects/src/identity/sys-invitation.object.ts(新增的visible一行)、packages/spec/src/kernel/public-auth-features.ts(cloudManaged.gatedInputs新增一条)、identity/cloud-managed-visibility.test.ts(新钉子)。pnpm --filter @objectstack/platform-objects exec vitest run src/identity/cloud-managed-visibility.test.ts src/feature-gate-guard.test.ts,预期全绿,其中 Resend Invitation 的托管隐藏用例在列。What changes
sys_invitation.resend_invitationgainsvisible: 'features.cloudManaged != true', the same authored term the fourinvite_usermirrors carry. A resend is a call toPOST /api/v1/auth/organization/invite-member, which plugin-auth's before-hook refuses on a cloud-managed environment with409 RESOURCE_CONFLICTwhatever the body says, resends included. The lowered predicate becomes((features.cloudManaged != true) && INVITE_REACH) && features.organization != false, matching the mirrors.PUBLIC_AUTH_FEATURES.cloudManaged.gatedInputsbookssys_invitation.actions.resend_invitation, asfeature-gate-guard.test.tsrequires of everyfeatures.*reference (its reverse walk reds an unbooked one; its forward row now holds the action to the gate)..changeset/33758-hide-resend-invitation-cloud-managed.md:patchon@objectstack/platform-objectsand@objectstack/spec.Tests
identity/cloud-managed-visibility.test.ts, evaluated through@objectstack/formula's CEL engine on the parsed object: Resend is hidden on an unexpired pending row and on a pending row past itsexpires_atwhile managed, offered on both as before when the flag is off, and still hidden whenorganizationis off.platform-objects.test.ts, the lowering row forSysInvitation.resend_invitationnow expects the managed term first (((MANAGED) && INVITE) && ORG), the same shape as theinvite_userrows. The row pins the served predicate byte-for-byte, so it has to move with the gate.invitation-delivery-copy.test.tskeeps its "Resend stays offered on a pending row past its expires_at" pin green unchanged (it evaluates withcloudManagedunset, which reads as unmanaged).Acceptance notes
resend_invitationcarries nostatusterm of its own; which rows it appears on is decided by the list views that project it (the pending view). Unchanged here, noted only because the card's Facts say "offered on a pending invitation row".Verification
Head: 8883bc6.
Ablation: the term removed, the pins go red (4 failed)
Mutation through
scripts/ablation-replace.mjsonsys-invitation.object.ts: the linevisible: 'features.cloudManaged != true',underresend_invitationremoved (anchor x1 to x0, markerABLATED-33758x0 to x1, blob 81560437a0c7 to 72d6a4077144). No build step: the three suites import the object fromsrc/by relative path.A first attempt was a no-op: its anchor missed (the comment line starts with
//), and the tool refused to run (ANCHOR MISS, exit 3), so nothing was measured on it. A second spelled a replacement that was a substring of its anchor and was refused for the same reason (replacement count moved 1 -> 1); restored, nothing measured. The third is the reading above.Package tests and typecheck
Derived gates (dispatch-gates --commands, 87 commands)
Run at head 8883bc6, each exit captured before any pipe, reconciled with
dispatch-gates --ran:pnpm check:i18nandpnpm check:lean-entry-closurefirst answered exit 3 (PREREQUISITE NOT MET); after the closure build each names, both re-ran exit 0 (check-i18n-bundles: OK (10 package(s) — all bundles in sync, no undeclared authoring keys)).node scripts/check-plugin-teardown-shape.mjs --self-test(its positive control is pinned to a commit outside this shallow clone; checker-health only) andpnpm check:dual-build-cjs-loads(reads every package's built output; a fullpnpm buildis CI's). Both run in CI'sLint & Repo Gates.Generated by Claude Code