Repository navigation
docs(skills): teach a handler hook's refusals, a code's reasons and params - #33775
Conversation
…arams
The data-hooks reference's declared-refusals section now teaches what the
schema and runtime on main enforce: a handler hook may declare refusals, a
code may hold snake_case reasons thrown as { code, reason }, and params name
the only roots a {{ }} hole may fill. The i18n skill names the reason key.
Four same-file restatements pay for the new text.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5o9NG21PoQGHjYvjzM
|
domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb Contract reviewServed-tier: Read: card #33658 (body and its four comments, developer report 6893005866 included), PR #33775 (body, three-file list, net diff against ① Derived judgments
② Semver level
Clause-②: no — holds. The diff takes no capability away and declares nothing new; it brings the teaching up to what ③ Boundary flags
④ Design judgment
Findings:
No must-fix, no should-fix. Two nits, both accepted as written; one follow-up card owed by the seat (③, eval id 7). Implemented-by: VERDICT: PASS Adopted by the seat 2026-11-15T10:34Z · isolated sub-agent at CONTRACT_REVIEW_TIER (served model verified by the seat) · Ruling-ref: Leehom card cmsg_01TenzsRopZj4jMbvjX8uz1XFhuiZmTH8VFgMmHRmpiGAb, option A, tapped 2026-11-14T15:37Z |
|
domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb 席位核对Verdict: ACCEPT, seat lands (low-risk skills arm, Tier S) · head
|
|
domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb Contract reviewSeat note: re-post of record 6893056455 on the same head, adopted from the same reviewer transcript, with one wording change. The out-of-scope ruling sentence on eval id 7 now reads "not graded against this PR", so the queue guard's grade reader (#33604) can attribute it. The reviewer's judgment is unchanged. Served-tier: Read: card #33658 (body and its four comments, developer report 6893005866 included), PR #33775 (body, three-file list, net diff against ① Derived judgments
② Semver level
Clause-②: no — holds. The diff takes no capability away and declares nothing new; it brings the teaching up to what ③ Boundary flags
④ Design judgment
Findings:
No must-fix, no should-fix. Two nits, both accepted as written; one follow-up card owed by the seat (③, eval id 7). Implemented-by: VERDICT: PASS Adopted by the seat 2026-11-15T11:36Z · isolated sub-agent at CONTRACT_REVIEW_TIER (served model verified by the seat) · Ruling-ref: Leehom card cmsg_01TenzsRopZj4jMbvjX8uz1XFhuiZmTH8VFgMmHRmpiGAb, option A, tapped 2026-11-14T15:37Z |
Requested by Leehom · project thread
domain:skills#1 · os-project-manager · session_01FEkQ5o9NG21PoQGHjYvjzM
Fixes #33658
Clause-②: no
Metadata-protocol: none
维护者速读
data-hooks.md的「声明式拒绝」一节改为教 hooks: the refusal catalogue (refusals) cannot translate a handler-authored hook's refusals, and holds one sentence per code — a TS hook has no way to refuse in the user's language #33214 之后的真实规则:handler钩子也能声明refusals;同一个码下可以有多句reasons(抛{ code, reason });声明params后句子里的双花括号占位符只能引用已声明的名字。i18n 技能在原有翻译键旁加上 reasons 的翻译键。skills/objectstack-data/references/data-hooks.md的### Declared refusals一节(示例与下方 5 条要点);其次skills/objectstack-i18n/SKILL.md的 App-authored 一条。node scripts/check-skills-token-ratchet.mjs全绿,data-hooks.md 为 9990/10011。What changes
Three files, no code.
skills/objectstack-data/references/data-hooks.md§ Declared refusals (refusals)ASSET_NOT_IN_STOCKentry now declaresparams: ['due']and areasonsentryon_loanwhose sentence fills aduehole, and the body throwsObject.assign(new Error(), { code: 'ASSET_NOT_IN_STOCK', reason: 'on_loan', params: { due: asset.due_date } })before the existing code-only throw.jsbodycan declare one: ahandlerhook, inline TS included, is refused at save" is replaced: ajsbody or ahandler(inline or named) can declare one; anexpressionbody, or neither, is refused at save.reasonsare snake_case, thrown asreason, and keep the code's wirecodeand status;paramsnames what a hole may fill, and a hole over any other name, or any hole with noparams, is refused.hooks.HOOK.refusals.CODE.messageandhooks.HOOK.refusals.CODE.reasons.REASON.message, and says the thrown text (not "the body's own text") is unused.reasons".skills/objectstack-i18n/SKILL.md§ Server-Composed User Text: the App-authored bullet nameshooks.HOOK.refusals.CODE.reasons.REASON.messagebeside the code's key, and says a translation of a sentence whose entry declaresparamskeeps its holes, filled by the runtime after it is picked..changeset/33658-skills-hook-refusal-reasons-params.md:'@objectstack/skills': patch(the catalog ships in@objectstack/skills).Token ratchet payment (same file, restatements only). data-hooks.md was at 10004/10011; the new text cost about 150 tokens. Removed:
handlertakes an inline function or a registered function's name (Registration Methods)."bodyvshandlertable (inline) and Registration Methods 1 (string name viafunctions)previousonly againstnull..."previouscolumn on an insert fail the write) and theprevious is null on insertbulletconditiondoes not hit this wall ...)" under Gotcha 1condition: "recordhere is the RECORD ... unlikectx.input/ctx.resultinside the body, which stay partial, see Gotcha 1"defineStack({ hooks: [...] })..." after the copy-paste exampledefineStack({ hooks }),AppPluginauto-binds)No ceiling moved.
i18n.sourceLocaleteaching is untouched (#33635 holds it).Why
PR #33641 (#33214, ruling 6879477573) made
HookSchemaand the runtime acceptrefusalson a handler hook,reasonsunder a code and declaredparams. The skills still taught the pre-#33641 rule, so an agent would keep a hand-written body for every rule, one sentence per code and no params.Tests
No test file is committed (skills text only). Two one-time checks of the new example, both against
main@12a0f09fbuilt under the lock:HookSchema.parse on the published example and six mutants (packages/spec dist)
The block was read out of the edited markdown file, not retyped. Each bullet's claim has a mutant above.
Real QuickJS run of the example's throw lines (scratch test beside hook-refusal-catalogue.test.ts, deleted after)
The body was bound through
hookBodyRunnerFactory+QuickJSScriptRunnerwith the hook passed throughHookSchema.parse; the onectx.apiread was swapped for an input value, every throw line kept as published.Tests 5 passed (5), exit 0.Acceptance notes
Each taught rule, read from
main@12a0f09f:jsbody or ahandler(inline or string) may declarerefusals;expressionbody or neither refused atrefusalspackages/spec/src/data/hook.zod.tsrefuseUndeclaredLiteralRefusalCode(answered = body === undefined ? hasHandler : language === 'js')reason, keep the code's status and wire codeHOOK_REFUSAL_REASON_PATTERN(hook-refusal-codes.ts);HookRefusalSchemareasonsdescribe; runtimedeclaredAnswerparamsmeans no holehookRefusalMessageRefusal(closedScopeTemplateRefusalwithroots: params)hookRefusalCodesThrownIn/hookRefusalReasonsThrownIn; runtimeundeclaredHookRefusalReasonAtRunhookRefusalMessageKey(system/i18n-resolver.ts);translation.zod.tshooksdocblockOut of scope, noted for the seat (not filed): the objectstack-data eval
hooks-security-seeds-datasources.jsonid 7expected_outputstill ends "a catalogue on a hook without ajsbody is refused at save", which #33641 made false (ahandlerhook may declare one). Its assertions (must_contain,must_not_contain) are unaffected. carrier: the skills seat.Verification
Readings on head
6072b2db:dispatch-gates --tier): MANDATORY contract-review tier,skills/**clause ①, no one-line exit. This branch was written at the default tier; the seat's in-seat at-tier contract review pays the mandated tier.check-governed-merges.mjs --branch claude/project-thread-3vm39u: GOVERNED,skills/**×2, landing tier H on a path list; low-risk skills arm NOT MEASURED there ("no reading of the pull request was handed in"). The arm is read with--pron this PR.skills/*/SKILL.md: 4588 to 4590 lines, 59049 to 59102 tokens.check-skill-line-ratchet.mjs: exit 0.Derived gates: 48 derived, 47 exit 0, 1 NOT MEASURED, plus check:skill-examples
node scripts/pm/dispatch-gates.mjs --ran FILE: "48 derived famil(ies) accounted for, 47 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)".pnpm check:dual-build-cjs-loadsexit 3, reason: it reads every package'sdistand asks for a fullpnpm build; this diff touches no package, so CI's run is the reading.pnpm --filter @objectstack/spec run check:skill-examplesexit 0, "346 prose examples type-check across 3 surface(s)".Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5o9NG21PoQGHjYvjzM