Skip to content

docs(skills): data-hooks teaches the hook and job js-body compile refusal - #35746

Closed
objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/issue-35714-data-hooks-compile-refusal
Closed

objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/issue-35714-data-hooks-compile-refusal

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread
Fixes #35714

Clause-②: no
Metadata-protocol: none
Skills-docs: updated here

维护者速读

  • 用户能看到什么变化:装了数据技能的应用作者(多数是 AI)在写钩子脚本时会知道,脚本编译不过会在校验、构建和保存时被拒,并且知道怎么改;平台行为不变。
  • 为什么做:属于「已发布技能文档跟上平台行为」这条线,平台前一步已经开始拒收编译不过的钩子和定时任务脚本,技能页还没写这条。
  • 出错会怎样:如果技能页写错,作者会按错误说法写脚本并在校验时碰壁;只改文字,撤回这一个合并即可。
  • 要你做什么:无。

What changes

skills/objectstack-data/references/data-hooks.md, section "Sandbox restrictions", gains one bullet after "Rejected by objectstack build":

  • Refused when it does not compile: a js source is compiled, unrun, inside its (async (ctx) => { … }) wrapper, where ctx is already declared. So const ctx = ctx.input || {}; (or let ctx, one name declared twice, any syntax error) is hook-body-does-not-compile: an error from os validate, os build, os lint and a runtime hook save (422 INVALID_METADATA), naming the hook, the SyntaxError and its line. Fix: use ctx as it is, or rename the local (const input = ctx.input || {};). A job's js body runs in the same wrapper: job-body-does-not-compile, from the three commands. A regex pattern only the checking engine refuses is a warning.

It names both rule ids, one minimal refused body and its repair, which is the card's Done-when.

skills/objectstack-data/evals/hooks-security-seeds-datasources.json gains case 33 at the end of the array (no other case touched): the refused const ctx = … body under os validate, graded on naming hook-body-does-not-compile and repairing through ctx.input.status.

A patch changeset for @objectstack/skills.

Job bodies. No published skill teaches a job js body: git grep -n -i -E "defineJob|jobs?\b" over skills/ at 598a34d finds jobs / defineJob only as a collection name (objectstack-automation/SKILL.md:5, skills/README.md:51, objectstack-platform/SKILL.md:36) and job as a service token; no file shows a job body. So the job sentence lives in this one bullet and no second file is edited.

One deliberate difference from the card's wording. The card says the "save door" refuses a hook or job body. Main refuses a job body at the three commands only: no door publishes a job (packages/spec/src/kernel/metadata-plugin.zod.ts:1040, allowRuntimeCreate: false; packages/lint/src/authoring-rules.ts:2986, runtimeTypes: ['hook']). The skill says exactly that.

Token budget (check-skills-token-ratchet, ceil(utf8 bytes / 4))

