Skip to content

fix(lint, runtime)!: an action body that cannot compile in its (input, ctx) wrapper is refused at validate, build and publish, and at run time answers naming itself - #34980

Merged
objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/issue-34884-action-body-compile
Nov 18, 2026
Merged

objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/issue-34884-action-body-compile

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz

Fixes #34884

Clause-②: no (narrowing) — an L2 action body (type: 'script', body.language: 'js') that does not compile as the body of (async (input, ctx) => { … }) passed os validate, os build, os lint, os verify and the runtime publish door; it is now refused there as action-body-does-not-compile at error (on the publish door for action writes and for object writes carrying inline actions[]). One arm advises instead of refusing: a regular-expression literal the host engine refuses is a warning. Such a body never ran: every run failed with a SyntaxError before its first statement. @objectstack/lint also gains exports (validateActionBodyCompiles, hostCompileFailure, ACTION_BODY_DOES_NOT_COMPILE, ACTION_BODY_PARAMETERS, actionBodyFunctionExpression and two finding types on ., actionBodyFunctionExpression on ./runtime).
Metadata-protocol: narrowed
Skills-docs: follow-up owed — skills/objectstack-data/references/data-hooks.md (it teaches the action wrap (async (input, ctx) => { … }) without saying a body must not declare input / ctx again); follow-up #34988 (blocked on #34504, which holds that file); this PR teaches it in content/docs/ui/actions.mdx and content/docs/automation/hook-bodies.mdx.

维护者速读

  • 改了什么:脚本动作的 body.source 如果在运行时的包装 (async (input, ctx) => { … }) 里编译不过(最常见是 const input = ctx.input || {} 重复声明参数),现在 os validate / os build / os lint / 发布保存(动作写入和对象写入)都会报错拒绝,点名动作、编译错误和行号;运行时若仍遇到这种动作,REST /actions 与 MCP run_action 回答 500 INTERNAL_ERROR,消息点名动作和编译错误,不再是光秃秃的 "Internal server error"。
  • 为什么改:这种动作以前四道门全过,部署后每次运行都失败,调用方(尤其 AI)只看到不透明的 500,只好绕开去直接写数据,把状态弄错。
  • 风险与回滚:新拒绝的只有本来就永远跑不起来的动作体;检查用宿主 JS 引擎(Node 的 V8)编译、不执行,与运行时 QuickJS 唯一实测分歧在正则字面量,那一支只给警告不拒绝。四个示例应用实测 0 处命中,全量 dogfood 绿。回滚即 revert。
  • 先看:packages/lint/src/validate-action-body-compiles.ts(编译方式与正则分支);packages/runtime/src/sandbox/quickjs-runner.ts(actionBodyCompileFailure 与包装改用共享函数);packages/lint/src/authoring-rules.ts(注册:门禁级、发布门 action + object)。;packages/spec/src/migrations/entries/semantic/18.action-body-does-not-compile-refused.ts(ADR-0087 语义迁移条目,升级指南与 os migrate meta 读它)。
  • 两分钟验证:pnpm --filter @objectstack/lint exec vitest run src/validate-action-body-compiles.test.ts,预期 14 条全过,其中含卡里那句原样的动作体被拒。
  • 需要你做的:无,席位落地(收窄需一次契约级审查,由席位安排)。

