Repository navigation
feat(automation): IAutomationService.dryRun runs an unpublished flow once, unarmed, as a named user - #34477
Conversation
…o a dry run for the named user (ruling B) Replaces the dryRun admission bullet that refused such a draft for every named user. The run is never elevated; a by-name start of a published flow keeps its refusal. Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe Co-Authored-By: Claude <noreply@anthropic.com>
…ission refusals Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
…s can place its delete Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
…citing the dryRun contract Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
…engine dispatch asserts, bounds after the filter and refuses combinators Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
📓 Docs Drift CheckThis PR changes 5 package(s): 68 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 19 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 187 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 c895ef1c05c7bd22683dea6b68782d53f25cf841 && git checkout c895ef1c05c7bd22683dea6b68782d53f25cf841
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ec6b5fd3464ce5413691a7cab810d1c19db50182 3392bc4f047537a787c930266530a8e72c757196 && git checkout -B drift-repro ec6b5fd3464ce5413691a7cab810d1c19db50182 && git merge --no-ff 3392bc4f047537a787c930266530a8e72c757196
node scripts/docs-audit/affected-docs.mjs --json ec6b5fd3464ce5413691a7cab810d1c19db50182
|
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5kYk6G1CvandwWbbhe Final green head:
Generated by Claude Code |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract-review-claim: session_01FEkQ5mjfxPu5HKjUtuveBR · head 2e47ef2 · 2026-11-16T22:14Z |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5mww9UksbwbjvM4aYn 席位核对 · PR #34477 · L1-b · 2026-11-16T22:17ZHead-sha: 2e47ef2(merge-base 152cd1f;16 个文件,+1525/−109;终版声明 6930971431,dev 报告 6930288123,认领面扩展 6930318716) 结论:REWORK(3 项,另有 2 条 nit) 已核对、没有问题的部分
R1 · 欠维护者对契约改动的批准,正文和声明都没写裁决记录 6917953931 的 State 节原文是:"The contract change is a spec-surface PR and owes the contract review and the maintainer's approval before the implementation lands on it."(契约改动属于 spec 面的 PR,要先经过契约评审和维护者批准,实现才能落在它上面。) 这个 PR 把 spec 改动和实现合在了一起,但是:
二选一:
R2 ·
|
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract reviewServed-tier: First record on this PR; no earlier findings. Card #33661 read through 6930318716 (ruling 6917953931, dev report 6930288123, announcement 6930971431). ① Derived judgments
② Semver levelRight. ③ Boundary flags
④ Design judgment
S1 (should-fix) — the ruling record's State section says the contract change "owes the contract review and the maintainer's approval before the implementation lands on it". The register does not govern the path, and this PR carries both the spec hunk and the implementation. The spec hunk is a contract change (a widening of one admission bullet). Whether ruling B is itself that approval, or a separate maintainer approval of this text is owed, is not mine to decide: the seat puts it to the maintainer, or records on the card why none is owed, before landing. S2 (should-fix) — S3 (should-fix) — N1 (nit) — N2 (nit) — the admission paragraph still says the rules are judged on the definition's N3 (nit) — No must-fix. Implemented-by: VERDICT: PASS |
… unread grants refuse a runAs system draft, a throwing write check is a denial, and predicate writes ask the engine's dispatch Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
…s after ruling B Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
…s the canWriteObject exception Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Claim withdrawn: head 4889de3 is a mid-round push (lane note); review#2 reads the final head of the fix round when the lane names it. |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5kYk6G1CvandwWbbhe Final green head of fix round 1:
Generated by Claude Code |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract-review-claim: session_01FEkQ5mjfxPu5HKjUtuveBR · head 4889de3 · 2026-11-16T23:55Z |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5kYk6G1CvandwWbbhe Addendum to 6933072738 · the three code items of fix round 1, each by its pin on head
Source for every line: dev report #33661 comment 6933008472. The two choices left as they are, both named in the PR body under Acceptance notes: the unread-grants refusal carries the dry run's own message, and update/delete targets by a Generated by Claude Code |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5mww9UksbwbjvM4aYn 席位核对 · PR #34477 · L1-b · delta · 2026-11-16T23:56ZHead-sha: 4889de3(对比 REWORK 6931060667 时的 2e47ef2;中间 4 个提交;终版声明 6933072738,dev 报告 6933008472) 结论:delta ACCEPT R1 已闭合 R2 已闭合,采用方案 (b)
R3 已闭合
N1、N2 都已处理
一并改进来的 review#2 项,逐条读过
CI |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract reviewServed-tier: Delta review of Earlier findings
① Derived judgments
② Semver levelRight. ③ Boundary flags
④ Design judgment
S4 (should-fix) — N4 (nit) — the published admission text names no unread-grants refusal and says each refusal carries the by-name message; this one carries the dry run's own. Accepted as disclosed; a contract sentence can follow on its own card. The pin covers a failing read only, not an empty answer or an unwired resolver. No must-fix. Implemented-by: VERDICT: PASS |
…the engine dispatch picks An update_record whose fields carry the row's id, with no filter, is a by-id write to that one row; the stand-in now reads its targets off the dispatch's own answer (by-id, multi, reject) instead of the filter alone. Pins the two unread-grants arms the admission code already covers (an empty answer, no resolver wired). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5kYk6G1CvandwWbbhe Final head of fix round 2:
Generated by Claude Code |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract-review-claim: session_01FEkQ5mjfxPu5HKjUtuveBR · head 3392bc4 · 2026-11-17T00:32Z |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract reviewServed-tier: Delta review of Earlier findings
① Derived judgments
② Semver levelRight, unchanged: ③ Boundary flags
④ Design judgment
No must-fix. No open should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5mww9UksbwbjvM4aYn 席位核对 · PR #34477 · L1-b · delta · 2026-11-17T00:33ZHead-sha: 3392bc4(只读 delta 结论:delta ACCEPT review#2 S4:写入的目标行改为直接读引擎 dispatch 的答案
review#2 N4:读不到 grants 的三种情况都钉住了 正文
CI N1(不阻塞,交席位处理) 剩余欠单不变:review#2 读这一轮 delta,然后由维护者批准 spec 那一段(裁决 6917953931),属于 Tier H。 |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5pmEYLVFDcQ1Z1CS8H 维护者速读Head-sha:
席位意见:建议批准。 席位核对
|
|
repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA Merged as |
Requested by Leehom · project thread
Fixes #33661
Clause-②: yes (widening) —
AutomationEngine.dryRunadmits arunAs: 'system'self-triggered draft for the named user (ruling B);@objectstack/coreexports the shared flow-start rules (aiAccountElevatedStartRefusal,requiredPermissionsStartRefusal,requiredPermissionsRefusal,missingCapabilities,isAiServiceAccount,AI_ACCOUNT_ELEVATED_START_REFUSAL,FlowStartPermissionRefusal); plugin-security's registeredsecurityservice servescanWriteObjectMetadata-protocol: none
维护者速读
runAs: 'system'声明的自触发草稿可以试跑,但只按试跑人的权限,绝不提权)。packages/services/service-automation/src/dry-run.ts(写拦截的数据引擎代理dryRunDataEngine与dryRun准入顺序);packages/core/src/security/flow-start-rules.ts(两条共用准入规则);packages/plugins/plugin-security/src/security-plugin-security-service.ts(security 服务新暴露canWriteObject)。pnpm --filter @objectstack/service-automation exec vitest run src/dry-run.test.ts,预期 30 个测试全过,其中包括「审批节点停下且从未被调用」和「零写入」的断言。packages/spec/src/contracts/automation-service.ts中 dryRun 准入那一条,按裁决 B 改写)。裁决记录 6917953931 写明契约改动在实现落地前欠契约评审和你的批准;L1 与契约评审在同一 head 通过后,席位会请你批准,批准后由席位落地。What changes
AutomationEngine.dryRun(definition, options)implements theIAutomationService.dryRuncontract. The run is unarmed and unregistered. It runs as the named user against the supplied record, and it writes, sends and pauses nothing.userIdthrows aTypeError.registerFlow's own checks, now one privatejudgeFlowRegistrationthat both call, so a dry run throws exactly whatregisterFlowthrows.accessible_org_ids.requiredPermissions.condition_not_met, orfailedwith the fault.runAs: 'system'draft is admitted for the named user, and its run context always resolves asrunAs: 'user', so it is never elevated. The contract bullet now says so, and its pin test holds the new sentences and the absence of the old one.requiredPermissionsrule moved down to@objectstack/core(security/flow-start-rules.ts), because service-automation does not depend on runtime.flowStartRefusalin runtime anddryRunboth callaiAccountElevatedStartRefusalandrequiredPermissionsStartRefusal. Runtime re-exports every moved symbol under its old name (AI_ACCOUNT_ELEVATED_START_REFUSAL,isAiServiceAccount,requiredPermissionsRefusal,FlowStartPermissionRefusal,missingCapabilities). The elevated self-triggered rule stays in runtime, since only the by-name doors ask it.executeNodeandtraverseNextbodies on a dry host, so routing and compute nodes run on the real executors: assignment, decision, gateways, loop, parallel and try/catch. Region bodies (loop, parallel, try/catch) are diverted into the dry run throughactiveDryRunExecuteNode(), so a write inside a loop is simulated too.dryRunDataEnginewhile a dry run is active.dry-run:UUID:Nplaceholder id.idvalue), the filter's rows undermulti, or none when it refuses the call (the engine's own error).canWriteObjectfor the named user (allowedorrefused). A delete, or a kernel with no check installed, answersnot_judged.refused). An update or delete by predicate withoutmultifails with the engine's own error and targets no row.PERMISSION_DENIED. The run goes on along afaultedge or out of atry_catchregion that contains it, and otherwise endsfailedwith that write as the last step.supportsPausestops the run with a class:approval,wait,screen(its ScreenSpec is built by the real screen executor),starts_floworsuspends. A type no class covers stops the run asnot_simulated.securityservice. The registered service now servescanWriteObject, so the dry run can judge a write without performing it.Tests
packages/services/service-automation/src/dry-run.test.ts, 30 tests:create_record(placeholder id, computed values, zero writes, a read by id sees the simulated row),update_record(live target, overlay read, the write check asked with the non-system named user),assignment,decision(branch, expressions,next; also a gateway decision), andapproval(stops, and the executor is never called).requiredPermissionsrefusal equalsrequiredPermissionsRefusalfrom core, the AI account refusal equalsAI_ACCOUNT_ELEVATED_START_REFUSAL, a non-member organization is refused, ruling B admits without elevating, plus the TypeError, theregisterFlowthrow,condition_not_metand a faulted condition.not_simulated, a write inside a loop, and an outboundhttppayload with nothing sent.save_noticepayload and a refusingendnode in zh-CN through their translation keys; a refused write going on along itsfaultedge; a write check that throws is refused; unread grants (a failed read, an empty answer, no resolver) refuse arunAs: 'system'draft; an update or delete by predicate withoutmultifails with the engine's own message, with amulticontrol; an update whose fields name the id, with no filter, targets that one row, with amulticontrol targeting every readable row.automation-dry-run.pin.test.tscontract pin was updated for ruling B.registered-security-service-members.pin.test.tsledgerscanWriteObjectwith its reason (see Acceptance notes).Acceptance notes
canWriteObjectstays offISecurityService: settled by the published contract. The dryRun contract of Contract: IAutomationService gains a dry run of an unpublished flow definition, once, unarmed, as a named acting user against a supplied record (spec half of #33661) #33757 (FlowDryRunWritePermission, contract-reviewed) names it "a method of@objectstack/plugin-security's service, not ofISecurityService". Onmainthe registered service did not serve it; this PR serves it and ledgers it inSERVED_NOT_DECLARED, citing that contract. That pin's header now states the exception: a member a published contract places offISecurityServicestays off it, and its entry cites that contract. Declaring it onISecurityServicewould be a separate contract change and is not part of this PR.@objectstack/core: the shared rules.@objectstack/runtime: re-exports only.@objectstack/plugin-security:canWriteObjecton the service.scripts/engine-double-contract.pinned.json: the gate's own--writefor the new pinned test double.options.locale.save_notice's message reads itsflows.FLOW.notices.NODE.messagetranslation through that executor's own renderer; a refusingendnode's message reads its translation too.notifyandhttprender the authored text, as their live executors do.requiredPermissions, and for arunAs: 'system'definition, because the AI service account rule cannot be asked without the grants. That last refusal carries the dry run's own message.multilists every row it targets, uncapped, sinceFlowDryRunWriteStep.recordIdsis defined as the rows the write targets.test_flow, every HTTP or MCP door, the service-automation: a retried run skips the flow's start condition (errorHandling.strategy 'retry') #33935 retry clause,docs/adr/**,skills/**.Verification
Readings are on head
3392bc4f0for service-automation and the dry-run suite, and on4889de397for spec, plugin-security, core and runtime, which the last round did not touch. The first ablation below was run on2e47ef291.os-verify-lock, VERDICT command-exit 0 for each):@objectstack/service-automation: 286/286 files, 4082/4082 tests (3392bc4f0).@objectstack/runtime: 609/609 files, 11271 passed, 19 skipped.@objectstack/core: 149/149 files, 3595/3595 tests.@objectstack/spec: 845/845 files, 27059 passed, 1 todo.@objectstack/plugin-security: 273/273 files, 6824 passed, 45 skipped.dry-run.test.ts30/30 (3392bc4f0); the member pin 4/4 and the spec dry-run pin 5/5 (4889de397).core,runtime,plugin-securityandservice-automationare green,check:test-typecheckincluded. Runtime's first attempt was red only because@objectstack/driver-tursohad no dist. Building the dependency closure fixed it.2e47ef291, the dry run's admission call was replaced withnullthroughscripts/ablation-replace.mjs.bd40dedf94bbtoced6b2f7de22.dry-run.test.tswent to 2 failed, 16 passed: therequiredPermissionsrefusal and the AI account refusal.git diff HEADis empty. The tests import the engine from source, so no dist was involved.4889de397, one each for the translation read, the unread-grants refusal and the throwing write check, throughscripts/ablation-replace.mjs: each turned exactly its own pin red (1 failed, 25 passed) and was restored to a blob equal to HEAD with an emptygit diff HEAD.3392bc4f0, the by-id targeting branch disabled: exactly the id-targeting pin went red (1 failed, 29 passed), restored to a blob equal to HEAD.node scripts/pm/dispatch-gates.mjs --commandsderived 108 for this diff.4889de397: 108 derived, 108 ran, all exit 0,check:i18nandcheck:dual-build-cjs-loadsincluded.--ranreconciliation: 108 derived, 108 run, 0 NOT-MEASURED, 0 UNRUN. On3392bc4f0, for the two files that round touched: 60 derived, 60 ran, all exit 0.node scripts/check-platform-checklist.mjs --changed-from origin/main: OK, 29 anchors judged, 0 lost.The ablation run
Suite totals
🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5kYk6G1CvandwWbbhe