Repository navigation
feat(spec): a restriction profile lists the approval pair through a derived vocabulary and splits allowSandboxedJs off allowCode - #31410
Conversation
…ch containers as structural A restriction profile's allowedFlowNodeTypes can only name FlowNodeAction ids, and parallel / try_catch are engine built-ins outside it, so under allowCode: false the reader refused them as plugin nodes with no way to allow them. They are now always allowed, like start / end, and every node inside their regions is still judged. loop is a FlowNodeAction id and stays judged by the list. The allowedFlowNodeTypes docblock states the reader rules. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…r takes as code, devPlugins included Co-Authored-By: Claude <noreply@anthropic.com>
…-0phzyp # Conflicts: # packages/cli/src/utils/restriction-profile.ts
…llowCode, now that os build leaves it out of the artifact Co-Authored-By: Claude <noreply@anthropic.com>
…ithub.com/objectstack-ai/objectstack into claude/project-thread-7zgbrf
…oxedJs Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2f9i7baA5w5Ta9Ai5P
…type outside the vocabulary with a code plugin Co-Authored-By: Claude <noreply@anthropic.com>
… shape Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2f9i7baA5w5Ta9Ai5P
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2f9i7baA5w5Ta9Ai5P
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2f9i7baA5w5Ta9Ai5P
… describe the profile vocabulary Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2f9i7baA5w5Ta9Ai5P
…er binds nothing Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2f9i7baA5w5Ta9Ai5P
…to claude/project-thread-7zgbrf # Conflicts: # packages/spec/src/system/restriction-profile.zod.ts
…-7zgbrf # Conflicts: # packages/cli/src/utils/restriction-profile.test.ts # packages/cli/src/utils/restriction-profile.ts # packages/spec/src/system/restriction-profile.zod.ts
|
domain:spec#4 · marchtian · session_017ihL2f9i7baA5w5Ta9Ai5P Fable review · spec contract diff · PASSThis is the maintainer's standing rule for spec changes: an independent review by an isolated Fable subagent. It was given the card, the ruling record on #31354, the approved analysis and the diff, and not the author's conclusions. Its scope was the spec contract diff plus the reader code that implements it. Round 1 at
Delta re-review of Generated by Claude Code |
📓 Docs Drift Check13 anchor(s) derived from 2 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 180 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 165c7c36a86892ce896c0826e19afc0d5ae44a03 && git checkout 165c7c36a86892ce896c0826e19afc0d5ae44a03
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 405a78eae9311598f8868fe5bff92a2e17520f68 8ef2c1ef5cac0ec76da4c6bc62aa23abc441dbaa && git checkout -B drift-repro 405a78eae9311598f8868fe5bff92a2e17520f68 && git merge --no-ff 8ef2c1ef5cac0ec76da4c6bc62aa23abc441dbaa
node scripts/docs-audit/affected-docs.mjs --json 405a78eae9311598f8868fe5bff92a2e17520f68 |
|
domain:spec#4 · marchtian · session_017ihL2eAG5J8aqAyPZif4BJ Contract reviewServed-tier: ① Derived judgmentsRuling #31354 item 2 ("DERIVED vocabulary = Item 3 ("REQUIRED boolean nit — restriction-profile.zod.ts:126 says "only a hook or job with no ② Semver level
③ Boundary flagsPR author ④ Design judgmentThe spec file holds against the code it cites: Implemented-by: VERDICT: PASS |
Requested by 田騏 · project thread
Fixes #31344
Clause-②: yes (widening)
Metadata-protocol: added
维护者速读
RestrictionProfileNodeType(FlowNodeAction全部 id + spec 已声明契约的approval/approval_revise),并新增必填键allowSandboxedJs管所有沙箱 JS body;os validate --target读取方按 hook / action / job 的 body 形态分两键判。allowCodesplits off sandboxed lifecycle hooks #31354 裁定 D(田騏「同意」)。不改的话 Team 套餐上能跑的审批流程和沙箱钩子会被预检判成违规,而 action 里同样的沙箱脚本反而放行。.changeset/31156-…仍待发),新必填键对已发布消费者不构成破坏;必须赶在 cloud#3732 发布第一份档案前落地。回滚 = revert 本 PR。所依赖的 PR fix(cli): os validate --target allows the ADR-0031 parallel / try_catch containers, and the restriction profile docblocks state the reader rules #31277 已合入 main。packages/spec/src/system/restriction-profile.zod.ts(派生词表与allowSandboxedJs的契约文字)→packages/cli/src/utils/restriction-profile.ts(hooks / actions / jobs 的分类,bound action 去重)→.changeset/31344-…。pnpm --filter @objectstack/cli exec vitest run src/utils/restriction-profile.test.ts test/validate-target-restriction-profile.test.ts,预期 2 个文件全绿,其中 Team 形状档案(allowCode: false, allowSandboxedJs: true,列出审批对)放行审批流与沙箱钩子。What changes
Builds on PR #31277, which has since landed on
main. This branch hasorigin/mainmerged at 77a675d.Spec (
packages/spec/src/system/restriction-profile.zod.ts)RestrictionProfileNodeType: the profile's own node vocabulary, derived asFlowNodeAction.optionsplus the spec-declared plugin node contractsAPPROVAL_NODE_TYPEandAPPROVAL_REVISE_NODE_TYPE.allowedFlowNodeTypesis now an array of it.FlowNodeActionis unchanged. The vocabulary stays disjoint from the ADR-0031 containers that a reader always allows, and theloopasymmetry is recorded in the docblock only.allowSandboxedJs. It governs every L2language: 'js'body:hooks[].body,actions[].bodyandjobs[].body.allowCodeis narrowed in its docblock and.describe()to in-process code: handler-form hooks and jobs,functions, plugins, the other code keys and thescriptnode. L1 expression bodies fall under neither key. New near-miss aliases (allowSandboxedHooks,allowScriptBodies, …) point to the new key.Reader (
packages/cli/src/utils/restriction-profile.ts)allowCode", so the approval pair is judged byallowedFlowNodeTypes.handleras it does at bind. Ajsbody falls underallowSandboxedJs, an expression body under neither key, and a hook with no body that names ahandlerunderallowCode.jsbody on atype: 'script'action (the only type the runtime runs a body for), whether top-level or embedded onobjects[].actions, is now judged byallowSandboxedJs. A bound action thatdefineStackechoes into its object is judged once, at its top-level path.allowScheduledAutomationfirst (one row). When that passes, ajsbody falls underallowSandboxedJsand a handler-only job underallowCode. Apulljob falls under neither key.Generated:
content/docs/references/**,api-surface,authorable-surface,declaration-map,export-originsandjson-schema.manifestare regenerated. Thetype-alias-conventionpin gains one line, 842 → 843.Tests
packages/spec/src/system/restriction-profile.test.tspins three things. The derivation is exactlyFlowNodeAction.optionsplus the pair.FlowNodeActionis not widened. The vocabulary is disjoint fromparallel/try_catch. It also covers the new required key (missing, non-boolean, near-miss aliases) and a profile that lists the pair underallowCode: false.packages/cli/src/utils/restriction-profile.test.tsflips the approval →allowCodecase, so a profile that omits the pair now refuses it byallowedFlowNodeTypes. A newdescribecovers every body carrier in each form, the hosted profile, the precedence ofallowScheduledAutomation, and the bound-action echo.packages/cli/test/validate-target-restriction-profile.test.tsruns the door on a Team-shaped stack (an approval flow plus a sandboxed hook). The Team profile passes it.allowSandboxedJs: falserefuses the hook, and a profile that omitsapprovalrefuses that node.Acceptance notes
RestrictionProfileSchemahas not shipped.packages/specis at 18.3.0 on npm, and the schema's own changeset31156-restriction-profile-schema.mdis still pending. Adding a required key therefore narrows nothing a released consumer holds. That is why the title carries no!and the declaration isClause-②: yes (widening)/Metadata-protocol: added. The claim declaredMetadata-protocol: none; it is corrected here because the profile is on the spec's authorable surface (authorable-surface/system.json) and One authoring source (cloud#3659 A), 2/4: a RestrictionProfile schema in spec, and os validate --target checks metadata against an environment's profile #31156 declared itadded.scriptaction with no body, whosetargetnames a function, is not judged per item. The function it names is already refused underallowCode: falsethrough thefunctionskey. This is unchanged and outside the ruling's scope.Verification
Head
8ef2c1ef(origin/main77a675d merged; spec regenerated withcheck:generated --fix, nothing stale).Local tests and typecheck
pnpm --filter @objectstack/cli exec vitest run --project unit:: exit 0 — Test Files 401 passed (401), Tests 5682 passed (5682)pnpm --filter @objectstack/cli typecheck:: exit 0 (tsc + check:test-typecheck)pnpm --filter @objectstack/spec typecheck:: exit 0pnpm --filter @objectstack/spec exec vitest run src/system/restriction-profile.test.ts src/type-alias-convention.pin.test.ts:: exit 0 — 41 passedpnpm --filter @objectstack/cli exec vitest run src/utils/restriction-profile.test.ts test/validate-target-restriction-profile.test.ts:: exit 0 — 45 passedintegrationtier ofpackages/cliis left to CI.Derived gates (dispatch-gates --commands, 108 families)
dispatch-gates --ran: 108 derived, 107 run, 1 NOT MEASURED, 0 unrun. Five families first exited 3 because a built prerequisite was missing (check:skill-examples,check:dual-build-cjs-loads,check:i18n,check:i18n-coverage,check:i18n-walk-parity). After the prerequisites were built, all five exited 0.NOT MEASURED:
node scripts/check-plugin-teardown-shape.mjs --self-test:: exit 3. Its fixture is pinned to commit 621a487, which this shallow clone cannot reach. The change touches no plugin, and CI runs it.All other families :: exit 0.
Contract review
An independent Fable review of the spec contract diff, plus the reader that implements it, returned PASS with no must-fix findings. It raised two should-fix items, both applied: an action body is judged only on a
type: 'script'action, because that is the only type the runtime runs a body for; and a hook with neither a body nor a handler is not refused. Its nits on the vocabulary.describe()and docblock wrapping were also applied. A delta re-review returned PASS. The verdict is posted as a PR comment.🤖 Generated with Claude Code
https://claude.ai/code/session_017ihL2f9i7baA5w5Ta9Ai5P