Skip to content

docs(skills): data hooks and actions teach the multi-reason refusal throw - #37619

Merged
os-zhuang merged 2 commits into
mainfrom
claude/project-thread-gvxx96-37407
Nov 26, 2026
Merged

os-zhuang merged 2 commits into
mainfrom
claude/project-thread-gvxx96-37407

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #37407

Clause-②: no (published prose only; teaches the list throw already on main)
Metadata-protocol: none

维护者速读

What changes

skills/objectstack-data/references/data-hooks.md and skills/objectstack-ui/rules/actions.md, plus a patch changeset for @objectstack/skills.

  • data-hooks.md, Declared refusals:
    • The reasons bullet says how an entry declares them: a snake_case reason mapped to { message } only, under the code's wire code and status; another status needs another code (zone o5-U note N1, comment 7181230894).
    • The params bullet says a reason's holes follow the same rule.
    • A new bullet teaches the list throw, reasons: [{ reason, params? }, …] instead of reason: one translated line each, filled from its own params; userMessage joins them by newlines and ends with the entry's message, filled from the throw's top-level params, else its holes are empty (note N3); the HTTP doors answer details.refusals: [{ reason, message }], absent for a single reason (the MCP tool gives the lines as text beside its envelope, so the page does not say every door).
    • The last bullet adds that a listed reason is judged even under a code that declares no reasons, and that a reasons that is not a non-empty list of { reason, params? }, or one beside reason, is a 500.
  • actions.md, Refusing by code: one sentence with the shape: "For several reasons throw reasons: [{ reason, params? }, …], not reason: userMessage is one line per reason, closed by the code's message (rules there)." The rules stay a pointer to the hook section.
  • Paid in the same files. Both sat at zero token headroom, so every added byte is paid for nearby; net −13 lines. Removed: the third ("Complex conditions") condition example, two comments that restated the condition below them, annual_revenue from the insert input sample, the "lifecycle events organized by operation type" lead-in. The rest is tightened wording (data-hooks: What Are Hooks, defineHook, has(), filter:, findOne, unpredicated find, capabilities lead-in, ctx.log, HookContext note, ctx.input; actions: shorter example strings and one params array on one line). No other file pins any shortened string.

Checked against packages/runtime/src/sandbox/hook-refusal-catalogue.ts, quickjs-runner.ts and packages/spec/src/data/declared-entry.zod.ts on main: the join order and closing line, top-level params filling the closing message, details.refusals only on a list throw, a listed reason judged under every code, { message } as the reason value.

Small calls made here (no card):

  • The list form is shown inline in a bullet, not as a second throw in the example, to fit the byte budget. The assignment form (e.reasons = [...]; throw e) is not taught; the object-literal throw is the one the page already uses.
  • The three list faults are written as run-time 500s: the source detects them in the runner, not at save.
  • actions.md describes userMessage, not how the console toast renders its newlines, which was not traced. The console's param-dialog listing of reasons (feat(console): a refusal that names several reasons lists every one in its alert box #37538) is not taught here.

Why

PR #37395 (#36877) let one throw carry several declared reasons. Its Skills-docs: line points here: both pages taught the single reason form only, so an agent writing a hook or action that refuses a selection for several reasons had no pointer to the list.

Verification

Run at 19b5b425d (contract-review fixes; f0fd20d1e before), each exit 0:

  • node scripts/check-skills-token-ratchet.mjs: both files within their ceilings (data-hooks.md 10122/10122, actions.md 3880/3880).
  • node scripts/check-skill-links.mjs, node scripts/check-skill-identifier-liveness.mjs, node scripts/check-skill-top-level-keys.mjs.
  • pnpm --filter @objectstack/spec check:skill-refs, check:skill-docs.
  • pnpm --filter @objectstack/spec check:skill-examples (after building spec, client and client-react): 352 prose examples type-check, the edited os:check blocks included.
  • node scripts/pm/overlap-check.mjs: clean.

