Skip to content

fix(spec): hook form refusals help names the handler beside the JavaScript body - #34146

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-iasjw1
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-iasjw1

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #33803

Clause-②: no — help text only
Metadata-protocol: none

维护者速读

  • 改了什么:钩子表单「拒绝目录」一行的说明文字,从「仅限 JavaScript (L2) 正文」改为「适用于 JavaScript (L2) 正文或处理器;表达式正文会被拒绝」,并同步 11 个语言包里的同一句(14 个文件,+49/-13)。
  • 为什么改:handler 类钩子早已可以声明拒绝目录,表单本身也提供 handler 一行,旧说明会让作者以为 handler 钩子不能用。
  • 风险与回滚:纯文字,不改任何行为;回滚即 revert 本 PR。
  • 先看:packages/spec/src/data/hook.form.ts(新说明)、packages/spec/src/data/hook-refusals.test.ts(末尾新钉子)、packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts 第 970 行。
  • 两分钟验证:git grep -c "bodies only" -- packages/spec/src/data/hook.form.ts 预期 0;git grep -l "For a JavaScript (L2) body or a handler" -- packages 预期 2 个文件(源与 en 包)。
  • 需要你做的:无,席位落地。

What changes

  • packages/spec/src/data/hook.form.ts: the refusals row help now says the code is the one the hook throws, and ends "For a JavaScript (L2) body or a handler; refused on an expression body". That is what HookSchema.refusals says (hook.zod.ts, "a js body or a handler") and what hookRefusalsWithoutSandboxedBody refuses (an expression body, or neither a body nor a handler). The file docblock says the same.
  • packages/platform-objects/src/apps/translations/*.metadata-forms.generated.ts: en carries the new source string (byte-equal to what check:i18n extracts); the ten translated locales (ar de es-ES fr ja-JP ko pt-BR ru zh-CN zh-Hant) are re-translated by hand in place, leaf value only, no key added or dropped. No locale has a source-hash entry for this path, so no digest file moves.
  • .changeset/33803-hook-refusals-help-handler.md: patch for @objectstack/spec and @objectstack/platform-objects.

Tests

  • New top-level describe at the end of packages/spec/src/data/hook-refusals.test.ts (the refusals harness file): the refusals row help names handler and no longer says "bodies only"; the handler row it names is a row the same form offers. No forced edit to an existing test. The second commit reads hookForm.sections through its optional type (?? []), which check:test-typecheck asked for; an empty list would still red the toHaveLength(1) assertion.
  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/data/hook-refusals.test.ts src/kernel/repeater-item-titles.test.ts src/system/metadata-form-declared-rows.pin.test.ts: Test Files 3 passed, Tests 140 passed (head a711ec1; again on final head d4af1df).
  • Ablation (one leg, via scripts/ablation-replace.mjs on the committed head): restoring the old ending "JavaScript (L2) bodies only" in hook.form.ts landed (anchor 1 → 0, blob 6d2932ce → 8f783593) and turned the new pin red (1 failed / 98 passed); restore proved blob == HEAD and git diff HEAD empty.

Acceptance notes

  • The nested rows under refusals (message, reasons, reasons.message) still say "when the body throws this code". With a handler hook the thrower is the handler, so those three help strings read narrower than the schema. Same wording class, three more strings × 11 locales; left out of this card's scope. carrier: none.

Verification

All on final head d4af1df, local subset only; every family CI runs is read from this PR's check-runs.

Derived gates: 84 derived, 84 run, 0 NOT-MEASURED, all exit 0
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 84 families from 14 paths vs merge base 385ea1c; each ran after the last commit and --ran reconciled: "84 derived famil(ies) accounted for — 84 run, 0 NOT-MEASURED".
  • Includes pnpm check:i18n (the en bundle equals a fresh extract of the new source string), check:i18n-stale-fill, check:doc-authoring, check:nul-bytes, check:issue-citations, check:test-source-alias, and the spec dist family (check:api-surface, check:docs, check:authorable-surface, check:exported-any) after pnpm --filter @objectstack/spec build.
  • Environment notes, not findings: check-plugin-teardown-shape --self-test first exited 3 on the shallow clone (pinned fixture commit missing), green after fetching that commit; check:dual-build-cjs-loads first exited 3 (PREREQUISITE NOT MET, packages without dist), green after building ./packages/**; the four spec dist gates exited 3 after the second commit moved the src hash, green after rebuilding spec.
Package checks
  • pnpm --filter @objectstack/spec typecheck (incl. check:test-typecheck): exit 0.
  • pnpm --filter @objectstack/platform-objects typecheck: exit 0.
  • pnpm --filter @objectstack/platform-objects test: Test Files 122 passed, Tests 2007 passed.
  • test:repo (Test Core) not run locally: the diff edits no repo-project test; CI runs it.
  • Dogfood battery: n/a, no ! in the title and no (narrowing) arm.

Generated by Claude Code

The refusals row help ended "JavaScript (L2) bodies only", while HookSchema
answers a catalogue on a js body and on a handler, and refuses it on an
expression body. Reword the source help and every metadata-form bundle copy,
and pin the row.

Claude-Session: https://claude.ai/code/session_01ADHkmSYipyhBpSxJqatyap
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 2 changed package(s)), so this run has no opinion about the docs.

What this run could not see

Coarse fallback — 173 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 b4eea885058321e56776ab2b690e4f35e29b7a0c → packageMentionDocs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

Flake reading · Test Core (7/8) · head d4af1df0 · 2026-11-15T22:20Z

Red: @objectstack/scenarios › test/runner/run-date.test.ts › run on 2028-03-31 …, reason line Error: Test timed out in 5000ms (job 132973209799). This is the known p0 flake #34081 (the run-date oracle's calendar walk under load); its fix #34104 is not merged yet. This diff touches only the hook form's help text, its pin and eleven translation bundles, nothing under packages/qa/scenarios. One re-run of the failed jobs follows; a second red on this head is read as real.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

Second red read · Test Core (7/8) · head d4af1df0 · 2026-11-15T22:46Z

The re-run (attempt 2) failed again on run-date.test.ts › run on 2028-02-29 …, reason Test timed out in 5000ms. That is #34081's case, red on main until its fix #34104 merged at 2026-11-15T22:30Z (e9fb09871d), after this head was cut. Not this PR's, and no further re-run: the seat merged main into the branch (merge-only pr_update_branch, new head 692e4abf) so the head carries the fix, and reads the fresh CI on that head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

席位核对

Verdict: ACCEPT · head 692e4abf · 2026-11-15T23:17Z

  1. Shape. Draft → main, first content line Fixes #33803. 14 files, all on the claimed surface: packages/spec/src/data/hook.form.ts (the refusals row help and the file docblock), a new top-level describe at the end of hook-refusals.test.ts, the en bundle plus ten re-translated *.metadata-forms.generated.ts bundles in @objectstack/platform-objects (leaf value only, no key added or dropped), and one changeset (@objectstack/spec, @objectstack/platform-objects patch).
  2. Premise. Holds against the code. HookSchema.refusals (hook.zod.ts) answers a catalogue on a sandboxed js body and on an in-process handler, and refuses it only for a hook whose code cannot throw a code (an expression body, or neither a body nor a handler). The help said "JavaScript (L2) bodies only" and now reads "For a JavaScript (L2) body or a handler; refused on an expression body". "the code the body throws" became "the code the hook throws", which covers both.
  3. Contract. Clause-②: no — help text only; Metadata-protocol: none. record-recognisers --paths on the file list reads the declaration face, and the PR declares no widening, so no contract-review record is owed. A form file under packages/spec/src is not a published schema. Changeset patch is right.
  4. Gates on 692e4abf (a merge-only sync of d4af1df0, done to take test(scenarios): walk the working-day calendar once in the run-date oracle #34104's fix for the run-date flake Queue-flake anchor: test/runner/run-date.test.ts #34081 that reddened Test Core (7/8) twice; the PR's own files are byte-identical across the sync). 67 check runs: 56 success, 11 skipped, none failed. Lint & Repo Gates, TypeScript Type Check, Type Check UI, Test Core, Test UI and Check Changeset are all success. The dev's 84/84 derived gates exited 0 on the pre-sync head.
  5. K. K = 12 first-parent commits on main since the merge base; < 15, no sync owed.
  6. Governed. check-governed-merges --pr 34146: NOT governed.
  7. Deviations / notes. None declared. Noted, no card filed: three nested rows under refusals still say "body throws" (the dev's acceptance notes, carrier: none).
  8. Landing. This stroke: pr_ready + automerge_enable, under the maintainer's landing approval in the seat thread (2026-11-15T16:10Z, 「批准席位 本班复核通过的 PR 执行 --land」). This card was started before the 22:50Z p3 pause and is landed under 「已开工的做完落地」. On MERGED the seat closes out Studio hook form: the refusals help text says 'JavaScript (L2) bodies only', but a handler hook may declare refusals since #33641 #33803.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 23:18
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit fdfccbf Nov 15, 2026
68 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-iasjw1 branch November 15, 2026 23:51
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 protocol:data size/s tests 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.

Studio hook form: the refusals help text says 'JavaScript (L2) bodies only', but a handler hook may declare refusals since #33641

2 participants