What changes

  • Author time (@objectstack/lint) — new gating rule action-body-does-not-compile (validate-action-body-compiles.ts). It compiles each L2 action body inside actionBodyFunctionExpression(source), the wrapper the runtime builds, from the same function, with the host engine, as a script, never running it (node:vm Script; the Function constructor where node:vm is absent; no verdict where the host refuses to compile at all). The finding names the action, the compiler's sentence and the line of body.source; a redeclared wrapper parameter gets a hint naming it. Registered in authoring-rules.ts as gating on all three commands and on the runtime publish door for action and object writes; os explain action-body-does-not-compile added; barrel exports added. The object door's roster pin in runtime-gate.object-writes.test.ts names the join.
  • The shared wrapper — packages/lint/src/action-body-wrapper.ts holds the one spelling, (async (input, ctx) => { SOURCE }). quickjs-runner.ts now builds its action wrapper from it through @objectstack/lint/runtime (the runtime already depends on that entry); the wrapper text is byte-identical to before.
  • Run time (@objectstack/runtime) — when evaluating an action's wrapper fails with a SyntaxError (a compile failure: an async body cannot throw synchronously, so anything the body itself throws crosses __error instead), the runner throws a SandboxError with status: 500, no code, the operator line action 'NAME' does not compile: SyntaxError: … and the caller sentence Action 'NAME' cannot run: its body does not compile (SyntaxError: …). The action's author must fix its body.source and publish it again. The doors answer the status's own INTERNAL_ERROR and relay that sentence. A crash while running (a TypeError, a SyntaxError thrown by JSON.parse) keeps the sanitised 500. Hook and job bodies are unchanged.
  • Protocol (@objectstack/spec) — the ADR-0087 semantic entry packages/spec/src/migrations/entries/semantic/18.action-body-does-not-compile-refused.ts (action-body-does-not-compile-refused: surface, replacement, reason, acceptance criteria) registers the narrowing for the upgrade guide and os migrate meta; the generated registry picks it up, no other spec file changes. The changeset declares Metadata-protocol: narrowed, carries adr-0087: registered action-body-does-not-compile-refused, and grades @objectstack/lint and @objectstack/spec minor, @objectstack/runtime patch.
  • Docs — content/docs/automation/hook-bodies.mdx and content/docs/ui/actions.mdx teach the rule; content/docs/api/error-catalog.mdx gains the Action Errors row; the author-time rule count the CLI prints goes 70 to 71 in the four transcript pages. content/docs/deployment/validating-metadata.mdx gains the rule's row in the four-doors table (✓ ✓ ✓ ✓ᵃᶜᵒ: the three commands, and the publish door for action and object writes).

Tests

  • packages/lint/src/validate-action-body-compiles.test.ts (14): the card's body byte for byte refused (error, path, 'input', line 1, parameter hint); the same source compiling in the parse check's own wrapper (why no check saw it); let ctx on line 3; an unparseable body; new.target; four bodies that compile (var input, reading input, …) admitted; the regex arm at warning; a body that closes the wrapper early compiles and never executes; both registration sites, merged action once, non-script and non-js skipped; validate / build / lint each refuse; the action and object publish doors refuse and admit; an unrelated write is not charged with a stored bad body.
  • packages/runtime/src/sandbox/sandboxed-action-crash-is-a-fault.test.ts, new top-level describe (3): the real runner on the card's body (message, status: 500, no code, sentence); the real /actions door answers 500 INTERNAL_ERROR with the sentence, not Internal server error; control: a runtime SyntaxError stays a sanitised crash.
  • packages/core/src/utils/import-runner-sandbox-fault-row.test.ts (round 2): the census that renders every SandboxError construction in quickjs-runner.ts gains crash samples for the new site's two interpolations, actionName and compilerError; the census is not loosened, and the new site becomes one more §2 case (the door withholds a sandbox fault's text, the import row reads the door's sentence). Red before on bc80b37795 (quickjs-runner.ts:2407 (relayed): no sample for the interpolation actionName, 1 failed, 44 passed), green after (46 passed).
Live measurement before and after (scratch app, CLI built from this tree)

Before (origin/main fff0ad0), action body const input = ctx.input || {}; return 1;:

  • os validate exit 0, os build exit 0, os verify exit 0 ("verify passed — no runtime failures").
  • REST POST /api/v1/actions/OBJ/ACTION/ID: 500 {"code":"INTERNAL_ERROR","message":"Internal server error"}.
  • MCP run_action: {"error":{"code":"INTERNAL_ERROR","message":"Internal server error","status":500}}.
  • PUT /api/v1/meta/action/NAME with that body: 200 saved active.
  • Server log: ERROR [BodyRunner] sandboxed action threw … action 'rpc_decide' threw: SyntaxError: invalid redefinition of parameter name, then sandboxed body crashed: ….
  • First door that could see the error and did not: os validate (every author-time door shares the registry).

After (this branch, the pre-fix artifact booted with -a to stand for a body deployed before the rule):

  • os validate / os build / os verify exit 1, action-body-does-not-compile at actions[0].body.source ("SyntaxError: Identifier 'input' has already been declared, line 1").
  • REST and MCP: 500 INTERNAL_ERROR, message Action 'rpc_decide' cannot run: its body does not compile (SyntaxError: invalid redefinition of parameter name). The action's author must fix its body.source and publish it again.
  • PUT /api/v1/meta/action/NAME: 422 INVALID_METADATA with the rule's issue; a body using const params = ctx.input || {} saves 200.
  • Server log: action 'rpc_decide' does not compile: SyntaxError: invalid redefinition of parameter name.
  • Control action return { ok: true }: 200 both times.
