Skip to content

fix(platform-objects): hide Resend Invitation on a cloud-managed environment - #33956

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

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-ba2tq8

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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

维护者速读

  • 改了什么:「重新发送邀请」(Resend Invitation) 在云托管环境里不再出现,和「邀请用户」的四处入口、「复制邀请链接」一样隐藏;非托管环境照旧显示。
  • 为什么改:托管环境的成员只从身份提供方进入,邀请接口在托管环境一律返回 409,重新发送也不例外;按钮留着只会让管理员点了看到冲突错误。
  • 风险与回滚:只给一个操作加了一个可见性条件,并在功能开关登记表里登记;回滚即还原本 PR,无数据或接口变化。
  • 先看: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_invitation gains visible: 'features.cloudManaged != true', the same authored term the four invite_user mirrors carry. A resend is a call to POST /api/v1/auth/organization/invite-member, which plugin-auth's before-hook refuses on a cloud-managed environment with 409 RESOURCE_CONFLICT whatever the body says, resends included. The lowered predicate becomes ((features.cloudManaged != true) && INVITE_REACH) && features.organization != false, matching the mirrors.
  • PUBLIC_AUTH_FEATURES.cloudManaged.gatedInputs books sys_invitation.actions.resend_invitation, as feature-gate-guard.test.ts requires of every features.* reference (its reverse walk reds an unbooked one; its forward row now holds the action to the gate).
  • Root changeset .changeset/33758-hide-resend-invitation-cloud-managed.md: patch on @objectstack/platform-objects and @objectstack/spec.

Tests

  • New block in 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 its expires_at while managed, offered on both as before when the flag is off, and still hidden when organization is off.
  • Forced test edit: platform-objects.test.ts, the lowering row for SysInvitation.resend_invitation now expects the managed term first (((MANAGED) && INVITE) && ORG), the same shape as the invite_user rows. The row pins the served predicate byte-for-byte, so it has to move with the gate.
  • Not edited: invitation-delivery-copy.test.ts keeps its "Resend stays offered on a pending row past its expires_at" pin green unchanged (it evaluates with cloudManaged unset, which reads as unmanaged).

Acceptance notes

  • resend_invitation carries no status term 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.mjs on sys-invitation.object.ts: the line visible: 'features.cloudManaged != true', under resend_invitation removed (anchor x1 to x0, marker ABLATED-33758 x0 to x1, blob 81560437a0c7 to 72d6a4077144). No build step: the three suites import the object from src/ by relative path.

× sys_invitation.actions.resend_invitation is gated on cloudManaged          (feature-gate-guard forward row)
× SysInvitation...#resend_invitation lowers to the previous hand-written predicate  (platform-objects.test.ts)
× is hidden on an unexpired pending row while the environment is cloud-managed
× is hidden on a pending row past its expires_at while the environment is cloud-managed
Tests  4 failed | 310 passed (314)
os-verify-lock: VERDICT command-exit 1
ablation-replace: ok restored: blob == HEAD (81560437a0c7) and `git diff HEAD` is empty

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
pnpm --filter @objectstack/platform-objects build && test && typecheck
 Test Files  122 passed (122)
      Tests  1999 passed (1999)
os-verify-lock: VERDICT command-exit 0
pnpm --filter @objectstack/spec typecheck && vitest run src/kernel
 Test Files  65 passed (65)
      Tests  1487 passed (1487)
os-verify-lock: VERDICT command-exit 0
Derived gates (dispatch-gates --commands, 87 commands)

Run at head 8883bc6, each exit captured before any pipe, reconciled with dispatch-gates --ran:

Run reconciliation — 87 derived, 85 run, 2 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 87 derived famil(ies) accounted for — 85 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3).
  • 85 exit 0, none red. pnpm check:i18n and pnpm check:lean-entry-closure first 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)).
  • NOT MEASURED, reason: node scripts/check-plugin-teardown-shape.mjs --self-test (its positive control is pinned to a commit outside this shallow clone; checker-health only) and pnpm check:dual-build-cjs-loads (reads every package's built output; a full pnpm build is CI's). Both run in CI's Lint & Repo Gates.

Generated by Claude Code

…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>
@github-actions github-actions Bot added size/s 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 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/platform-objects, @objectstack/spec, touching 1 documentable anchor(s).

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

  • content/docs/protocol/objectui/actions.mdx (via cloudManaged (symbol, a field of const object PUBLIC_AUTH_FEATURES))
What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 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 — 173 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 bc6b7ffd454ba9c2c420975c84a400779cb02262 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 5d2149f9fa2dae4dfe3a2acd91f98927118d75b9 — the merge of head 3e0188a72d7d3258a40489bc0aa36cfa3344d515 into base bc6b7ffd454ba9c2c420975c84a400779cb02262, 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 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

⚠️ 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 bc6b7ffd454ba9c2c420975c84a400779cb02262 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 8883bc6e553de0150f8d3850926e6a253730af00
Local-runs: none
Scope: packages/spec/src/kernel/public-auth-features.ts + packages/platform-objects/src/identity/sys-invitation.object.ts

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 main at merge-base 895783a1), and the check-runs on the head. The remainder of the diff (cloud-managed-visibility.test.ts, platform-objects.test.ts, the changeset) is the lane seat's ACCEPT at TIER_DEFAULT and is not judged in ④; the two test files were read only as the enforcement of the booking.

Check-runs on the head, read at 2026-11-15T15:01Z: 20 success, 11 skipped, 0 failed, 32 still in_progress. Concluded green: Check Changeset, PR-body guards, Governed Surface Queue Guard, Spec property liveness, Lint · PM dispatch-gates, Lint · repo & tooling gates, Lint · ESLint, Type Check · source gates, Dogfood Regression Gate. Not yet concluded: Test Core (1/8 to 8/8), Test UI (1/16 to 16/16), Build Core, Type Check · workspace, Type Check · consumer gates, Type Check · debt ledger, Type Check UI, Lint · CI, release & engine gates, Build & E2E UI, Live E2E UI. The test shards that hold this change's pins (feature-gate-guard.test.ts, platform-objects.test.ts, cloud-managed-visibility.test.ts) are among the unconcluded ones, so this record does not report them green; nothing was run locally in their place. The verdict below is the design judgment on this head; a red on any of those runs is the merge queue's refusal and is not covered by it.

① Derived judgments

  • Accept set: unchanged. No zod schema, no authorable key, no accepted value moves. PublicAuthFeatureEntry, PUBLIC_AUTH_FEATURE_NAMES and featureGatePredicate are untouched; requiresFeature still names the same closed flag set. Right.
  • Public surface: PUBLIC_AUTH_FEATURES.cloudManaged.gatedInputs gains one string, sys_invitation.actions.resend_invitation. The export set of @objectstack/spec/kernel is the same (api-surface/kernel.json and export-origins/kernel.json list names, and neither is in the diff). The const's literal tuple type grows by one member; no consumer in the tree indexes that tuple by position (the only reader of gatedInputs is feature-gate-guard.test.ts, which iterates). Right.
  • Served metadata: sys_invitation.resend_invitation's lowered visible goes from INVITE && ORG to ((features.cloudManaged != true) && INVITE) && ORG, the shape of the invite_user row beside it. This narrows where a platform action is offered on one deployment mode; it is not something a metadata author writes. Right.
  • Served /auth/config: unchanged; the flag was already served and classified. Right.

② Semver level

patch on @objectstack/platform-objects and @objectstack/spec, with Metadata-protocol: none: correct. Both packages publish a changed file, no authorable key or accepted value moves (kind none takes patch), and Check Changeset concluded success on the head.

Clause-②: no. The plain arm is the right one: (narrowing) is the BREAKING arm for a declared capability taken away at the consumer, and nothing is taken away here. The door POST /api/v1/auth/organization/invite-member already refuses every call on a cloud-managed environment (below), so the action removed from the row is one that could only answer 409. The PR body and the changeset body both carry the line, and PR-body guards concluded success.

③ Boundary flags

  • open_questions: empty in the os-dev-report. Nothing to answer.
  • out_of_scope_findings, one entry (carrier: none): resend_invitation carries no status term of its own, the rows it appears on being decided by the list views that project it. Answered: true on main before this PR and unchanged by it, and the card asks for the managed gate only. Not a defect of this diff; no card owed by this record.
  • security_findings: none. Agreed: visible is courtesy, and the enforcement is the server refusal, which this diff does not touch.
  • Forced test edit (platform-objects.test.ts, the resend_invitation lowering row): legitimate. The row pins the served predicate byte for byte, so it must move with the gate, and it moves to the same shape as the invite_user row above it.
  • Two NOT-MEASURED gate families in the dev's local reconciliation (check-plugin-teardown-shape --self-test, check:dual-build-cjs-loads): neither reads a file this diff touches; both belong to CI runs, of which Lint · repo & tooling gates is green and Build Core is unconcluded (see above).

