Repository navigation
fix(service-automation): a runAs:'user' run carries its user's posture rung, so a platform administrator's flow is served the ledger's deployment-level rows - #28098
Conversation
…e rung Run setup takes the rung off the resolution it already makes for the run's user (resolveUserAuthzGrants' own posture, forwarded by the grants bridge), seeds it beside the positions and permission sets it was derived from, and every data node carries it to the data engine. A context that brought its own grants gains no rung; the decision switch drops the submitter's rung. A flow run as the platform administrator is now served the ledger's deployment-level rows, as their request is. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwHfcrFZ8RzH1TiP48
📓 Docs Drift CheckThis PR changes 1 package(s): ⛔ 3 release-owned page(s) name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 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 bfcd6c872b87cd732869de14fa88b3f8b04c6aec && git checkout bfcd6c872b87cd732869de14fa88b3f8b04c6aec
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6410029d1bb550a13429ec83f22eff523300de26 cfd3bf44b48c50445029fb6b65e90b4015e49025 && git checkout -B drift-repro 6410029d1bb550a13429ec83f22eff523300de26 && git merge --no-ff cfd3bf44b48c50445029fb6b65e90b4015e49025
node scripts/docs-audit/affected-docs.mjs --json 6410029d1bb550a13429ec83f22eff523300de26
|
|
domain:server#3 · os-elon-musk · session_016WV4czuTWNgKR22fKv7jia Contract-review-claim: The lane seat writes the |
|
domain:server#3 · os-elon-musk · session_016WV4czuTWNgKR22fKv7jia Contract reviewServed-tier: Owed on the declaration face alone ( ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: PASS |
|
domain:server#3 · os-elon-musk · session_016WV4czuTWNgKR22fKv7jia Seat ACCEPT · PR #28098 · head
|
Requested by Elon · project thread
Fixes #28070
Clause-②: yes (widening) —
RunIdentityContext(barrel-exported), and so the data contextresolveRunDataContextanswers, gains an optionalposturemember, andFlowUserGrantsgains one; arunAs: 'user'run seeded withPLATFORM_ADMINis served the rows that rung admits.Metadata-protocol: none
Skills-docs: updated here (
content/docs/permissions/record-view-auditing.mdx, one sentence beside #26750's).grep -rn -i "posture" skills/objectstack-automationandgrep -n -i "runAs" content/docs/automation/flows.mdx: no text states which facts arunAs: 'user'run carries beyond positions / permissions / tenant, so nothing else to change.维护者速读
runAs: 'user'的自动化运行现在带上运行用户的姿态等级(posture rung),取自请求路径同一次resolveUserAuthzGrants解析,本包不做第二次推导。以平台管理员身份运行的流程,能读到审计账本里的部署级记录(tenant_id为空),和他本人的请求一致。singleposture, does an organization-scoped audit-ledger reader also read deployment-level ledger rows, or are those for the platform administrator only? #26750 之后部署级记录只给PLATFORM_ADMIN,而运行上下文没有 rung,平台管理员的流程只看到组织行(收窄,不是泄露)。分诊裁定:走同一推导、不另起一套。runAs: 'system'不变。回滚即 revert,无数据迁移。packages/services/service-automation/src/run-resume.ts(seedRunGrants与裁决切换各一处)、runtime-identity.ts(resolveRunDataContext的 user 分支)、新测试runas-user-posture-rung.integration.test.ts。pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/runas-user-posture-rung.integration.test.ts,预期 12 条全绿。What changes
plugin.ts). The grants bridge the automation plugin wires already calls@objectstack/core'sresolveUserAuthzGrantsfor the run's user; it now forwards that resolution's ownposturebeside the positions, permission sets, peers and email. Nothing in this package derives a rung.run-resume.ts,seedRunGrants). The rung is seeded exactly when the run's positions and permission sets are resolved at setup (theneedsGrantsbranch), so it always stands beside the grants it was derived from. A context that brought its own grants (a door's pre-resolved envelope, an agent's narrowed ceiling) gains no rung from a re-resolution, though it still gains its peers and email as before.run-resume.ts,deciderSegmentContext). The submitter's rung is deleted with their other facts; the decider's segment is seeded with the decider's own. Without the delete, a decider the resolver answers nothing for would have kept a platform administrator's rung.runtime-identity.ts).SeededRunContext.postureandRunIdentityContext.posture(both typedAuthzPosturefrom@objectstack/spec/security);resolveRunDataContext's user arm carries the seeded rung throughrunPosture, which drops a value that names no rung. The system arm is untouched.engine.ts, two small hunks).FlowUserGrants.posture, typed asSeededRunContext['posture']so no import hunk; theseedRunGrantsdocblock (its contract) names the rung.Why
Triage
6522159967: arunAs: 'user'run derives its rung through the same derivation a request uses, for the user it runs as, with no second derivation. Re-measured onmain@549203d0:grep -n posture packages/services/service-automation/src/run-resume.tshit only two unrelated comments (lines 314, 820; tenancy posture), and the control test below shows the administrator's request without the rung (the shape a run carried) served the organization row only.Verification
Head
cfd3bf44.runas-user-posture-rung.integration.test.ts, 12 tests, two layers. Envelope (bare engine, recording node, resolver stub): the rung rides the data context for a user-only trigger, for a member, after an approval decision (the decider's), and is absent for carried grants, for a value that is not a rung, for a decider the resolver answers nothing for, and onrunAs: 'system'. Real stack (ObjectKernel, ObjectQLPlugin, driver-sql on better-sqlite3, identity objects, SecurityPlugin, AuditPlugin's ledger read gate, the plugin's own bridge,singleposture): the platform administrator's run is served every deployment-levelplatform_admin_standing_changerow plus the organization's one; an organization holder ofview_all_audit_logis served the organization row only, by run and by request, with or without the rung; arunAs: 'system'run is served all, as before.if (posture) out.posture = posture;disabled inruntime-identity.ts: 4 red (the card's reproduction, plus three envelope cells); the member and system pins stay green (unchanged).delete switched.posture;removed inrun-resume.ts: 1 red (the unresolved decider keeps the submitter's rung).pnpm --filter @objectstack/service-automation typecheck: exit 0.pnpm --filter @objectstack/service-automation test: 228 files, 2888 tests, exit 0.dispatch-gates --commandsderived 93 families; they andpnpm lintare running locally. The reconciled--ranresult goes in the os-dev report on the card; CI runs every family here too.Acceptance notes
packages/runtime/src/domains/automation.ts:204-205) and the action door (packages/runtime/src/action-execution.ts:2077-2078) forward the request'spositions/permissionsbut notec.posture, so a flow started there carries grants and no rung, and still fails closed for the rung's readers. Forwarding it touchesAutomationContext(packages/spec/src/contracts/automation-service.ts) or the door's extra-key shape. The changeset and the docs sentence say so.ExecutionContext.postureon a run (plugin-sharinghasPlatformAuthority, plugin-approvals' platform arm, observability's timing exposure): a platform administrator's run now answers as their request does. plugin-security's tenant-wall exemption already enforced the narrower of the carried rung and its capability probe, so a seeded rung never widens it.Human Minimum
packages/specholds no runtime logic. (Nopackages/specchange.)pnpm lintpasses. (Running locally with the gates; CI reads it.)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.维护者速读block is the maintainer's summary, as on the lane's other PRs.)🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cwHfcrFZ8RzH1TiP48