Engine probe (36 bodies, Node 22 V8 vs the runtime's QuickJS)

Agreed on every redeclaration, grammar error, strict-mode error, super and new.target (with the wrapper compiled as a script). Disagreed once: /(?<a>x)|(?<a>y)/ (duplicate named groups) is refused by Node 22's V8 and accepted by QuickJS, hence the regex warning arm.

Ablations (each restored to blob == HEAD, `git diff HEAD` empty)
  • validate-action-body-compiles.ts: if (!failure) continue; → if (!failure || site) continue; via scripts/ablation-replace.mjs (anchor 1 → 0, blob 9e2fd44dd44c → 1f242fac955b): 9 of 14 red; restored 9e2fd44dd44c.
  • quickjs-runner.ts: the compile-failure branch disabled (&& !err, anchor 1 → 0, blob 571aa67e747d → a06de24caa83): the 2 compile-failure pins red, the control and the 3 earlier cases green; restored 571aa67e747d.
  • Both test files import the code under test from src/ (relative), so no dist rebuild sits between the mutation and the run.

Acceptance notes

Verification

Head 15faf1da07 (round 2: origin/main merged twice, the spec entry, the changeset rewrite, the docs row, the core census samples). Local readings (CI runs the full farm):

Round 2 — spec, core census, docs
  • pnpm --filter @objectstack/spec gen:migration-registry then vitest run src/migrations: 5 files, 198 passed (the generated registry carries action-body-does-not-compile-refused once).
  • pnpm --filter @objectstack/spec run check:generated exit 0 (14 generated artifacts up to date); check:adr-0087-registration --base origin/main exit 0 (registered action-body-does-not-compile-refused (new here)); check:changeset-no-major exit 0; check:issue-citations exit 0.
  • pnpm --filter @objectstack/core exec vitest run --project repo src/utils/import-runner-sandbox-fault-row.test.ts: before the samples (on bc80b37795) VERDICT command-exit 1, 1 failed / 44 passed, the census naming quickjs-runner.ts:2407 (relayed): no sample for the interpolation actionName; after, VERDICT command-exit 0, 46 passed. pnpm --filter @objectstack/core run test:repo: 8 files, 106 passed. The other tests that read quickjs-runner.ts from disk or pin its arms: packages/rest error-response-sandbox-arm-message, rest-sandbox-declared-status, rest-hook-script-fault-envelope (3 files, 120 passed); packages/core import-runner-sandbox-refusal-row (23 passed).
  • check:doc-authoring, check:docs-transcript-drift (4 transcript values), check:doc-anchors exit 0 after the validating-metadata.mdx row.
Round 1 — package tests and typecheck (at `f34867b93d`; round 2 changed no lint or runtime source)
  • pnpm --filter @objectstack/lint typecheck exit 0; pnpm --filter @objectstack/lint exec vitest run: 218 files, 9200 tests, 2 red in runtime-gate.object-writes.test.ts (the object roster pins), fixed in this PR; re-run of that file and the new file: 69 passed.
  • pnpm --filter @objectstack/runtime typecheck exit 0; vitest run src/sandbox: 47 files, 497 passed; the edited pin file: 6 passed.
  • packages/metadata-protocol runtime-authoring-gate files: 13 files, 320 passed.
  • Ablations as listed under Tests (round 2 adds a registry entry, a changeset, a docs row and test samples: no tested behaviour changed, so no new ablation).
Dogfood battery (owed by the narrowing arm) — on the final head

At 15faf1da07: packages and examples built under the lock (exit 0), pnpm --filter @objectstack/dogfood test: VERDICT command-exit 0, Test Files 479 passed | 3 skipped (482), Tests 4072 passed | 68 skipped (4140). (Also green at bc80b37795 with the same counts.)

Derived gates (`dispatch-gates --commands` at the final head, 118 commands)

All 118 exit 0 at 15faf1da07, after the full build, including check:type-check-debt (0 ledger entries above their measurement), check:dts-closure, check:dual-build-cjs-loads, check:test-source-alias, the spec projections (check:spec-changes, check:upgrade-guide, check:api-surface, check:authorable-surface) and check:kernel-hook-pairs. dispatch-gates --ran with each exit code recorded: 118 derived, 118 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero). overlap-check: origin/main merges cleanly; text conflict with #34791 only, on the rule-count transcript lines and the validating-metadata.mdx table (left for whichever lands second).


Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz

…r is refused, and answers naming itself