lines before lines after bytes before bytes after tokens before tokens after ceiling
data-hooks.md 888 885 40467 40445 10117 10112 10122 (row not moved)
all skills/**/*.md 18564 18561 858354 858332 214612 214607 n/a
all skills/*/SKILL.md 4861 4861 256347 256347 unchanged unchanged n/a

The bundle token figure is the sum of each file's own ceil(bytes / 4). Before-readings at 598a34d, after-readings at 03b9383. The eval file is measured by the gate and not ratcheted.

The new bullet is +9 lines, +691 bytes. It is paid in the same file, by the standing rule 「A:先削重复,余额按实测提高」 (ruling record 6513306068): six restatements removed, 713 bytes, each with its other home in the file. No remainder is left, so the ceiling row is not touched.

Removed Its other home in data-hooks.md
The body — Implementation stub under "Key Properties Explained" (a one-sentence pointer) the schema listing's body comment, "The body shape" (source is the function body), "Error Handling" (a throw aborts)
"(This is unlike ctx.input / ctx.result inside the body, which stay partial, see Gotcha 1.)" the ctx.input and ctx.result rows of the sandbox ctx table, and Gotcha 1
Listing comment "Matches the organization_id column + current_user.organizationId (RLS)" "Reading the current organization" (the blessed-read comment and the two-axes note)
Pattern 4's five-line static-masking note, shortened to two lines the "Why so few?" note (field masking belongs to field-level metadata, applied everywhere)
Pattern 4's comment "Never a session claim (ctx.session.roles is gone, ctx table above)" the ctx.session row of the sandbox table, and the HookContext listing comment on privilege
Best Practices "use before* for validation and after* for side effects" the "Purpose" row of "Before vs After Hooks" and the events table

Tests

Text only; no behaviour a test pins changed, so no ablation. Every taught fact was read on main (598a34d) and probed.

Facts and where main states them
  • Rule ids: packages/lint/src/validate-hook-body-compiles.ts:51 and :54.
  • The wrapper, (async (ctx) => { SOURCE }): packages/lint/src/action-body-wrapper.ts:52-54 (hookBodyFunctionExpression); the rule compiles inside it at validate-hook-body-compiles.ts:98 (hooks) and :120 (jobs); the runtime runs the body in the same expression at packages/runtime/src/sandbox/quickjs-runner.ts:435.
  • js bodies only: validate-hook-body-compiles.ts:73-76.
  • Doors: packages/lint/src/authoring-rules.ts:2980-2987 (tier: 'gating', commands: ALL, surfaces: CLI_AND_RUNTIME, runtimeTypes: ['hook']); pinned by packages/lint/src/validate-hook-body-compiles.test.ts:137-146 (validate, build and lint refuse the hook and the job) and :148-160 (the runtime publish door refuses a hook write and admits const input = ctx.input || {}).
  • 422 INVALID_METADATA at the runtime door: packages/metadata-protocol/src/runtime-authoring-gate.ts:1683-1684.
  • Severity split (a regular-expression pattern the host engine refuses is a warning, all else an error): validate-hook-body-compiles.ts:32-34, test :94-95.
  • What the author is shown (hook or job name, the SyntaxError, line N): validate-hook-body-compiles.ts:105-113, validate-action-body-compiles.ts:190.
Probe run on 598a34d (the rule called on one hook and one job per body)

tsx over validateHookAndJobBodyCompiles, after pnpm --filter @objectstack/spec build:

const ctx = ctx.input || {};   -> hook-body-does-not-compile error + job-body-does-not-compile error
   "body does not compile in the wrapper the runtime runs it in, (async (ctx) => { … }) (SyntaxError: Identifier 'ctx' has already been declared, line 1), so every run of this hook fails"
   hint: "`ctx` is already the parameter of the wrapper: use it as it is (the hook's record is `ctx.input`), or give the local another name, e.g. `const input = ctx.input || {}`"
let ctx;                        -> both ids, error
let x = 1; let x = 2;           -> both ids, error (Identifier 'x' has already been declared, line 1)
if (ctx.input.a { }             -> both ids, error (Unexpected token, line 1)
const r = /(?<a>x)|(?<a>y)/;    -> both ids, warning
const input = ctx.input || {};  -> no finding
language: 'expression' body     -> no finding

Acceptance notes

  • The teaching says "from the three commands" for a job and "a runtime hook save" for a hook; it does not say a job save is refused, because no such door exists on main.
  • os lint is named because the rule runs under it (commands: ALL); the neighbouring bullet's older "Rejected by objectstack build" wording is left as it is, outside this card.

Verification

Read first: the new bullet in skills/objectstack-data/references/data-hooks.md (line 340), then the six deletions in the same file's diff (each is a restatement, check its other home in the table above), then eval case 33.

Two-minute check: node scripts/check-skills-token-ratchet.mjs prints 59 authored bundle file(s) within their ceilings, and git diff origin/main...HEAD -- scripts/ is empty (no ceiling moved).

Local gates at 03b9383

node scripts/pm/dispatch-gates.mjs --commands derived 48 families; --ran reconciliation: 48 derived, 48 run, 0 UNRUN. 45 exited 0, among them:

✓ check-skills-token-ratchet: 59 authored bundle file(s) within their ceilings; 11 generator-owned file(s) and 39 eval fixture(s) measured, not ratcheted.
✓ check-skills-token-ratchet self-test: 104 cases pass.
✅ 10 generated files in sync with packages/spec            (check:skill-refs)
✅ Skill docs in sync                                       (check:skill-docs, outside the derivation)
✓ check-skill-served-sections: 24 served section(s) …      (outside the derivation)
✓ check-skill-links: 268 relative link(s) in 74 published skill file(s) resolve; 138 fragment(s) name a real heading
check-skill-identifier-liveness OK — Leg 1: 545 citation(s) over 74 published file(s)
✓ check-skill-id-lint: 130 file(s) clean
check-nul-bytes: OK
✓ No changeset from the merge base modified or deleted by this diff

NOT MEASURED locally (exit 3, PREREQUISITE NOT MET, each needs built packages this diff does not touch; CI builds them): check:doc-formula-expressions, check:dual-build-cjs-loads, check:lean-entry-closure, and check:skill-examples (outside the derivation; the diff adds no checked example block).

node scripts/pm/overlap-check.mjs: VERDICT clean exit 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgTRf6qBRCqPh4JZaZL

@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTRf6qBRCqPh4JZaZL

Area b1-D · 2026-11-20T05:11Z · final green head 03b9383fe650bc28ab46ddb14fb9c70bb118ea1d (l1-face CLEAN: 28 success, 16 expected skip, 0 failed, 0 pending). L1 is asked of thread L1-a on this head. The brief below goes to an isolated sub-agent at the contract tier; its record follows as a separate comment.

Brief handed to the contract reviewer — PR #35746 @ 03b9383fe650bc28ab46ddb14fb9c70bb118ea1d (card #35714)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template — with a PASS or FAIL verdict. Return the record as your final message; the area thread posts it as ONE comment on the PR.

Inputs — these and nothing else:
· card #35714: body and EVERY comment (rulings and earlier records included)
· PR #35746: its body, its file list, and the net diff against main at 03b9383fe650bc28ab46ddb14fb9c70bb118ea1d
· the check-runs on 03b9383fe650bc28ab46ddb14fb9c70bb118ea1d: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the paths reviewFace returns as hits on this PR's file list: skills/objectstack-data/references/data-hooks.md, skills/objectstack-data/evals/hooks-security-seeds-datasources.json;
plus every file IN THIS DIFF that directly implements or enforces them — none in this diff (the lint rule the text teaches is on main, read it there) — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The rest of the diff (the changeset) is the lane seat's ACCEPT at TIER_DEFAULT.
④ judges the hits files and those implementing files ONLY; code outside the diff is READ to judge them, never reviewed.

Security — if the change teaches security, auth or permission behaviour the path name doesn't show, the record says so on its Security-touching: line: write no ONLY when no changed hunk teaches permission, sharing, credential, token, authentication or other security behaviour, else yes.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family. If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated. SQL push-down: not applicable to a text diff unless you find otherwise.
④ Design judgment — for EVERY hits file: does each changed sentence hold against the rule it teaches on main (packages/lint/src hook and job body compile rule and its tests, the doors that run it, the wrapper the runtime compiles a body in)? Is the statement about job bodies (which doors judge them) true? Does the refused example really fail and its fix pass? Were the six same-file deletions genuine restatement, or did a rule lose its only home? Does the eval case assert what main does? Try to break the design.
Grade each finding must-fix, should-fix or nit. Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as No must-fix, no should-fix.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with claude/issue-35714-data-hooks-compile-refusal and Reviewed-by: with session_01L6bhgTRf6qBRCqPh4JZaZL — the value is the FIRST thing after each colon.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U

维护者速读

  • 用户能看到什么变化:对外发布的数据技能现在会告诉作者:钩子或定时任务的脚本如果在运行时的包装函数里编译不过(最常见的是把 ctx 又声明了一遍),检查命令会直接报错,保存钩子也会被拒,同时说明怎么改。这对应前一张 PR 已经上线的那条新检查。
  • 出错会怎样:只是文档和一条评测,不改任何运行行为。为了腾出篇幅删掉的六句话,我逐句确认过,在同一个文件的别处都还有,没有丢掉内容。
  • 要你做什么:这张 PR 动了对外发布的技能包,属于 Tier H,需要 os-zhuang 批准。L2 正在跑。

席位核对 — ACCEPT (L1-a) · repo:objectstack#1 · head 03b9383fe650bc28ab46ddb14fb9c70bb118ea1d · 2026-11-20T05:14Z

  • Shape — draft, base main, 1 commit, 3 files, +39/−17. Merge-base 598a34d0, which already holds fix(lint)!: refuse a hook or job body that does not compile in the (ctx) wrapper the runtime runs it in #35713 (merged), so the skill does not teach a refusal that main does not make. That is the card's ordering condition. check-governed-merges.mjs --pr 35746: GOVERNED, Tier H. The low-risk arm does not take it, because of the eval file name, as stated. Fixes/card skills: data-hooks.md teaches the hook/job js-body compile refusal (follow-up of PR #35713) #35714 (priority:p2, the owed Skills-docs: follow-up of fix(lint)!: refuse a hook or job body that does not compile in the (ctx) wrapper the runtime runs it in #35713). The changeset is @objectstack/skills at patch, with Clause-②: no and Metadata-protocol: none. That is right for text that teaches a shipped refusal.

  • The new bullet, checked against fix(lint)!: refuse a hook or job body that does not compile in the (ctx) wrapper the runtime runs it in #35713's code

    • The wrapper (async (ctx) => { … }) is compiled and never run (hookBodyFunctionExpression, judgeBodyCompile). const ctx = …, let ctx, a name declared twice and any syntax error all fall under hook-body-does-not-compile at error.
    • The three commands and a runtime hook save (422 INVALID_METADATA) refuse it: runtimeTypes: ['hook'], CLI_AND_RUNTIME.
    • The message names the hook and the SyntaxError, and adds , line N when the host names a line.
    • The fix text matches the rule's own hint (const input = ctx.input || {}).
    • The regexp-pattern arm is a warning.
  • The job sentence differs from the card, and the dev's reading is right. The card asked for "refused at save … for job bodies too". A job is allowRuntimeCreate: false, and the rule's registration comment in authoring-rules.ts says that no door publishes a job body. So job-body-does-not-compile comes from os validate, os build and os lint only, which is what the text says ("from the three commands"). Saying "refused at save" for a job would have taught a door that does not exist.

  • The six cuts that pay for it. Each one is still said elsewhere in the same file at this head:

    • The #### body — Implementation stub repeats § "Sandboxed Hook Bodies" (194 ff). Its "a throw aborts the write" is in the before/after table at line 61 ("throw error → rollback").
    • The "unlike ctx.input / ctx.result … see Gotcha 1" aside is covered by the ctx table at line 235 ("⚠️ partial on afterUpdate — see gotcha 1") and by Gotcha 1 itself (354).
    • The organizationId comment's "organization_id column + current_user.organizationId (RLS)" is covered by the "Two isolation axes" note at 489–491.
    • The static-masking paragraph is shortened, and keeps both of its rules.
    • The "⚠️ Never a session claim (ctx.session.roles is gone …)" code comment is covered by the ctx table at line 237 ("No role list — session.roles was retired in 17.0.0") and by the interface comment "never by a session claim".
    • The Best-Practices "before* for validation, after* for side effects" is the table's Purpose row at line 59.

    The file goes from 40467 to 40445 bytes, so it is smaller. The token row does not move.

  • The eval case (id 33) is the exact const ctx = ctx.input || {} body. It must contain hook-body-does-not-compile and the fix ctx.input.status. expected_output also rules out suppressing the rule and moving the logic to a deprecated handler. The JSON parses (33 cases).

  • Nit (nothing owed) — after its first clause was cut, Best Practices reads 「✅ DO — set async: true …」. It is grammatical, but it now opens on the least important item. Reordering is optional.

  • Gates — at this head: 28 success, 16 skipped, 0 failure. l1-face is CLEAN, as announced in 7031081784. The dev report is 7030783032.

  • Note for the thread — skills: data-hooks.md teaches the hook/job js-body compile refusal (follow-up of PR #35713) #35714 is priority:p2, so the same question as on docs(skills): teach the {current_iso_week} period key in the query filter rules #35743 applies: confirm that it was released from the 11-20 00:37Z p1-only order before landing.

  • Landing terms — Tier H. It needs the same-head ## Contract review PASS (an isolated reviewer, running) and os-zhuang's APPROVED. Then the owning thread lands it. A new push needs a fresh L1 unless it is a clean main merge.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTRf6qBRCqPh4JZaZL

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 03b9383fe650bc28ab46ddb14fb9c70bb118ea1d
Local-runs: none
Scope: skills/objectstack-data/evals/hooks-security-seeds-datasources.json, skills/objectstack-data/references/data-hooks.md + none
Security-touching: yes

① Derived judgments

  • Inputs read: card skills: data-hooks.md teaches the hook/job js-body compile refusal (follow-up of PR #35713) #35714 (body and its three comments 7028132257, 7030494506, 7030783032; the thread holds no ruling on this text and no earlier record), PR docs(skills): data-hooks teaches the hook and job js-body compile refusal #35746 (body, three files, net diff from merge base 598a34d04 to the head), and the 44 check-runs on the head (28 success, 16 skipped, none red, none pending). main is 03bce5c22; its one commit past the merge base touches no file cited below, so every file:line reads the same at both.
  • No accept set moves: right. The diff is one changeset and two files under skills/objectstack-data/, nothing under packages/. The refusal it teaches landed in PR fix(lint)!: refuse a hook or job body that does not compile in the (ctx) wrapper the runtime runs it in #35713 (5ecf93747 on main).
  • Public surface is the @objectstack/skills catalog text, one reference file and one eval fixture: right.
  • "A job body is refused at the three commands, not at a save", the PR's stated difference from the card's "the save door refuses a hook or job": right, judged in ④.
  • "No second skill file is owed for job bodies": right. At the head no published skill shows a job body; jobs and defineJob appear as collection names only (skills/objectstack-automation/SKILL.md:5, skills/objectstack-platform/SKILL.md:36).
  • "The ceiling row is not moved": right. scripts/ is not in the diff; the head blob is 40445 bytes, 10112 by the ratchet's count, under the 10122 row (scripts/check-skills-token-ratchet.mjs:1049). 43 bytes remain under the row, which bounds the repair of S1.
  • The regex severity as taught: wrong in its condition (S1). The eval's second token: wrong in its width (S2).

② Semver level

.changeset/35714-data-hooks-body-compile-refusal.md takes '@objectstack/skills': patch. Right: the package ships the skills/** tree (packages/skills/package.json, its description), the change is text, and Metadata-protocol: none takes patch (AGENTS.md:1018-1026). Clause-②: no and Metadata-protocol: none stand line-initial on both carriers and agree; no with no arm is right, because this diff narrows nothing itself. Check Changeset is green on the head. One consequence: the changeset body repeats the regex sentence of S1 word for word and ships as CHANGELOG.md, so the repair of S1 carries it along.

③ Boundary flags

  • Dev flag, "+9 lines against the suggested +8": accepted; the file is net 3 lines and 22 bytes shorter and inside its row (①).
  • Dev flag, card read with plain GETs because the fleet read wrapper refused: a process note with no effect on the tree; left with the seat.
  • Dev flag, four gates not measured locally and test:repo declared to CI: answered by the head's check-runs, none of which concluded red. The diff also gives none of the four a new subject: it adds or changes no os:check block (the hunks touch prose, the unmarked HookContext listing and Pattern 4's unmarked block), no formula expression and no package source.
  • Dev flag, attribution comment and signed trailer in the PR body: the PR-body guards run is green; no contract matter.
  • Dev flag, worktree base 598a34d04 and not a457b515: answered in ①; main has moved one commit since, off every file read here.
  • Dev's stated difference from the card (job at the three commands only): right, ④ item 6.
  • open_questions: empty; nothing to answer.
  • out_of_scope_findings, the sentence "the layout both real hook modules in the repo use" (main data-hooks.md:773): an unchanged line outside every hunk that gives no wrong answer at a door. Agreed as out of scope; the lane seat may card it. Not escalated.
  • security_findings: none stands as a finding count. The security line above still reads yes, because three changed hunks delete or shorten security teaching: main data-hooks.md:453-454 (the org id's match to the organization_id column and RLS current_user.organizationId), :663-667 (field masking for a permission set or position) and :677 (privilege is never read from a session claim). Each keeps another home (④), so nothing is lost, but the hunks do teach security behaviour.
  • Card Done-when: line 1 met (both ids, one refused body, its fix); line 2 met in form (case 33, see S2); line 3 met (PR fix(lint)!: refuse a hook or job body that does not compile in the (ctx) wrapper the runtime runs it in #35713 is on main).
  • PR author is objectstack-fleet[bot]; no off-relay author to name. SQL push-down: not applicable, the diff holds no query code.

④ Design judgment

The new bullet (head data-hooks.md:340-348, after main :342-346), sentence by sentence:

  1. "a js source is compiled, unrun, inside its (ctx) wrapper, where ctx is already declared": holds. js only: packages/lint/src/validate-hook-body-compiles.ts:73-76. Compiled inside the runtime's own expression: :98, built by packages/lint/src/action-body-wrapper.ts:52-54 with its one parameter at :44; the runtime calls the same function at packages/runtime/src/sandbox/quickjs-runner.ts:433-435. Never run: packages/lint/src/validate-action-body-compiles.ts:118-124, pinned at packages/lint/src/validate-hook-body-compiles.test.ts:120-128. It agrees with the file's own account of the wrapper at main data-hooks.md:224-226.
  2. The refused example and its parenthetical: holds, and the example really is refused. const ctx = ctx.input || {}; is the test's own fixture (validate-hook-body-compiles.test.ts:17), refused as hook-body-does-not-compile at error with Identifier 'ctx' has already been declared and line 1 (:50-62). let ctx and a name declared twice: validate-hook-body-compiles.ts:13-15, test :18 and :64-76. Every other compile failure is error: validate-action-body-compiles.ts:204. The id: validate-hook-body-compiles.ts:51.
  3. The doors: holds. tier: 'gating' and commands: ALL at packages/lint/src/authoring-rules.ts:2981-2983, ALL being the three commands (:189, :549); called from packages/cli/src/commands/validate.ts:715, compile.ts:671 (os build is its alias, build.ts:6) and lint.ts:820; pinned at test :137-146. os and objectstack are one binary (packages/cli/package.json:24-25), so this bullet's os build and its neighbour's objectstack build (main data-hooks.md:342) name one door. Runtime: surfaces: CLI_AND_RUNTIME, runtimeTypes: ['hook'] (authoring-rules.ts:2985-2986), pinned at test :148-160; the refusal carries INVALID_METADATA and status 422 (packages/metadata-protocol/src/runtime-authoring-gate.ts:1680-1684). For the word "save" see N1.
  4. "naming the hook, the SyntaxError and its line": holds. where at validate-hook-body-compiles.ts:105, the message at :107 through validate-action-body-compiles.ts:216-221, the line at :190; line N of the source is line N of the expression (action-body-wrapper.ts:46-50).
  5. The fix: holds, and it really passes. The hint is validate-hook-body-compiles.ts:109-111; const input = ctx.input || {} compiles (test :104) and is admitted at the runtime door (:153-159).
  6. The job sentence: holds, and the PR is right to narrow the card's wording. Same wrapper: validate-hook-body-compiles.ts:120, quickjs-runner.ts:414-416 and :433. Its own id: :54, :125. The three commands: test :137-146. No runtime door: runtimeTypes names hook alone (authoring-rules.ts:2986, reason at :2974-2977), and job is allowRuntimeCreate: false (packages/spec/src/kernel/metadata-plugin.zod.ts:1040) where hook is true (:908). A sentence saying a job save is refused would teach a door main does not have.
  7. The regex sentence: S1.

No must-fix.

S1 (should-fix) — the regex sentence states a condition main does not test.
Head data-hooks.md:347-348 reads "A regex pattern only the checking engine refuses is a warning." On main the warning arm is every regular-expression pattern the checking engine refuses, whatever the runtime's engine would do with it. The rule compiles with the host engine alone (validate-action-body-compiles.ts:118-124), classifies by the shape of the host's sentence (:137-143, :195-196) and sets warning on that shape (:204); it never asks the runtime's engine, so "only" is nothing it knows. Two wrong readings follow. A pattern both engines refuse, an unclosed group for one, is an error by the bullet's own "any syntax error", and on main it is a warning and the build goes through. And a reader who meets the warning is told the runtime accepts the pattern, where main's own message says the runtime's engine "may accept it, but if it does not, every run of this hook fails" (:217-219; packages/lint/src/rule-explanations.ts:1493-1496). This is the one arm where a body can still ship and never start, so the wording decides whether the warning is acted on. Repair: drop the restriction and keep main's meaning, for example "A regex pattern the checking engine refuses is a warning: the runtime may accept it." That is about 22 bytes more, inside the 43 left under the row. The changeset body repeats the sentence and follows it.

S2 (should-fix) — eval case 33's second token refuses one of the two repairs the case itself accepts.
must_contain is hook-body-does-not-compile and ctx.input.status (head hooks-security-seeds-datasources.json:336). The grader is mechanical: each token a literal, case-sensitive substring, no model judging (packages/qa/scenarios/src/skill-evals/grade.ts:27-31). The case's expected_output accepts two repairs, as main's hint does (validate-hook-body-compiles.ts:109-111): use ctx as it is, or rename the local. An answer that takes the rename, the only repair the bullet spells in code and the one main pins as passing (test :104, :153-159), reads const input = ctx.input || {}; if (!input.status) input.status = 'new'; and holds no ctx.input.status. It is correct on main and the case does not pass it, so the with-skill score on this case measures which repair the answer picked, not whether the skill taught the refusal. Repair: assert a token both repairs carry and the refused source does not, for example input.status (inside ctx.input.status and in the renamed form; the prompt's source has only ctx.input and ctx.status).

The six deletions: each is restatement, and no rule lost its only home.

  • Main :126-129, the body stub: still at :94 (statements against ctx), :224-226 (function body, statements, await) and :802 (a throw aborts); its link target stays in the contents line :5, and no file at the head links the removed heading.
  • Main :158-160, the "stay partial" parenthetical: still at :240, :242 and Gotcha 1, :352-357.
  • Main :453-454, the org id comment clause: still at :484 and :488-490.
  • Main :663-667, the static-masking note, kept in two lines: "applies everywhere" stays at :51-53; the dropped gloss "for a permission set or position" is taught in the bundle at skills/objectstack-data/rules/security.md:202-206 and :231-252. The two surviving lines say nothing main's five did not.
  • Main :677, "never a session claim": still at :244 (no role list) and :456-457, the latter in the HookContext listing Pattern 4's handler runs on; the code under it is unchanged (:675-678).
  • Main :780, the before and after clause: still the Purpose row, :59.

Eval case 33 otherwise asserts what main does. The prompt's body is the redeclaration, and os validate reports hook-body-does-not-compile at error on it (validate.ts:715, test :137-146); the id is in no other skill file, so the first token separates the two arms. The expected_output prose (wrapper, a SyntaxError before any statement runs, the three commands, the 422) matches the bullet as judged above.

Tried and held: an expression body is skipped (validate-hook-body-compiles.ts:74, test :105) and the bullet says js; var beside the parameter compiles (content/docs/automation/hook-bodies.mdx:230) and the bullet claims no refusal of it; os verify runs the same stage first (packages/cli/src/utils/author-time-rules.ts:3-13), so the door list is not exhaustive, which is no error.

  • N1 (nit): "a runtime hook save". The gate runs on a body about to go active: the default save mode is publish (packages/metadata-protocol/src/protocol-save.ts:599), and a mode: 'draft' save is stored unrefused until its promotion (packages/metadata-protocol/src/protocol-authoring-gate.ts:435-453, authoring-rules.ts:205-208). The data bundle teaches no draft save and the file's own register is "refused at save" (main data-hooks.md:844, :875), so the sentence holds for the save its reader makes, and an uncompilable body cannot go active either way. main's docs call it "the runtime publish door" (hook-bodies.mdx:231).
  • N2 (nit): "one name declared twice" is the let and const case (rule-explanations.ts:1508-1509). The phrase is main's own (content/docs/deployment/validating-metadata.mdx:523) and errs toward caution.
  • N3 (nit): after the cut at main :780 the Best Practices line ends on a lone "set" (head data-hooks.md:777); it renders the same.
  • N4 (nit): the closing sentence of case 33's expected_output (no suppression, no move to a deprecated handler) has no token behind it; must_not_contain is empty and the grader reads tokens only (grade.ts:27-31).

Implemented-by: claude/issue-35714-data-hooks-compile-refusal
Reviewed-by: session_01L6bhgTRf6qBRCqPh4JZaZL

VERDICT: PASS

…e 33 accepts either repair

Claude-Session: https://claude.ai/code/session_01L6bhgTRf6qBRCqPh4JZaZL
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTRf6qBRCqPh4JZaZL

Superseded by #35757, which folds this pull with the three other area b1-D skills-text pulls (#35743, #35746, #35750, #35751) onto current main at the seat request: one approval and one merge on the governed skills/** surface instead of four rounds on the shared token-ratchet budget. The commits of this branch are carried into #35757 unchanged by merge. Closing this one; the branch is left in place.

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/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skills: data-hooks.md teaches the hook/job js-body compile refusal (follow-up of PR #35713)

2 participants