The edits were drafted by a contract-tier subagent, as dispatch-gates --tier requires for skills/**, and reviewed here (one claim narrowed). The contract-review fixes (S1, N1, N3 of 7197638051) were drafted the same way; the extra bytes in actions.md are paid by wording-only tightenings in the same file.

Contract review (L2) is owed before landing: skills/** is a governed surface (Tier H).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed (not touched).
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj


Generated by Claude Code

@github-actions github-actions Bot added size/m 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 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: f0fd20d1e63644982504c02e4708d2631f5d74e0
Local-runs: none
Scope: skills/objectstack-data/references/data-hooks.md,skills/objectstack-ui/rules/actions.md + none
Security-touching: yes

PR #37619 for card #37407. Read: the card body and its four comments, the PR body and file list, the net diff against main, the check-runs on the head, and the cited code on main (the ruling on #36877 is comment 7178348458; the list throw landed in #37395).

① Derived judgments

  • Accept-set: none moves. The diff is two skill pages and one changeset. No schema, validator, gate or ratchet baseline is touched. Right.
  • Public surface: the published text of two pages in @objectstack/skills. Every newly taught sentence is judged in ④ against the code on main. Right for data-hooks.md; actions.md carries S1.
  • Derived gates. The check-runs on the head are the verdict on the token ratchet, skill links, identifier liveness, top-level keys and the prose examples: every run concluded success or skipped (the skipped ones are the unselected UI, docs and opt-in lanes), none failed. The token ceilings are not raised: no baseline file is in the diff.
  • The words are paid for in the same files, and no fact goes. Each reworded sentence was compared old to new (What Are Hooks, defineHook, condition, has(), filter:, findOne, unpredicated find, the capabilities lead-in, ctx.log, the HookContext note, ctx.input; in actions.md the lead, the toast copy line, four example strings and one params array). Meaning is kept in each. What is removed outright is one condition example, two comments restating the predicate under them, one sample field and one lead-in sentence. Right.

② Semver level

  • .changeset/37407-skills-multi-reason-refusal.md takes @objectstack/skills at patch. The diff publishes prose that teaches behaviour already on main; nothing a metadata author can write changes, so Metadata-protocol: none and patch is the level. Right.
  • The PR body and the changeset both carry the two declaration lines, and the value no on the Clause-② line holds: published prose only, no surface widened or narrowed. Check Changeset concluded success.

③ Boundary flags

Dev flags, from the PR body's "Small calls made here":

  1. The list form is shown inline in a bullet, not as a second throw in the example; the assignment form is not taught. Accepted for data-hooks.md: the fragment shows the shape with a literal reason beside the page's own example. The assignment form works on main and is read at save; leaving it untaught removes nothing. For actions.md see S1.
  2. The three list faults are written as run-time 500s. Right. refusalAddressFrom (quickjs-runner.ts) raises both, empty and malformed at run only; the save check reads listed reasons alone (hookRefusalReasonsThrownIn, isUndeclaredThrownReason in hook-refusal-codes.ts, called from hook.zod.ts and action.zod.ts).
  3. actions.md says "one line per reason" rather than describing the toast, which was not traced; the param-dialog listing (feat(console): a refusal that names several reasons lists every one in its alert box #37538) is not taught. Not teaching an untraced rendering is right. The phrase itself is part of S1.

Card notes (comment 7181230894): N1 is answered by the reasons bullet (a reason maps to a message only; another status needs another code), which matches refusalReasonSchema in declared-entry.zod.ts. N3 is answered by "filled from the throw's top-level params (else its holes are empty)", which the catalogue test on main pins.

open_questions: none on the card or the PR. SQL push-down: the diff holds no code, so there is no id materialisation or join to judge.

The security line reads yes on a narrow basis: the tightening rewords one sentence inside "Capabilities — the complete list" (what a hook body is permitted to call) and one inside the ctx.log capability bullet. Meaning is unchanged in both, and no list-throw sentence teaches permission, sharing, credential or authentication behaviour. The path name does not show that paragraph, so the line says so.

④ Design judgment

skills/objectstack-data/references/data-hooks.md — holds. Each new sentence against main:

Taught sentence Code on main Holds
reasons maps a snake_case reason to a message only, under the code's wire code and status; another status needs another code refusalReasonSchema: a strict object with message alone; its code and status guidance says the same yes
a reason's holes follow the entry's params refuseEntrySentences judges every reason sentence over the entry's params yes
throw reasons: [ … ], not reason; one translated line each, filled from its own params declaredAnswer renders each element through ownerRefusalMessage with that element as the address yes
userMessage joins the lines by newlines and ends with the entry's message, filled from the top-level params, else its holes are empty [...lines, closing].join('\n'); the closing line reads address.params; pinned by the test that answers Nothing was submitted ( selected). yes
details.refusals carries reason and message per line, absent for a single reason declaredRefusalLines read by resolveThrownHttpError and mapDataError; the CONTROL test pins the absence yes on /data, /actions and the dispatcher; see N1
a listed reason is judged even under a code that declares none: at save if literal, else a 500 isUndeclaredThrownReason (save); the !reasons arm of declaredAnswer (run) yes
reason beside reasons, an empty list or a malformed element is a 500 listProblem → unreadableListAtRun → a fault with no status; tests pin 500 on both run paths yes

The card's three rules (every listed reason declared, both forms on one throw a fault, the entry's own message closes the list) are all on this page, with the shape shown.

skills/objectstack-ui/rules/actions.md — the sentence is true (resolveActionRefusal answers through the same declaredAnswer; action.zod.ts runs the same save check), but it does not hold against the card's acceptance.

S1 (should-fix) — actions.md, "Refusing by code": A body may throw a hook's reasons list too (rules there): one line per reason. The card's acceptance asks that both pages show the list throw with a short example. This page shows no shape. It has never introduced reasons or reason (its one example declares a message and a status and throws a bare code), so "a hook's reasons list" cannot be told from the catalogue's declared reasons map, and a reader who guesses a list of strings gets a run-time 500 that no save check catches. "One line per reason" also leaves out the closing line: the answer is one line per reason and then the code's own message, which is the consequence an action author most needs when wording that message. This is the page an agent refusing a selection opens first. Smallest fix: name the throw shape in the sentence (reasons: [{ reason, params? }, …] in place of reason) and say the code's message closes the lines, paid for in the same file. The three rules may stay behind the pointer, since this page already hands "the catalogue, throws and checks" to the hook section.

N1 (nit) — data-hooks.md: "every door answers details.refusals". "Door" is used nowhere else on the page, and the claim is exact for the REST answers (/data, /actions, the dispatcher). The MCP tools relay the same lines as a text block beside the envelope and serve no details.refusals (mcp-http-tools.ts, #37416). No effect on how a hook is written.

N2 (nit) — data-hooks.md: on /data the userMessage is bounded at 500 characters, so a long list is cut there and its closing line lost; details.refusals is the carrier that stays whole. The page is silent on that bound for a single sentence too, so this is a follow-up, not a defect of this diff.

N3 (nit) — data-hooks.md: a reasons value that is not a list at all is the same 500; the bullet names the empty list and the malformed element only.

No must-fix. S1 is open on this head and earns a delta review of its fix.

Implemented-by: claude/project-thread-gvxx96-37407
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA

VERDICT: PASS

… two hook-page claims

Contract review on #37407: actions.md now writes the list throw's shape and
its closing line; data-hooks.md says the HTTP doors (not every door) answer
details.refusals, and names a non-list reasons as a 500 too.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 19b5b425db992bc605ee532d495f563734aa444f
Local-runs: none
Scope: skills/objectstack-data/references/data-hooks.md,skills/objectstack-ui/rules/actions.md + none
Security-touching: yes

DELTA review from f0fd20d1e63644982504c02e4708d2631f5d74e0 (record 7197638051: PASS, should-fix S1, nits N1 to N3) to this head.

PR #37619 for card #37407. Read: the card body and its four comments, the PR body and file list, the earlier record, the net diff against main, the whole diff between the two heads, the check-runs on this head, and the cited code on main. main has not moved either page or the cited code since the branch point.

① Derived judgments

  • Accept-set: none moves. Between the two heads the diff is the two skill pages and the changeset's wording. No schema, validator, gate or ratchet baseline is touched. Right.
  • Public surface: the published text of two pages in @objectstack/skills. Three taught sentences change between the heads (one on actions.md, two on data-hooks.md); each is judged in ④ against the code on main. Right.
  • Derived gates. Every check-run on this head concluded success or skipped (the skipped ones are the unselected UI, docs and opt-in lanes). One PR-body guards run was cancelled when the body was edited; the same job's later run on this head concluded success. The token ceilings are not raised: no baseline file is in the diff.
  • The added words are paid for in actions.md, and no fact goes. Each rewording between the heads was compared old to new: "inside a record" to "in a record"; "the action is hidden" and "the action shows but greys out" to "it"; "runs the action once per ticked row" to "runs it"; the brackets around "or a registered handler" and one comma dropped; "below does" to "below"; "authors errorMessage" to "sets"; "relative ones navigate in place" to "relative ones in place"; "valid only with" to "only with"; "from a beforeInsert hook on the line instead" without "instead"; "whenever" to "when". In data-hooks.md: "a failure you did not plan" to "an unplanned" one. Meaning is kept in each. Nothing is removed outright between the heads. Right.
  • The earlier head's compressions are unchanged by this delta outside the lines above; the earlier record's reading of them stands, and a second reading of the net diff found no dropped fact (the defineHook lead, condition, has(), filter:, findOne, the capabilities lead-in, ctx.log, the HookContext note, ctx.input, the shortened example strings in actions.md). A search of the tree for the shortened example strings found no pin, and the example and link gates are green.

② Semver level

  • .changeset/37407-skills-multi-reason-refusal.md takes @objectstack/skills at patch. The diff publishes prose that teaches behaviour already on main; nothing a metadata author can write changes, so Metadata-protocol: none and patch is the level. Right.
  • The changeset's summary was reworded with the pages (the HTTP doors, the non-list reasons, the shape on the actions page) and agrees with the tree. The PR body and the changeset both carry the two declaration lines, and the value no on the Clause-② line holds: published prose only, no surface widened or narrowed. Both Check Changeset runs concluded success.

③ Boundary flags

Dev flags, from the PR body's "Small calls made here":

  1. The list form is shown inline, not as a second throw in the example; the assignment form is not taught. Accepted on both pages. actions.md now carries the shape in its sentence, beside the page's own throw { code: 'PRODUCT_NOT_FOUND' }.
  2. The three list faults are written as run-time 500s. Right, and now whole: refusalAddressFrom (quickjs-runner.ts) raises both, empty and malformed at run only, and malformed covers a value that is not a list.
  3. actions.md describes userMessage, not how the toast draws its line breaks; the param-dialog listing (feat(console): a refusal that names several reasons lists every one in its alert box #37538) is not taught. Right: an untraced rendering is not taught, and the listing is outside the card.

The card's two notes (comment 7181230894) stay answered: the reasons bullet (a reason maps to a message only; another status needs another code) and "filled from the throw's top-level params (else its holes are empty)". Neither bullet moved between the heads.

open_questions: none on the card or the PR. SQL push-down: the diff holds no code, so there is no id materialisation or join to judge.

The security line reads yes on the same narrow basis as the earlier record, a little wider on this head: reworded lines sit inside sentences that teach permission or auth behaviour (in data-hooks.md the capabilities lead-in and the ctx.log bullet; in actions.md the bulk-selection bullet, the newTabUrl sentence and the runAs sentence). Each keeps its meaning word for word in the part that teaches it, and no list-throw sentence teaches permission, sharing, credential or authentication behaviour. The path names do not show those sentences, so the line says so.

④ Design judgment

skills/objectstack-ui/rules/actions.md — holds.

S1: closed

The sentence now reads: For several reasons throw reasons: [{ reason, params? }, …], not reason: userMessage is one line per reason, closed by the code's message (rules there). Against main:

Taught Code on main Holds
the throw shape reasons: [{ reason, params? }, …] in place of reason refusalAddressFrom: a non-empty list whose every element carries a non-empty string reason and an optional object params; a list beside a single reason is refused yes
an action body may throw it resolveActionRefusal and resolveHookRefusal answer through one resolveSandboxedRefusal and one declaredAnswer; action.zod.ts runs the same listed-reason save check (hookRefusalReasonsThrownIn, isUndeclaredThrownReason) yes
userMessage is one line per reason, closed by the code's message declaredAnswer: the listed lines, then the entry's own message, joined by a line break and served as userMessage yes

The shape can no longer be mistaken for the catalogue's declared reasons map or for a list of strings, and the closing line is stated, which is what an action author needs when wording that message. The three rules stay behind the pointer, as the earlier record allowed. The card's acceptance (both pages show the list throw with a short example) is met on the same footing as the hook page: a shape fragment beside the page's own throw.

skills/objectstack-data/references/data-hooks.md — holds. The two taught sentences that changed:

Taught sentence Code on main Holds
the HTTP doors answer details.refusals: [{ reason, message }], absent for a single reason declaredRefusalLines read by resolveThrownHttpError (the dispatcher, /actions) and by the /data classification's userMessage rider; a single-reason refusal carries no list. The MCP tools relay the lines as text (mcp-http-tools.ts) yes
a reasons that is not a non-empty list of { reason, params? }, or one beside reason, is a 500 refusalAddressFrom: both, then malformed for a value that is not a list, empty, and malformed for an element off the shape; declaredAnswer turns each into the fault with no status. The catalogue test pins "a reasons value that is not a list" at 500 with no userMessage and no details yes

The rows of the earlier record's table for the sentences this delta did not move were re-read against declaredAnswer, refusalAddressFrom, refusalReasonSchema and hook-refusal-codes.ts, and stand.

Nits of the earlier record:

  • N1: taken. "every door" is now "the HTTP doors", exact for /data, /actions and the dispatcher. See N5 for what is left of it.
  • N2: not touched. The 500-character bound on the /data userMessage stays untaught, for a single sentence as for a list; a follow-up, as before.
  • N3: taken. The bullet now covers a reasons value that is not a list.

New on this head:

N4 (nit) — actions.md: "(rules there)". The earlier wording named "a hook's" list in the same sentence. Now "there" names no place in its own sentence; the nearest place before it is objectstack-i18n, and the rules live in the hook section named two sentences up. "The catalogue, throws and checks are a hook's" still resolves it. No effect on what is taught.

N5 (nit) — data-hooks.md: "the HTTP doors". The page's other use of "door" (the ctx.title row) means the ways a hook is registered, so the word carries two senses on one page; and the MCP tools are reached over HTTP too, while they relay the lines as text. No effect on how a hook is written.

No must-fix, no should-fix.

Nits only; they end the round.

Implemented-by: claude/project-thread-gvxx96-37407
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head 19b5b42 · card #37407 · area s2-ux-T · 2026-11-26T17:00Z

L1 checklist

  • Shape and relation. l1-face.mjs --pr 37619 read 13 items and flagged one, all-checks. The flag is a PR-body guards run that was cancelled and then superseded by a successful run of the same job on this head. Every other check is success or an expected skip, and mergeable_state is clean. The PR has 3 files.
  • Fixes #37407 is right. Both skill pages now teach the list throw reasons: [{ reason, params? }, …] and the card's three rules on the hook page. The zone o5-U notes (how an entry declares its reasons, and top-level params for the closing line) are answered.
  • Contract review.
    • Record 7197638051: PASS, with S1 open.
    • Delta record 7198330476 on this head: PASS, with S1: closed and no must-fix or should-fix. Adopted.
    • Both records say Security-touching: yes: the reworded lines sit inside sentences that teach hook capabilities, runAs and bulk selection, with meaning unchanged. The security label is added by this stroke's hand-off.
  • Declarations. Clause-②: no, Metadata-protocol: none, @objectstack/skills patch. They are true for prose that teaches a throw already on main (feat(refusals)!: one refusal names several declared reasons, each in the person's language #37395).
  • Follow-ups. N2 (the /data 500-character message bound), N4 and N5 go to review follow-ups of PR #37619: refusal-list teaching on the hook and actions skill pages (the /data message bound, two wording nits) #37642 (review follow-ups of PR docs(skills): data hooks and actions teach the multi-reason refusal throw #37619, p3).
  • Governance. check-governed-merges.mjs reads it as governed (skills/**): Tier H. The low-risk skills arm does not apply, because Security-touching: yes.

Tier: H. Landing: hand-off to the approver by the next stroke; ⛔ the seat does not merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Tier H hand-off · 2026-11-26T17:01Z · head 19b5b42 · approver os-zhuang

维护者速读

  • 改了什么: 两页对外发布的技能文档(数据钩子、动作),现在教的是「一次拒绝、列出多条原因」的写法:每条原因按用户的语言显示一行,最后一行是这个拒绝码自己的总结句。这个能力在 feat(refusals)!: one refusal names several declared reasons, each in the person's language #37395 已经上线,文档之前只教一次一条原因。为了不超出篇幅上限,同一文件里压缩了几处措辞,没有删掉任何事实。
  • 影响: AI 照技能写钩子或动作时,能写出正确的多原因拒绝。产品行为不变。
  • 审核: 席位 L1 已 ACCEPT(本评论前一条)。契约审核首轮 PASS 但留了一条建议改的项,已修;增量轮 7198330476 PASS,没有必须改或建议改的项。三条小问题进了后续卡 review follow-ups of PR #37619: refusal-list teaching on the hook and actions skill pages (the /data message bound, two wording nits) #37642。改动的句子落在讲钩子能力和 runAs 的段落里,意思没变,按规则挂了 security 标签。
  • 要你做什么: 这是受管的 skills/** 面,需要你批准后才能合并。撤回这一次合并即可恢复原文。

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 26, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 26, 2026 18:34
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 6592546 Nov 26, 2026
57 of 59 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-gvxx96-37407 branch November 26, 2026 18:59
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 pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue security size/m 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 and actions teach the multi-reason refusal throw (after #36877)

3 participants