WIP: rule, registry entry, explanation, runner wiring.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
…r catalog and the rule count

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
@github-actions github-actions Bot added size/l 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 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/lint, @objectstack/runtime, @objectstack/spec, touching 25 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/lint/src/index.ts, packages/lint/src/runtime.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/deployment/validating-metadata.mdx (via AUTHORING_RULES (symbol, a top-level const object), runtimeTypes (symbol, a field of const object AUTHORING_RULES))
What this run could not see
  • 2 changed file(s) yielded no anchor (packages/lint/src/index.ts, packages/lint/src/runtime.ts) — pages documenting those are invisible to this run
  • 14 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 — 178 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 9e71ef829f28aeb17a65390f9487b37c49dc8449 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from ca061756b1713590e7a86b86265533ec362d5582 — the merge of head 15faf1da07c5b4811bb16eb31444c5ba0651106b into base 9e71ef829f28aeb17a65390f9487b37c49dc8449, 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 ca061756b1713590e7a86b86265533ec362d5582 && git checkout ca061756b1713590e7a86b86265533ec362d5582
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9e71ef829f28aeb17a65390f9487b37c49dc8449 15faf1da07c5b4811bb16eb31444c5ba0651106b && git checkout -B drift-repro 9e71ef829f28aeb17a65390f9487b37c49dc8449 && git merge --no-ff 15faf1da07c5b4811bb16eb31444c5ba0651106b

node scripts/docs-audit/affected-docs.mjs --json 9e71ef829f28aeb17a65390f9487b37c49dc8449

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

…tion-body-compile

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa

L1 review (L1-d) · 2026-11-17T21:07Z

L1: REWORK
Head-sha: f34867b93d61caf5b11ae77e7733369e7b6a8f16

