Skip to content

Commit fdfccbf

Browse files
fix(spec): hook form refusals help names the handler beside the JavaScript body (#34146)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9FD3xDgRM1o696UD7FEBAjA)_ 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 6d2932c → 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. <details><summary>Derived gates: 84 derived, 84 run, 0 NOT-MEASURED, all exit 0</summary> - `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. </details> <details><summary>Package checks</summary> - `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. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmSYipyhBpSxJqatyap)_ --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 479d1e4 commit fdfccbf

14 files changed

Lines changed: 49 additions & 13 deletions
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@objectstack/spec': patch
3+
'@objectstack/platform-objects': patch
4+
---
5+
6+
fix(spec): the hook form's refusal catalogue help names the handler beside the JavaScript body
7+
8+
Clause-②: no — help text only
9+
Metadata-protocol: none
10+
11+
The Studio hook form's `refusals` row ended its help with "JavaScript (L2) bodies only", while `HookSchema` answers a refusal catalogue on a sandboxed `js` body and on an in-process `handler` alike, and refuses it on an `expression` body. The help now reads "For a JavaScript (L2) body or a handler; refused on an expression body", and says the code is the one the hook throws rather than the body. The translated copies in the ten metadata-form bundles of `@objectstack/platform-objects` carry the same correction. No behaviour changes: what a hook may declare, and what is refused, is exactly as before.

‎packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ export const arMetadataForms: NonNullable<TranslationData['metadataForms']> = {
967967
},
968968
refusals: {
969969
label: "حالات الرفض",
970-
helpText: "فهرس حالات الرفض، مفهرس برمز SCREAMING_SNAKE الذي يرميه المتن (مثل CLEAN_VERSION_REQUIRED). يقرأ المستدعي الرسالة المُعلنة، مترجمة إلى لغته، مع الحالة المُعلنة. لمتون JavaScript ‏(L2) فقط"
970+
helpText: "فهرس حالات الرفض، مفهرس برمز SCREAMING_SNAKE الذي يرميه الخطاف (مثل CLEAN_VERSION_REQUIRED). يقرأ المستدعي الرسالة المُعلنة، مترجمة إلى لغته، مع الحالة المُعلنة. لمتن JavaScript ‏(L2) أو معالج؛ ويُرفض في متن التعبير"
971971
},
972972
"refusals.message": {
973973
label: "الرسالة",

‎packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ export const deMetadataForms: NonNullable<TranslationData['metadataForms']> = {
967967
},
968968
refusals: {
969969
label: "Ablehnungen",
970-
helpText: "Katalog der Ablehnungen, nach dem SCREAMING_SNAKE-Code, den der Rumpf wirft (z. B. CLEAN_VERSION_REQUIRED). Der Aufrufer liest die deklarierte Meldung, übersetzt in seine Sprache, mit dem deklarierten Status. Nur JavaScript-Rümpfe (L2)"
970+
helpText: "Katalog der Ablehnungen, nach dem SCREAMING_SNAKE-Code, den der Hook wirft (z. B. CLEAN_VERSION_REQUIRED). Der Aufrufer liest die deklarierte Meldung, übersetzt in seine Sprache, mit dem deklarierten Status. Für einen JavaScript-Rumpf (L2) oder einen Handler; bei einem Ausdrucksrumpf abgelehnt"
971971
},
972972
"refusals.message": {
973973
label: "Meldung",

‎packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ export const enMetadataForms: NonNullable<TranslationData['metadataForms']> = {
967967
},
968968
refusals: {
969969
label: "Refusals",
970-
helpText: "Refusal catalogue, keyed by the SCREAMING_SNAKE code the body throws (e.g. CLEAN_VERSION_REQUIRED). The caller reads the declared message, translated into their language, with the declared status. JavaScript (L2) bodies only"
970+
helpText: "Refusal catalogue, keyed by the SCREAMING_SNAKE code the hook throws (e.g. CLEAN_VERSION_REQUIRED). The caller reads the declared message, translated into their language, with the declared status. For a JavaScript (L2) body or a handler; refused on an expression body"
971971
},
972972
"refusals.message": {
973973
label: "Message",

‎packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ export const esESMetadataForms: NonNullable<TranslationData['metadataForms']> =
967967
},
968968
refusals: {
969969
label: "Rechazos",
970-
helpText: "Catálogo de rechazos, indexado por el código SCREAMING_SNAKE que lanza el cuerpo (p. ej. CLEAN_VERSION_REQUIRED). Quien llama recibe el mensaje declarado, traducido a su idioma, con el estado declarado. Solo cuerpos JavaScript (L2)"
970+
helpText: "Catálogo de rechazos, indexado por el código SCREAMING_SNAKE que lanza el gancho (p. ej. CLEAN_VERSION_REQUIRED). Quien llama recibe el mensaje declarado, traducido a su idioma, con el estado declarado. Para un cuerpo JavaScript (L2) o un manejador; se rechaza en un cuerpo de expresión"
971971
},
972972
"refusals.message": {
973973
label: "Mensaje",

‎packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ export const frMetadataForms: NonNullable<TranslationData['metadataForms']> = {
967967
},
968968
refusals: {
969969
label: "Refus",
970-
helpText: "Catalogue des refus, indexé par le code SCREAMING_SNAKE que lève le corps (par ex. CLEAN_VERSION_REQUIRED). L’appelant lit le message déclaré, traduit dans sa langue, avec le statut déclaré. Corps JavaScript (L2) uniquement"
970+
helpText: "Catalogue des refus, indexé par le code SCREAMING_SNAKE que lève le hook (par ex. CLEAN_VERSION_REQUIRED). L’appelant lit le message déclaré, traduit dans sa langue, avec le statut déclaré. Pour un corps JavaScript (L2) ou un gestionnaire ; refusé sur un corps expression"
971971
},
972972
"refusals.message": {
973973
label: "Message",

‎packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ export const jaJPMetadataForms: NonNullable<TranslationData['metadataForms']> =
967967
},
968968
refusals: {
969969
label: "拒否カタログ",
970-
helpText: "本体がスローする SCREAMING_SNAKE のコード(例: CLEAN_VERSION_REQUIRED)をキーとする拒否カタログ。呼び出し元には宣言したメッセージ(その言語に翻訳)と宣言したステータスが返ります。JavaScript(L2)本体のみ"
970+
helpText: "フックがスローする SCREAMING_SNAKE のコード(例: CLEAN_VERSION_REQUIRED)をキーとする拒否カタログ。呼び出し元には宣言したメッセージ(その言語に翻訳)と宣言したステータスが返ります。JavaScript(L2)本体またはハンドラーで使用可能。expression 本体では拒否されます"
971971
},
972972
"refusals.message": {
973973
label: "メッセージ",

‎packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ export const koMetadataForms: NonNullable<TranslationData['metadataForms']> = {
967967
},
968968
refusals: {
969969
label: "거부",
970-
helpText: "본문이 던지는 SCREAMING_SNAKE 코드(예: CLEAN_VERSION_REQUIRED)를 키로 하는 거부 카탈로그입니다. 호출자는 선언된 메시지를 자신의 언어로 번역해 선언된 상태와 함께 읽습니다. JavaScript(L2) 본문 전용"
970+
helpText: "훅이 던지는 SCREAMING_SNAKE 코드(예: CLEAN_VERSION_REQUIRED)를 키로 하는 거부 카탈로그입니다. 호출자는 선언된 메시지를 자신의 언어로 번역해 선언된 상태와 함께 읽습니다. JavaScript(L2) 본문 또는 핸들러용이며, expression 본문에서는 거부됩니다"
971971
},
972972
"refusals.message": {
973973
label: "메시지",

‎packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ export const ptBRMetadataForms: NonNullable<TranslationData['metadataForms']> =
967967
},
968968
refusals: {
969969
label: "Recusas",
970-
helpText: "Catálogo de recusas, indexado pelo código SCREAMING_SNAKE que o corpo lança (por exemplo CLEAN_VERSION_REQUIRED). O chamador lê a mensagem declarada, traduzida para o idioma dele, com o status declarado. Somente corpos JavaScript (L2)"
970+
helpText: "Catálogo de recusas, indexado pelo código SCREAMING_SNAKE que o hook lança (por exemplo CLEAN_VERSION_REQUIRED). O chamador lê a mensagem declarada, traduzida para o idioma dele, com o status declarado. Para um corpo JavaScript (L2) ou um handler; recusado em um corpo de expressão"
971971
},
972972
"refusals.message": {
973973
label: "Mensagem",

‎packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ export const ruMetadataForms: NonNullable<TranslationData['metadataForms']> = {
967967
},
968968
refusals: {
969969
label: "Отказы",
970-
helpText: "Каталог отказов с ключами — кодами SCREAMING_SNAKE, которые выбрасывает тело (например, CLEAN_VERSION_REQUIRED). Вызывающий получает объявленное сообщение в переводе на свой язык и с объявленным статусом. Только для тел JavaScript (L2)"
970+
helpText: "Каталог отказов с ключами — кодами SCREAMING_SNAKE, которые выбрасывает хук (например, CLEAN_VERSION_REQUIRED). Вызывающий получает объявленное сообщение в переводе на свой язык и с объявленным статусом. Для тела JavaScript (L2) или обработчика; для тела-выражения отклоняется"
971971
},
972972
"refusals.message": {
973973
label: "Сообщение",

0 commit comments

Comments
 (0)