④ Design judgment

packages/spec/src/kernel/public-auth-features.ts (hits). The booking is held against the contract the file states for gatedInputs and against its one consumer, packages/platform-objects/src/feature-gate-guard.test.ts:

  • Path grammar: sys_invitation.actions.resend_invitation matches the action form, and the action exists on the object under that name.
  • Forward row: the guard requires the target's lowered visible to carry featureGatePredicate('cloudManaged'), which is features.cloudManaged != true for a hide-when-on flag, as one && conjunct. The authored visible is exactly that string, and the lowered form ((gate) && INVITE) && ORG is the fourth positive case of the guard's own matcher table. Holds.
  • Reverse row: every features.* reference in a visible must be booked under its flag. Without this line the new term would be unbooked; with it, both references on the action (cloudManaged, organization) are booked, organization already at line 148. Holds, and the booking is necessary, not decorative.
  • The entry's notes sentence, "Each gated input is also gated on organization or admin, so its visible predicate carries two gates", stays true: this input carries organization.
  • SHOWN_WHEN_ON is not touched and must not be: this input is hidden while the flag is on, the one polarity the registry models.
  • The inline comment, "A resend is a call to invite-member, which refuses it here", was checked against the code it cites. auth-manager-before-hook.ts (on main, around L751 to L770) throws APIError('CONFLICT') with CLOUD_MANAGED_REFUSAL_CODE for ctx.path === '/organization/invite-member' && isCloudManaged(), a path-only match placed ahead of the vendor handler precisely because better-auth answers resend: true before it consults beforeCreateInvitation. The comment there names this very action as the console's route into that branch. The claim holds.
  • Placement between the four mirrors and copy_invitation_link leaves the mirrors' comment block describing four entries, and the new line has its own comment. The organization block's neighbouring comment, "same gates as resend", is still accurate.

packages/platform-objects/src/identity/sys-invitation.object.ts (implementing). Read sentence by sentence against the contract:

  • visible: 'features.cloudManaged != true' is byte-identical to the term on sys_invitation.invite_user (L88) and to the leading conjunct of copy_invitation_link, so the three admin-side invitation doors of the object now agree; cancel_invitation stays offered, which is right, since cancelling a pending row is not an invite-member call and is not refused.
  • Fault direction: an action's visible is fail-soft, so a console holding no cloudManaged key keeps Resend shown, the same answer as the flag being off and the same as its siblings. No new way to hide the action off a managed environment.
  • The comment's two claims, that the mirrors and copy_invitation_link are hidden the same way and that the refusal is in auth-manager-before-hook.ts with resends included, are both true in the tree.
  • Attempts to break it: (a) a second door for a resend that is not refused, so that hiding the button would remove something that works: none, auth-route-ledger.ts has organizations.invite and organizations.invitations.resend both target the one refused route; (b) the gate landing under a disjunction after lowering, where it would gate nothing: no, the lowering row pins it as a top-level conjunct group; (c) the action being offered on a row where Resend is the only remedy on a managed environment: no, an expired pending row's resend is the same refused call.

No must-fix, no should-fix. No nit.

Implemented-by: claude/project-thread-ba2tq8
Reviewed-by: session_01ADHkmT2NE3iyG1o6TDg3sf

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

Red check read · Test UI (4/16) on 8883bc6e · 2026-11-15T15:08Z

Signature: packages/app-shell/src/views/studio-design/StudioDesignSurface.navItemInspectorKeys-26740.test.tsx > objectstack#26740 — each declared key is authored, spelled as the spec spells it, and the entry parses > object › filtered slice: \filters` as a record of field to value—TestingLibraryElementError: Unable to find an element by: [data-testid="nav-filter-value-status"]` (job 132851575342; 1 failed | 421 passed files).

