Repository navigation
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
Conversation
…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
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
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
…door pins Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
📓 Docs Drift CheckThis PR changes 3 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 178 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 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
|
…tion-body-compile Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 review (L1-d) · 2026-11-17T21:07ZL1: REWORK Read against claim 6957893698, amendment 6960995968 (the seat's ruling B, 21:04Z) and os-dev report 6960939459 on #34884.
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
Must-fix
Should-fixNone. Notes
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
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 delta review (L1-d) · 2026-11-17T23:21ZL1: ACCEPT This is a delta read from my REWORK at Must-fixNone. M1 (seat ruling B, amendment 6960995968) is in this head:
Should-fixNone. Notes
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. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: 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 Check-runs on the head: every completed run is ① Derived judgments
② Semver levelClause-②: no (narrowing) — present on the PR body and in the changeset, with
③ Boundary flags
④ Design judgment
No must-fix, no should-fix. Nits (none moves correctness or the contract; none is owed on this head):
Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz Landing · area o3-C · head 15faf1d
Dev-effort: high · Rounds: 2 State: ready + auto-merge now; on MERGED, #34884 closes via |
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) => { … })passedos validate,os build,os lint,os verifyand the runtime publish door; it is now refused there asaction-body-does-not-compileaterror(on the publish door foractionwrites and forobjectwrites carrying inlineactions[]). One arm advises instead of refusing: a regular-expression literal the host engine refuses is awarning. Such a body never ran: every run failed with a SyntaxError before its first statement.@objectstack/lintalso gains exports (validateActionBodyCompiles,hostCompileFailure,ACTION_BODY_DOES_NOT_COMPILE,ACTION_BODY_PARAMETERS,actionBodyFunctionExpressionand two finding types on.,actionBodyFunctionExpressionon./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 declareinput/ctxagain); follow-up #34988 (blocked on #34504, which holds that file); this PR teaches it incontent/docs/ui/actions.mdxandcontent/docs/automation/hook-bodies.mdx.维护者速读
body.source如果在运行时的包装(async (input, ctx) => { … })里编译不过(最常见是const input = ctx.input || {}重复声明参数),现在os validate/os build/os lint/ 发布保存(动作写入和对象写入)都会报错拒绝,点名动作、编译错误和行号;运行时若仍遇到这种动作,REST/actions与 MCPrun_action回答500 INTERNAL_ERROR,消息点名动作和编译错误,不再是光秃秃的 "Internal server error"。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
@objectstack/lint) — new gating ruleaction-body-does-not-compile(validate-action-body-compiles.ts). It compiles each L2 action body insideactionBodyFunctionExpression(source), the wrapper the runtime builds, from the same function, with the host engine, as a script, never running it (node:vmScript; theFunctionconstructor wherenode:vmis absent; no verdict where the host refuses to compile at all). The finding names the action, the compiler's sentence and the line ofbody.source; a redeclared wrapper parameter gets a hint naming it. Registered inauthoring-rules.tsasgatingon all three commands and on the runtime publish door foractionandobjectwrites;os explain action-body-does-not-compileadded; barrel exports added. The object door's roster pin inruntime-gate.object-writes.test.tsnames the join.packages/lint/src/action-body-wrapper.tsholds the one spelling,(async (input, ctx) => { SOURCE }).quickjs-runner.tsnow 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.@objectstack/runtime) — when evaluating an action's wrapper fails with aSyntaxError(a compile failure: an async body cannot throw synchronously, so anything the body itself throws crosses__errorinstead), the runner throws aSandboxErrorwithstatus: 500, no code, the operator lineaction 'NAME' does not compile: SyntaxError: …and the caller sentenceAction '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 ownINTERNAL_ERRORand relay that sentence. A crash while running (aTypeError, aSyntaxErrorthrown byJSON.parse) keeps the sanitised 500. Hook and job bodies are unchanged.@objectstack/spec) — the ADR-0087 semantic entrypackages/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 andos migrate meta; the generated registry picks it up, no other spec file changes. The changeset declaresMetadata-protocol: narrowed, carriesadr-0087: registered action-body-does-not-compile-refused, and grades@objectstack/lintand@objectstack/specminor,@objectstack/runtimepatch.content/docs/automation/hook-bodies.mdxandcontent/docs/ui/actions.mdxteach the rule;content/docs/api/error-catalog.mdxgains 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.mdxgains the rule's row in the four-doors table (✓ ✓ ✓ ✓ᵃᶜᵒ: the three commands, and the publish door foractionandobjectwrites).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 ctxon line 3; an unparseable body;new.target; four bodies that compile (var input, readinginput, …) admitted; the regex arm atwarning; 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/linteach refuse; theactionandobjectpublish 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/actionsdoor answers500 INTERNAL_ERRORwith the sentence, notInternal server error; control: a runtimeSyntaxErrorstays a sanitised crash.packages/core/src/utils/import-runner-sandbox-fault-row.test.ts(round 2): the census that renders everySandboxErrorconstruction inquickjs-runner.tsgains crash samples for the new site's two interpolations,actionNameandcompilerError; 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 onbc80b37795(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 validateexit 0,os buildexit 0,os verifyexit 0 ("verify passed — no runtime failures").POST /api/v1/actions/OBJ/ACTION/ID:500 {"code":"INTERNAL_ERROR","message":"Internal server error"}.run_action:{"error":{"code":"INTERNAL_ERROR","message":"Internal server error","status":500}}.PUT /api/v1/meta/action/NAMEwith that body:200saved active.ERROR [BodyRunner] sandboxed action threw … action 'rpc_decide' threw: SyntaxError: invalid redefinition of parameter name, thensandboxed body crashed: ….os validate(every author-time door shares the registry).After (this branch, the pre-fix artifact booted with
-ato stand for a body deployed before the rule):os validate/os build/os verifyexit 1,action-body-does-not-compileatactions[0].body.source("SyntaxError: Identifier 'input' has already been declared, line 1").500 INTERNAL_ERROR, messageAction '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_METADATAwith the rule's issue; a body usingconst params = ctx.input || {}saves200.action 'rpc_decide' does not compile: SyntaxError: invalid redefinition of parameter name.return { ok: true }:200both times.Engine probe (36 bodies, Node 22 V8 vs the runtime's QuickJS)
Agreed on every redeclaration, grammar error, strict-mode error,
superandnew.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 regexwarningarm.Ablations (each restored to blob == HEAD, `git diff HEAD` empty)
validate-action-body-compiles.ts:if (!failure) continue;→if (!failure || site) continue;viascripts/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.src/(relative), so no dist rebuild sits between the mutation and the run.Acceptance notes
const input = …in a script action) passes validate, build and verify, then answers every run_action with an opaque 500 INTERNAL_ERROR #34884): the semantic entry above, in the precedent's shape (.changeset/34378-lookup-filter-record-path-multi-valued.md,.changeset/33435-injected-column-null-guard-at-build.md): BREAKING scope, FROM → TO, Fix, measured first-party exposure (zero).runtimeTypes: ['action', 'object'], kept by the seat's ruling): an object write carries inlineactions[], the second place a body is published, so an object write cannot republish a refused body inline. The publish gate charges a write with every non-compiling inline body the written object carries, changed or not (only another entry's findings cancel), so an object publish is refused while it still carries such a body, a body stored before this rule included; a write of another object is not charged with it (pinned). This is the surface the semantic entry declares. The registration comment inauthoring-rules.tsstill says "only the bodies it adds"; that sentence is left for a later touch of the file (seat contract review 6964237524, N1).(async (ctx) => { … })) are not judged and their run-time answer is unchanged (seat ruling: they stay out of this PR; follow-up lint: hook and job bodies get no compile check — the action-body-does-not-compile rule (#34884) covers script actions only #34987).*.user-text.ts) is authored for the new rule: the publish door renders itsmessage.overlap-check: merges cleanly).Verification
Head
15faf1da07(round 2:origin/mainmerged 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-registrythenvitest run src/migrations: 5 files, 198 passed (the generated registry carriesaction-body-does-not-compile-refusedonce).pnpm --filter @objectstack/spec run check:generatedexit 0 (14 generated artifacts up to date);check:adr-0087-registration --base origin/mainexit 0 (registered action-body-does-not-compile-refused (new here));check:changeset-no-majorexit 0;check:issue-citationsexit 0.pnpm --filter @objectstack/core exec vitest run --project repo src/utils/import-runner-sandbox-fault-row.test.ts: before the samples (onbc80b37795) VERDICT command-exit 1, 1 failed / 44 passed, the census namingquickjs-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 readquickjs-runner.tsfrom disk or pin its arms:packages/resterror-response-sandbox-arm-message,rest-sandbox-declared-status,rest-hook-script-fault-envelope(3 files, 120 passed);packages/coreimport-runner-sandbox-refusal-row(23 passed).check:doc-authoring,check:docs-transcript-drift(4 transcript values),check:doc-anchorsexit 0 after thevalidating-metadata.mdxrow.Round 1 — package tests and typecheck (at `f34867b93d`; round 2 changed no lint or runtime source)
pnpm --filter @objectstack/lint typecheckexit 0;pnpm --filter @objectstack/lint exec vitest run: 218 files, 9200 tests, 2 red inruntime-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 typecheckexit 0;vitest run src/sandbox: 47 files, 497 passed; the edited pin file: 6 passed.packages/metadata-protocolruntime-authoring-gate files: 13 files, 320 passed.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 atbc80b37795with the same counts.)Derived gates (`dispatch-gates --commands` at the final head, 118 commands)
All 118 exit 0 at
15faf1da07, after the full build, includingcheck: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) andcheck:kernel-hook-pairs.dispatch-gates --ranwith each exit code recorded: 118 derived, 118 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero).overlap-check:origin/mainmerges cleanly; text conflict with #34791 only, on the rule-count transcript lines and thevalidating-metadata.mdxtable (left for whichever lands second).Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz