Repository navigation
docs(skills): a gated action guards its door only; lock the field an irreversible transition changes - #35310
Conversation
…irreversible transition changes objectstack-ai Common Pitfalls teaches the gated script action plus a readonly or field-permission lock on the state field, and why readonlyWhen and a state_machine rule cannot be the door. The tool-name ladder names MCP_FILE_TOOL_NAMES as its fourth source (here and in content/docs/ai/tools.mdx), and the MCP prompts paragraph names mcpPrompt and the stdio exception. state-machines-and-approvals.md points to the pitfall; restatement cut in both files to pay for it. Claude-Session: https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: Rules face, PR #35310 (Fixes #35068, riders #35041 and #34237). Read: the three cards with every comment (claim 6998681086, dev report 6999131416), the PR body and file list, the net diff against The security line above reads yes because pitfall 2 teaches write protection: the identity a write runs under, the static read-only strip, field permissions and their 403. The seat adopting this record adds the ① Derived judgmentsNo accept set and no published surface moves: served skill text, one docs sentence, one changeset. The dev's premises, each read in code at this head:
The card's Scope 2 listed Write paths walked for the Riders:
Docs page: Ratchet: Cuts paid for the budget, each still taught: the "Default for metadata apps" paragraph (the default path is the heading at SKILL.md:138 and ladder item 3); the ADR-0109 sentence of ladder item 1 (SKILL.md:288-295); in the automation reference the ② Semver level
③ Boundary flags
④ Design judgment
The ladder, the MCP prompts paragraph and pitfall 1's parenthesis hold against the code in ①. Pitfall 2 holds sentence by sentence against the code in ①, and its S1 (should-fix) — the field-permission arm does not bind a Modify All holder, and the pitfall does not say so. S2 (should-fix) — the recipe moves the write to an elevated body and names no gate on who may run it. N1 (nit) — both arms take every direct write off the state field, so each other transition on it also needs an elevated writer (an action body, or a N2 (nit) — "final for every writer" is true of every identity the rule judges; the two skips are server-set and held by the system principal alone (①). Accepted wording. N3 (nit) — ladder item 4's "(same file)" means N4 (nit) — no eval pins pitfall 2 ( N5 (nit) — out of this diff, for a data-skill follow-up: the pointer target
The pointer line ( S1 and S2 are open on this head and earn a delta read of their fix; the five nits are left as accepted deviations or follow-up cards. Implemented-by: VERDICT: PASS |
…and asks for requiredPermissions on the gated action readonly: true is the arm that binds every non-system caller; a field permission without editable binds only a caller no held set grants it, and Modify All grants it. The elevated body skips the caller's edit right, so the gated action declares requiredPermissions. Paid down in the same file: pitfall 1's retired-tool sentence (taught under Tool metadata) and the duplicated agents-are-internal lead. Claude-Session: https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: Delta round. Round 1 is record 6999708959 on head Read: the delta diff and its commit subject; the three changed regions of Check-runs on this head, read at 2026-11-19T04:37Z, CI still running: 48 runs, 21 success, 17 skipped, none red, 10 in progress. PENDING: ① Derived judgmentsNo accept set and no published surface moves; the delta is skill text and the changeset's matching sentence. No code, no script, no docs page and no automation file is in it.
② Semver levelUnchanged and still right: ③ Boundary flags
④ Design judgmentS1: closed No must-fix and no should-fix on this head.
Nits (none blocks, none needs a push):
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ 维护者速读
席位核对 — ACCEPT · repo:objectstack#5 · head
|
Requested by Bill · project thread
Fixes #35068
Fixes #35041
Fixes #34237
Clause-②: no
Metadata-protocol: none
维护者速读
readonly: true约束所有非系统写;字段权限不给editable不约束 Modify All 持有者),并在动作上声明requiredPermissions」;工具名解析阶梯补上第四个来源MCP_FILE_TOOL_NAMES(docs 的 tools.mdx 同步);MCP prompts 段落写明mcpPrompt: false及 stdio 例外。ai.requiresConfirmation只守动作这一扇门,场景卡上代理被 428 拒后改用update_record直接把工单关了;按「三个问题 同意」不扩大闸门,改为教作者锁字段。另两张 p3 卡是同文件的过期文字。skills/objectstack-ai/SKILL.md的 Common Pitfalls 第 2 条(锁选项是否与实测一致);其次同文件 MCP prompts 段落;state-machines-and-approvals.md只多一行指针。node scripts/check-skills-token-ratchet.mjs,预期 objectstack-ai/SKILL.md 6693 / 6801、state-machines-and-approvals.md 5936 / 5936,全绿。skills/**为 Tier H 受管面)。What changes
#35068 — gated action plus a field lock. Scope 1 was measured before any text was written (below).
skills/objectstack-ai/SKILL.mdCommon Pitfalls gains item 2, "Gating the action, not the state":ai.requiresConfirmationguards the action's own door only; an irreversible transition is a gatedscriptaction over a field a non-system write cannot set:readonly: truebinds every non-system caller, while a field permission withouteditablebinds only a caller no held set grants it (Modify All grants it); the body skips the caller's edit right, so the action declaresrequiredPermissions; a declarativeoperation: 'update'action and aflowaction underrunAs: 'user'write as the caller, so the lock stops them too;readonlyWhenand astate_machinerule bind the elevated body as well, so neither is the door, while astate_machinedead-end still makes the reached state final. Pitfall 1 now says the confirmation gate guards its door only.skills/objectstack-automation/references/state-machines-and-approvals.mdcarries one pointer line to it (taught once, in objectstack-ai, where the gate is taught; no restatement).#35041 — the ladder's fourth source. The resolution ladder names four sources; item 4 is
MCP_FILE_TOOL_NAMES(the pinned export in the same constants file, so the list cannot drift), resolved only for a skill MCP can offer (mcpPromptnotfalse).content/docs/ai/tools.mdx(the one ladder sentence, scope addition 6964629901) says the same.#34237 —
mcpPromptin the MCP prompts paragraph. The paragraph names the optional key (false= in-product only, never offered over MCP on any connection, whatever the binding; absent ortrue= the binding rule), and the stdio sentence states the exception.Scope 1 measurement (tree 3fb7025 + this branch, no code changed)
readonly: truereadonlyWhen(TRUE)editablestate_machinescriptaction body (ctx.api, elevated)update_record, REST, form)editable(Modify All does)operation: 'update'actionAnchors:
packages/runtime/src/action-execution.ts:3901(buildActionExecutionContextreturns{ ...ec, isSystem: true }with the'action'mark).packages/objectql/src/engine-update.ts:1411(staticReadonlyStripRuns = !opCtx.context?.isSystem) and:1494.isSystemincluded:packages/objectql/src/engine-update.ts:1476; the comment at:1460-1467saysisSystem"is still NOT an exemption here".packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts:695and the 403 is:1662.packages/runtime/src/action-execution.ts:4883(callData('update', …, ec), the comment above it reads "⛔ec, neverbuildActionExecutionContext(ec)").packages/objectql/src/engine-top-level.ts:4274-4275(shouldSkipStateMachine).packages/lint/src/validate-readonly-action-writes.ts.Result: the action body's own write to a
readonly: truefield is KEPT and its write to areadonlyWhen-locked field is STRIPPED. So the lock that binds every non-system caller isreadonly: true; a field permission withouteditabledoes not bind a Modify All holder;readonlyWhenis not the door. Astate_machinerule binds every writer: it makes the state final, and it cannot be the door.Tests
Text-only change; no committed test (the measurement used existing pins, run here).
Scope 1 pins — objectql, 3 files, 25 tests passed
pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-readonly-update-strip-system-gate.test.ts src/engine-readonly-when-derived-writes.test.ts src/engine-repo-execute-elevation.test.ts, after building the objectql dependency closure. Output:Test Files 3 passed (3),Tests 25 passed (25),os-verify-lock: VERDICT command-exit 0.engine-readonly-update-strip-system-gate.test.ts: a caller-suppliedreadonlyvalue lands exactly whenisSystemis set.engine-readonly-when-derived-writes.test.ts, "LOCK 2 — isSystem does NOT exempt a caller-supplied value".engine-repo-execute-elevation.test.ts, "a readonly-field write through ctx.api LANDS, matching REST/MCP".Acceptance notes
skills/objectstack-ai/SKILL.md: the "Default for metadata apps" paragraph is cut, because it restated the App AI Blueprint table above it. The ladder item 1's ADR-0109 sentence is cut, because it restated Tool metadata.state-machines-and-approvals.md: three restatements are cut. The[]dead-end sentence restated the code commentfinal — no outgoing transitions; ", one per field" restated One rule per field; and "Do not carry therecord.xhabit…" restated the sentence before it. Fix round (af46d3b, review 6999708959 S1/S2): +42 tokens, paid first by cutting pitfall 1's retired-tool sentence (taught under Tool metadata) and folding the agents-are-internal lead into the skills-entry sentence; net 6680 -> 6693 / 6801.pnpm check:dual-build-cjs-loadsNOT MEASURED locally (exit 3, PREREQUISITE NOT MET: reads every package'sdist/); CI runs it.Verification
Readings at head 7611288 (tree objectstack-ai/objectstack).
Skills size, before (origin/main 3fb7025) and after
skills/objectstack-ai/SKILL.mdskills/objectstack-automation/references/state-machines-and-approvals.mdskills/*/SKILL.md(lines)Local gate subset — 74 derived families, 73 exit 0, 1 NOT MEASURED
The list was derived with
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackagainst merge base 3fb7025, which gave 74 families. Every family ran, and the exit code was captured before any pipe.check:skills-token-ratchet,check:skill-links,check:skill-refs,check:skill-docs,check:skill-served-sections,check:skill-examples(345 prose examples type-check),check:doc-authoring,check:nul-bytes,check:pm-skill-id-lint,check:skill-identifier-liveness,check:docsandcheck:docs-spec-enumerations.check:skill-examplesandcheck:lean-entry-closureexited 3 on the first pass, because their built inputs were missing. Both exited 0 afterclient-reactandobjectqlwere built.check:dual-build-cjs-loadsexited 3, PREREQUISITE NOT MET.dispatch-gates --ranprinted:74 derived famil(ies) accounted for — 73 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3).node scripts/pm/overlap-check.mjs --branch=HEADprintedVERDICT clean exit 0. It merges cleanly with origin/main, with chore: version packages #35129 (which shares the ai SKILL.md) and with docs(skills): teach the fault edge on a write after an approval decision and the RESUME_FAILED refusal members #35002 (which shares the state-machines file).🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7