First read: not this PR's. Three facts:

  1. The failing file's import closure is disjoint from the diff: it imports @objectstack/spec/ui, @object-ui/components, @object-ui/layout, @object-ui/types and app-shell's Studio modules; this PR changes packages/spec/src/kernel/public-auth-features.ts and packages/platform-objects/** only.
  2. The base is green: ci.yml push runs on main 895783a1, 64807a9c, 63e47fee all concluded success, and Test UI shard 4 is green on the sibling PRs fix(plugin-list): on a phone the list toolbar keeps the view name readable #33957 and fix(plugin-grid): Tab leaves the import wizard's Save-current reason again #33960.
  3. The first error is a findBy/waitFor timeout (element never appeared), not a value assertion.

No ledger card names this signature (search navItemInspectorKeys, nav-filter-value-status: 0 open hits). Action: one re-run of the failed job through rerun-failed.mjs once the run concludes. If the same signature fails again, it is filed as a flake card in domain:ui and not re-run.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

席位核对

Verdict: ACCEPT · head 8883bc6e · 2026-11-15T15:38Z

  1. Shape. Draft → main, Fixes #33758. 5 files on the claimed surface (claim 6895913757): sys-invitation.object.ts gives resend_invitation visible: 'features.cloudManaged != true' (the siblings' gate); packages/spec/src/kernel/public-auth-features.ts books it in cloudManaged.gatedInputs; pins in cloud-managed-visibility.test.ts (managed hidden on both pending-row shapes, unmanaged offered, organization gate kept); one forced lowering-matrix row in platform-objects.test.ts; one changeset (@objectstack/platform-objects + @objectstack/spec patch).
  2. Premise. Held on 895783a1 (the seat's own read before dispatch and the dev's).
  3. Contract record. CONTRACT_REVIEW_TIER PASS 6896513034 on this head: no must-fix, no should-fix, no nit. Clause-②: no without an arm, Metadata-protocol: none, patch on both packages confirmed there.
  4. Gates on 8883bc6e (latest attempt): 67 check runs, 56 success, 11 skipped, none failed. The one red on attempt 1 (Test UI (4/16), StudioDesignSurface.navItemInspectorKeys-26740 › filtered slice, a findBy timeout outside this diff's import closure) was read in 6896609137 and passed on its single re-run (attempt 2). Locally the dev ran 85/87 derived gates exit 0 (2 NOT MEASURED, named in the report) and ablated the term red (4 rows).
  5. K. 9 first-parent commits on main since the merge base (< 15).
  6. Governed. check-governed-merges --pr 33956: NOT governed; 58 changed lines.
  7. Deviations / out of scope. Forced test edit named above, accepted. The report's one out-of-scope note (no status term on resend) predates this PR; the record judged it unchanged; no card. Skills-docs: not owed.
  8. Serial. PR fix(platform-objects): offer Ban / Unban without the better-auth admin plugin #33989 (Setup: Deactivate and Reactivate are hidden without the admin plugin, though both doors now work there #33759) also edits public-auth-features.ts (the admin block) and platform-objects.test.ts (other rows): different regions; the later lander merges main.
  9. Landing. Held: this seat's --land is refused by the session's auto-mode classifier until the maintainer approves landing in the seat thread (same hold as PR fix(plugin-list): on a phone the list toolbar keeps the view name readable #33957, 6896702944).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

Regen-provenance: 6896513034 · 8883bc6e553de0150f8d3850926e6a253730af00 → 3e0188a72d7d3258a40489bc0aa36cfa3344d515 · unexplainedPathsBetween(from, to, base=origin/main) → (empty)

The head moved only by a merge-only sync of origin/main (K was 27 at 2026-11-15T16:17Z; relay pr_update_branch, two-parent merge commit 3e0188a7, no conflict, the PR's own delta unchanged), so the contract review record 6896513034 carries to 3e0188a7. Landing waits for the re-run on this head to go green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 8883bc6e was synced with origin/main by a merge-only relay pr_update_branch (K was 27); the PR's own delta is unchanged and the contract review record 6896513034 carries to this head (Regen-provenance: 6897497844). This stroke: pr_ready + automerge_enable on head 3e0188a7 · 2026-11-15T16:49Z.

Reading Value
Queue membership not queued before this stroke; mergeable_state clean; 67 check runs on 3e0188a7: 56 success, 11 skipped, 0 failed; check-governed-merges: NOT governed
origin/main b4ce310b88; K = 14 first-parent commits since the merge base (< 15, no sync owed)

State change: on MERGED, Fixes #33758 closes the card; the seat then removes pm:dispatched and the assignee there.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 16:50
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit db3bbd3 Nov 15, 2026
68 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-ba2tq8 branch November 15, 2026 17:22
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…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>
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/s tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup: Resend Invitation is offered on a cloud-managed environment, where its door refuses with 409

2 participants