Read against claim 6957893698, amendment 6960995968 (the seat's ruling B, 21:04Z) and os-dev report 6960939459 on #34884.

  • Size: 18 files, +548/-6.
  • Not governed: 0 of 18 paths on the register, 554 lines.
  • CI at this head: still running (17 success, 10 skipped, 39 in progress, 0 failed).
  • Claim surface: the 18 files are inside the original claim: lint and its rule ripples (index, rule-explanations, the runtime roster pin, and the four "rules (71)" transcript lines), the sandbox runner and its test, the authoring and error-catalog docs, and the changeset.

The code holds. The REWORK is only because the seat's ruling B came after this head and is not in it yet.

What holds

  • Closing keyword. It fixes the card's two asks.
    • Author time: action-body-does-not-compile (gating, error) compiles each L2 type: 'script' action body inside actionBodyFunctionExpression(source), which is (async (input, ctx) => { SOURCE }). It compiles with node:vm Script (falling back to new Function, or no verdict when the host refuses to compile at all). It never runs the body: a source that closes the wrapper early only compiles.
    • The rule runs on validate, build, lint and verify, and at the action and object publish doors, charging a write only with the bodies it adds.
    • The card's const input = ctx.input || {} is refused byte for byte. The finding gives line 1 and a hint naming the wrapper parameter.
  • One wrapper. The QuickJS runner now builds its wrapper from the same actionBodyFunctionExpression, imported through @objectstack/lint/runtime. That entry is dependency-free and runtime already depends on lint. The wrapper text is byte-identical to before. The ⛔ comments on both sides forbid a second spelling.
  • The engine difference is handled honestly. Only a host-refused regular-expression literal is a warning (V8 refuses duplicate named groups, QuickJS runs them, and both were measured over a 36-body probe). Syntax the host accepts but QuickJS does not becomes a missed finding, never a false one.
  • Run time.
    • An evalCode SyntaxError on an action is a compile failure: the async arrow cannot throw synchronously, so anything the body throws crosses __error instead. It now answers 500 INTERNAL_ERROR with a sentence naming the action and the compiler's reason (240 characters at most), where it used to answer the bare "Internal server error".
    • A runtime crash, including a JSON.parse SyntaxError, keeps the sanitised 500, and that is pinned.
    • No code is declared, so the doors relay the sentence.
  • Ablations. Neutering the lint check turns 9 of 14 red. Disabling the runtime compile branch turns both compile pins red. Both were restored by blob.
  • Live. validate, build and verify exit 1 naming the rule. REST and MCP answer with the naming sentence. Meta PUT gives 422 INVALID_METADATA and a control body gives 200. The examples app-todo, app-crm and app-multi-package have 0 hits.
  • Dogfood. The battery passed at 1190befe (the two later commits touch only one runtime test the battery does not read).

Must-fix

  • M1: the seat's ruling B is not in this head. Amendment 6960995968 moves Metadata-protocol from none to narrowed. It requires an ADR-0087 semantic migration entry under packages/spec/src/migrations/entries/semantic/ (shaped like 18.lookup-filter-record-path-multi-valued-refused.ts, plus whatever the roster requires) and a @objectstack/spec line in the changeset. At this head the changeset still says Metadata-protocol: none with the adr-0087: not-required (no-migration-prescription) marker, and nothing under packages/spec changes. Please push the entry and the changeset update, and re-run the ADR-0087 registration gate and changeset-no-major. I'll do a delta read on that head.

Should-fix

None.

Notes

  • N1: There is a known text conflict with fix(spec,metadata-protocol)!: retire the seed modes insert and replace, which inserted every record again on each replay #34791 on the four "author-time rules (70 → 71)" transcript lines, since both add a rule. Whichever lands second bumps to 72 on its merge-forward. check:docs-transcript-drift will name it if anyone forgets.
  • N2: Hook and job bodies (the (async (ctx) => …) wrapper) stay out, per the seat, and triage files the follow-up. The changeset says "Hook and job bodies are unchanged."
  • N3: Clause-②: no (narrowing) will need the contract-review-tier review the claim names before the queue.

Landing: not governed. After M1 come the L1-d delta, the seat's narrowing review, and fully green CI on the final head. Then area o3-C lands it.

…compile refusal

The refusal narrows what the authoring doors accept, so the changeset now
declares Metadata-protocol: narrowed, carries the registered marker and the
precedent's BREAKING scope, FROM -> TO, Fix and measured exposure, and grades
@objectstack/lint and @objectstack/spec minor.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
…our-doors table

The rule runs on validate, build and lint, and at the publish door for action
and object writes; the table had no row for it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
…andbox fault census

The census renders every SandboxError construction in quickjs-runner.ts; the
new action compile-failure site interpolates actionName and compilerError, so
the crash samples carry one value for each.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
…tion-body-compile

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa

L1 delta review (L1-d) · 2026-11-17T23:21Z

L1: ACCEPT
Head-sha: 15faf1da07c5b4811bb16eb31444c5ba0651106b

This is a delta read from my REWORK at f34867b9 (6961046043). The PR's own commits since then are 3d9dc01f, bc80b377 and 578e6860. The rest is two merges of origin/main (eabc6b30, 15faf1da). The ^[-+] lines of 578e6860 and of 15faf1da, each against its own merge base, are identical.

Must-fix

None. M1 (seat ruling B, amendment 6960995968) is in this head:

  • packages/spec/src/migrations/entries/semantic/18.action-body-does-not-compile-refused.ts follows the shape of 18.lookup-filter-record-path-multi-valued-refused.ts: id, surface, replacement, reason, acceptanceCriteria, measured first-party exposure zero, and "not converted" with its reason. It names both surfaces (actions[].body.source and inline objects[].actions[].body.source) and the doors. It keeps the regex-literal warning carve-out, and it states that hook and job bodies are not judged.
  • The changeset:
    • Metadata-protocol: narrowed.
    • The marker is now adr-0087: registered action-body-does-not-compile-refused.
    • @objectstack/lint and @objectstack/spec are minor, and @objectstack/runtime is patch.
    • The BREAKING paragraph is scoped to "an action body that never ran", and it carries FROM → TO, the Fix, and the first-party exposure.
    • A Skills-docs: follow-up owed line names data-hooks.md.
    • The dev's check:adr-0087-registration and changeset-no-major exit 0, and the post-patch Check Changeset run (22:26Z) is success.

Should-fix

None.

Notes

  • bc80b377 adds one row to the four-doors table in validating-metadata.mdx for the rule, including the object-write arm. That is a docs page listing lint rules, so it is inside the claim surface.
  • 578e6860 adds actionName and compilerError samples to CRASH_SAMPLES in packages/core/src/utils/import-runner-sandbox-fault-row.test.ts. That census covers the new interpolation site in quickjs-runner.ts, so it is a test of the claimed sandbox change ("their tests"). It adds samples and loosens no assertion.
  • N1 and N2 from the REWORK still hold. The 70→71 transcript conflict with fix(spec,metadata-protocol)!: retire the seed modes insert and replace, which inserted every record again on each replay #34791 goes to whichever lands second, and the hook and job wrapper follow-up stays with the seat.
  • CI on this exact head: 62 success, 14 skipped, 1 in progress, and 1 failure. The failure is the Check Changeset run at 22:24Z, from before the body patch. The run at 22:26Z is success. check-governed-merges --branch: NOT governed, 20 files, +605/-6.

Landing: not governed. The seat's narrowing L2 runs next, on this head. Area o3-C lands it after that passes and CI is fully green. A later push owes a delta read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG

Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head 15faf1da07c5b4811bb16eb31444c5ba0651106b · 2026-11-17T23:26Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 15faf1da07c5b4811bb16eb31444c5ba0651106b
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/18.action-body-does-not-compile-refused.ts + packages/lint/src/validate-action-body-compiles.ts, packages/lint/src/action-body-wrapper.ts, packages/lint/src/authoring-rules.ts, packages/lint/src/rule-explanations.ts, packages/lint/src/index.ts, packages/lint/src/runtime.ts, packages/runtime/src/sandbox/quickjs-runner.ts

Read for this record: card #34884 (body and all six comments, the 21:04Z ruling B as carried by claim amendment 6960995968), PR #34980 (body, 20 files, net diff against merge base 9e71ef829f), and the check-runs on the head. Code outside the diff was read, not reviewed: collectActionBodies (validate-action-body-writes.ts), runtime-gate.ts (snapshot set and differential), runtime-authoring-gate.ts (D1 to D4), body-runner.ts (actionBodyRunnerFactory), registry-object-registration.ts (attachBoundActions), SemanticMigration in migrations/types.ts, the precedent entry 18.lookup-filter-record-path-multi-valued-refused.ts, .changeset/config.json.

Check-runs on the head: every completed run is success or skipped except one Check Changeset failure completed 22:24:02Z; two later Check Changeset runs on the same head (22:26:57Z and 23:21:44Z) are success, so the failure is superseded. Test Core 10/10 shards, Test UI 16/16 shards, TypeScript Type Check, Lint and Repo Gates, Build Core, Build Docs, Dogfood Regression Gate, Spec property liveness and Governed Surface Queue Guard are success.

① Derived judgments

  • Accept-set, CLI doors (narrowed, right). An action with type: 'script' (or no type, the schema default) and body.language: 'js' whose body.source does not compile as (async (input, ctx) => { SOURCE }) is refused at error by os validate, os build and os lint (commands: ALL, tier: 'gating'). The walk is collectActionBodies: stack.actions[] and stack.objects[].actions[], a merged action once. This is the population the runtime binds: actionBodyRunnerFactory binds a body only for type ?? 'script' equal to script, and the runner wraps only an L2 body. Expression bodies, non-script actions, hooks and jobs are not walked. Right, and exactly the entry's surface.
  • Accept-set, publish door (narrowed, right). runtimeTypes: ['action', 'object']. object_extension is correctly absent: ObjectExtensionSchema refuses actions by guidance, so no third write type carries an action body. The gate judges state: 'active' only (D1), so a draft save of such a body is still admitted and its publish is refused, the same posture as every other door rule and the entry's "saved or published" wording, which is the precedent's.
  • Accept-set, object write carrying a stored body unchanged (narrowed, right as declared, stated here because the PR's account is narrower than the tree). The differential is candidate minus a baseline that drops the written item, and the stored self's own findings never cancel (runtime-gate.ts, buildRuntimeWriteSnapshotSet). So an object publish that carries a non-compiling inline body is refused whether or not this write changed that body, including a body stored before the rule and a write-back of a served read that attached it (attachBoundActions). The pinned case "an unrelated write is not charged" covers a write of ANOTHER object only. This is the entry's declared surface ("PUT /api/v1/meta/object/NAME with inline actions") and the same posture every gating object rule has at this door (D4: new writes are blocked, stored rows keep being read, OS_ALLOW_UNLINTED_METADATA_WRITES=1 for a migration window). See N1.
  • Advisory arm (right). A host SyntaxError whose sentence opens Invalid regular expression is warning, never a refusal. This is the one measured place where a host refusal does not predict a QuickJS refusal, and the entry, the explanation and the docs all say it.
  • No verdict (right direction). A host that will not compile at all, or that throws anything other than a SyntaxError, yields no finding. On Node 22.0 to 22.2 (inside engines, before process.getBuiltinModule) the Function fallback compiles the text as a function body, which accepts strictly more than a script (new.target, a return after an early close), so it can miss a finding and cannot invent one.
  • Engine disagreement (accepted on the dev's measurement). The rule's verdict is the host engine's, the runtime's is QuickJS. Host accepts and QuickJS refuses: a missed finding, answered at run time by the naming 500. Host refuses and QuickJS accepts outside regular expressions: a false refusal. I found no realistic case by reading (redeclarations, grammar, strict-mode and new.target errors are early errors in both), and the 36-body probe found none; it is a measured claim, not a proof, and read-only I did not re-run it.
  • Public surface, @objectstack/lint (additive, right). . gains validateActionBodyCompiles, hostCompileFailure, ACTION_BODY_DOES_NOT_COMPILE, ACTION_BODY_PARAMETERS, actionBodyFunctionExpression and the types ActionBodyCompileFinding, HostCompileFailure; ./runtime gains actionBodyFunctionExpression only. action-body-wrapper.ts has no imports, so the kernel-safe entry gains no dependency. The changeset names every one.
  • Public surface, @objectstack/spec (additive, right). One semantic entry in the 18 step; the registry is generated and uncommitted, so no other spec file moves.
  • Run-time answer, @objectstack/runtime (changed, right). For origin.kind === 'action' only, an evalCode error named SyntaxError becomes SandboxError(status 500, no code) with operator line action 'NAME' does not compile: … and a caller sentence; REST answers 500 INTERNAL_ERROR with that sentence (pinned through the real /actions door). Hook and job bodies keep threw: and the sanitised answer. The wrapper text the runner evaluates is byte-identical to before ((async (input, ctx) => { ${source} })).

② Semver level

Clause-②: no (narrowing) — present on the PR body and in the changeset, with Metadata-protocol: narrowed and the marker adr-0087: registered action-body-does-not-compile-refused in both places the gates read.

@objectstack/lint minor, @objectstack/spec minor, @objectstack/runtime patch. Right: lint publishes new exports and a new gating rule, spec publishes a new registry entry, runtime changes one error answer and imports an existing dependency's new export, with no new export of its own. All three sit in the one fixed group, so the release level is the group's minor. It matches both precedents the PR cites (34378, 33435: lint minor, spec minor, narrowing under ! with no major), and Check Changeset is success on the head (22:26:57Z and 23:21:44Z; the 22:24:02Z failure predates the body patch).

③ Boundary flags

  • Open question 1, Metadata-protocol none or narrowed. Answered by the seat's ruling B; in this head (entry, changeset line, marker). Closed.
  • Open question 2, hook and job bodies. Answered: out of this PR. The tree agrees (the rule walks actions only, the runner's new branch is gated on kind === 'action'). The follow-up card is reported "noted, not filed" in both dev reports: owed by the seat or triage, not by this head.
  • Open question 3, the object door. Answered: keep it. I agree. An object write is the second place a body is published and object_extension cannot carry one, so ['action', 'object'] is the whole set. Its cost is the third bullet of ① and N1.
  • Skills-docs follow-up on skills/objectstack-data/references/data-hooks.md: declared on the PR body and the changeset, not filed. Owed by the seat.
  • No user-text catalog for the rule. Accepted: the door renders the finding's message and hint, which name the action, the compiler's sentence and the line.
  • Text conflict with fix(spec,metadata-protocol)!: retire the seed modes insert and replace, which inserted every record again on each replay #34791 on the rule-count transcript lines and the validating-metadata.mdx table: a landing-order matter for the seat; check:docs-transcript-drift names it if missed.
  • Docs drift check listed validating-metadata.mdx; the head adds the rule's row there.
  • SQL push-down. Not applicable: the diff reads no data, materialises no ids and joins nothing.
  • Security. The author-time check compiles untrusted source on the host and never runs it: new vm.Script compiles only, the Function fallback constructs and discards, and the early-close case is pinned as not executing. The run-time sentence relays the first line of QuickJS's compile error, capped at 240 characters; a compile error carries no record data.

④ Design judgment

packages/spec/src/migrations/entries/semantic/18.action-body-does-not-compile-refused.ts (hits). Read against the ruling, the precedent entry and its first consumer, the rule.

  • surface: the two paths are the paths collectActionBodies emits (actions[N].body.source, objects[N].actions[N].body.source); "type script whose body.language is js" is its filter; the doors named are the gate's (item save, object save, publish-drafts, per-item publish) and the three commands. Holds.
  • replacement: var input = … compiles (pinned); 422 INVALID_METADATA is the gate's envelope (D3); the regular-expression sentence is the code's warning arm. Holds.
  • reason: the parse check's different wrapper is pinned by the test that compiles the card's body inside async function __body(ctx); "from the same function" is true of quickjs-runner.ts; "Hook and job bodies … are not judged" is true; "no stored row changes shape" is true, since nothing is converted and stored rows keep being read. Holds.
  • acceptanceCriteria: checkable by an author with a CLI (os validate / os build) and by a runtime author (the PUT and the action run). Holds.
  • Upgrade of an existing package, which the brief asks about: a built artifact holding such a body still boots and installs (the gate judges writes, not reads; the dev booted a pre-rule artifact), its runs answer the naming 500 where they answered the opaque one, os build of the source now exits 1 until the body is fixed, and any publish that carries the body is refused. The entry states the build and publish halves and not the "still loads, now answers naming itself" half; the changeset does. See N2.

validate-action-body-compiles.ts. Agrees with the entry. Line N of the finding is line N of body.source because the wrapper keeps the source on its first line. The parameter hint fires only for input / ctx. Tried to break it: a body that closes the wrapper early compiles and does not execute (pinned); a non-SyntaxError from the host is no verdict; a redeclaration through var or a nested function is admitted, as QuickJS admits it. See N3 and N4.

action-body-wrapper.ts, index.ts, runtime.ts. One spelling, no imports, exported on both entries as the changeset says. Agrees.

authoring-rules.ts. gating on all three commands, CLI_AND_RUNTIME, ['action', 'object']. Agrees with the entry and the docs row. The rule reaches the kernel path without typescript / sucrase (its only sibling import is the dependency-free walk), which is why it may cross where the other body rules may not. See N1.

rule-explanations.ts. Agrees with the module and the runner, including the sentence that host-accepted syntax QuickJS refuses is answered at run time.

quickjs-runner.ts. The branch is gated on the action kind and on the error's name; the control case (a SyntaxError thrown by JSON.parse while running) stays a sanitised crash and is pinned. The sentence is in the caller's language: it names the action, says it cannot run, gives the compiler's reason and says who must act. The card asked for "a 4xx/5xx with a code, never a bare Internal server error": the answer is 500 with the status's own INTERNAL_ERROR and a naming message, so a caller tells a compile failure from a crash by the message, not by the code; the runner's comment gives the reason no code is declared (a declared 5xx code would withhold the sentence), and the door test pins the outcome. Accepted. See N5.

No must-fix, no should-fix.

Nits (none moves correctness or the contract; none is owed on this head):

  • N1 (nit) — authoring-rules.ts, the registration comment: "the differential charges a write only with the bodies it adds" is narrower than the code. A write is charged with every non-compiling body the written item CARRIES, changed or not; only another entry's findings cancel. The behaviour is the declared one; the sentence is not. Left as an accepted deviation, or corrected in a later touch of the file.
  • N2 (nit) — the entry does not say that an already deployed body keeps loading and now answers a 500 naming itself, nor that an object publish is refused while it carries such a body unchanged; the changeset and the docs say the first. A sentence in reason would carry both into the upgrade guide.
  • N3 (nit) — validate-action-body-compiles.ts: V8 reports an unterminated regular-expression literal as Invalid regular expression: missing /, which takes the warning arm although both engines refuse it. A missed refusal inside the declared advisory arm, answered at run time.
  • N4 (nit) — the same module's header says the run-time answer is "a coded 500"; the runner declares no code and says so. One of the two sentences should match the other.
  • N5 (nit) — isCompileFailure's comment says a SyntaxError at evalCode is always the compiler's. A body that closes the wrapper early and calls something synchronously in the argument list can throw one while running, and it would be answered with the naming sentence. Only a body written to escape the wrapper does this, and its author can already return any text as the action's result.

Implemented-by: claude/issue-34884-action-body-compile
Reviewed-by: session_01WGufzgh1zkZzDXL36ckWAG

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz

Landing · area o3-C · head 15faf1d

Probe Reading
check-governed-merges.mjs --pr 34980 NOT governed; 611 changed lines (+605/−6) ≤ 3000 → Tier S
Review L1-d delta ACCEPT 6963945447 at 15faf1d (closes REWORK M1, seat ruling B); seat narrowing contract review (CONTRACT_REVIEW_TIER) PASS 6964237524 at 15faf1d, no must-fix or should-fix
Narrowing Clause-②: no (narrowing), Metadata-protocol: narrowed, ADR-0087 entry action-body-does-not-compile-refused registered; dogfood battery on this exact head (os-dev-report 6963874260: 479 files, 4072 tests, exit 0)
Open findings nits only (contract review N1–N5). N1, "charges only the bodies it adds" vs. every carried body, is corrected in the PR body; the authoring-rules.ts comment is left for a later touch of the file (no push, so the battery and L1 stay on this head). Follow-ups: #34987 (hook and job bodies), #34988 (data-hooks.md, blocked on #34504)
CI K = 7 (< 15, no branch update); every run on 15faf1d completed success or skipped, apart from one Check Changeset failure at 22:22Z, from before the body patch. Three later Check Changeset runs on the same head passed (22:24Z, 23:20Z, 23:38Z). Mergeable

Dev-effort: high · Rounds: 2

State: ready + auto-merge now; on MERGED, #34884 closes via Fixes and its pm:* state label comes off. The #34791 rule-count transcript conflict goes to whichever lands second.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 23:44
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
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/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants