Skip to content

Commit 547ffca

Browse files
committed
fix(spec): record why the hook form does not offer refusals, instead of a record control that would stamp a refused key
Claude-Session: https://claude.ai/code/session_01WGufzfyVQuRsL6SRGuKCem Co-authored-by: Claude <noreply@anthropic.com>
1 parent bf529b5 commit 547ffca

6 files changed

Lines changed: 9 additions & 64 deletions

File tree

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -937,18 +937,6 @@ export const enMetadataForms: NonNullable<TranslationData['metadataForms']> = {
937937
label: "Memory Mb",
938938
helpText: "Per-invocation memory cap (MB, max 256)"
939939
},
940-
refusals: {
941-
label: "Refusals",
942-
helpText: "Refusals the body may throw, by code — the body throws an error carrying the code, and the caller reads this message"
943-
},
944-
"refusals.message": {
945-
label: "Message",
946-
helpText: "What the user reads (translated per locale)"
947-
},
948-
"refusals.status": {
949-
label: "Status",
950-
helpText: "HTTP status, 400–499 (default 400)"
951-
},
952940
handler: {
953941
label: "Handler",
954942
helpText: "Handler function name (deprecated — prefer `body`)"

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -937,18 +937,6 @@ export const esESMetadataForms: NonNullable<TranslationData['metadataForms']> =
937937
label: "Memoria (MB)",
938938
helpText: "Límite de memoria por invocación (MB, máx. 256)"
939939
},
940-
refusals: {
941-
label: "Rechazos",
942-
helpText: "Rechazos que el cuerpo puede lanzar, por código: el cuerpo lanza un error con el código y quien llama lee este mensaje"
943-
},
944-
"refusals.message": {
945-
label: "Mensaje",
946-
helpText: "Lo que lee el usuario (traducido por idioma)"
947-
},
948-
"refusals.status": {
949-
label: "Estado",
950-
helpText: "Estado HTTP, 400–499 (400 por defecto)"
951-
},
952940
handler: {
953941
label: "Manejador",
954942
helpText: "Nombre de función manejadora (obsoleto — preferir `body`)"

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -937,18 +937,6 @@ export const jaJPMetadataForms: NonNullable<TranslationData['metadataForms']> =
937937
label: "メモリ(MB)",
938938
helpText: "呼び出しごとのメモリ上限(MB、最大 256)"
939939
},
940-
refusals: {
941-
label: "拒否カタログ",
942-
helpText: "body が投げうる拒否をコード別に宣言 —— body はそのコードを持つエラーを投げ、呼び出し側はこのメッセージを受け取ります"
943-
},
944-
"refusals.message": {
945-
label: "メッセージ",
946-
helpText: "ユーザーが読む文言(ロケールごとに翻訳)"
947-
},
948-
"refusals.status": {
949-
label: "ステータス",
950-
helpText: "HTTP ステータス、400–499(既定 400)"
951-
},
952940
handler: {
953941
label: "ハンドラー",
954942
helpText: "ハンドラー関数名(非推奨 — `body` を推奨)"

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -937,18 +937,6 @@ export const zhCNMetadataForms: NonNullable<TranslationData['metadataForms']> =
937937
label: "内存(MB)",
938938
helpText: "单次调用内存上限(MB,最大 256)"
939939
},
940-
refusals: {
941-
label: "拒绝目录",
942-
helpText: "按代码列出 body 可能抛出的拒绝 —— body 抛出带该代码的错误,调用方读到此处的消息"
943-
},
944-
"refusals.message": {
945-
label: "消息",
946-
helpText: "用户读到的文字(按语言翻译)"
947-
},
948-
"refusals.status": {
949-
label: "状态码",
950-
helpText: "HTTP 状态码,400–499(默认 400)"
951-
},
952940
handler: {
953941
label: "处理器",
954942
helpText: "处理器函数名(已废弃——建议使用 body)"

‎packages/spec/src/data/hook.form.ts‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,6 @@ export const hookForm = defineForm({
4646
{ field: 'memoryMb', type: 'number', helpText: 'Per-invocation memory cap (MB, max 256)' },
4747
],
4848
},
49-
{
50-
field: 'refusals',
51-
type: 'record',
52-
helpText: 'Refusals the body may throw, by code — the body throws an error carrying the code, and the caller reads this message',
53-
keyField: {
54-
field: 'code',
55-
label: 'Code',
56-
placeholder: 'CREDIT_LIMIT',
57-
helpText: 'SCREAMING_SNAKE code the body throws',
58-
regex: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$',
59-
},
60-
fields: [
61-
{ field: 'message', type: 'text', required: true, helpText: 'What the user reads (translated per locale)' },
62-
{ field: 'status', type: 'number', helpText: 'HTTP status, 400–499 (default 400)' },
63-
],
64-
},
6549
],
6650
},
6751
{

‎packages/spec/src/system/metadata-form-zod-reconciliation.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,15 @@ const LEDGER: ReadonlyArray<OmitEntry | SubsetEntry> = [
331331
key: 'requires',
332332
why: "platform-written, never authored — the schema's own words: `derived from the source at save — omit it`. The key exists only on an `html` / `jsx` page, where, on a server with the deployment's SDUI manifest, the save door stamps the compiled list and refuses a written list that disagrees (`page-requires-disagrees-with-source`); on every other kind the parse refuses it; and the Studio page editor drops the key on every save. A control would invite the list the describe tells every author to omit",
333333
},
334+
// #26170 — a hook's refusal catalogue is a record keyed by the code, and an
335+
// entry has no member that echoes its key.
336+
{
337+
kind: 'omit',
338+
type: 'hook',
339+
path: ROOT_PATH,
340+
key: 'refusals',
341+
why: "no record control fits it — the form's `record` editor stamps each entry's key into the entry under `keyField` (`{ ...entry, [keyField]: key }`), and a refusal entry is closed at `message` / `status`: the key IS the code, so a stamped `code` (or the default `name`) is refused by `HookRefusalSchema`. The catalogue is authored beside the body it serves, in the hook's source; offering it needs a key-only record control, a form-face addition rather than a reconciliation",
342+
},
334343
// #22158 — the print declaration (ruling B′ on #8346) lands spec-first:
335344
// `planned` in the liveness ledger, read by no renderer until card ② (the
336345
// console's print rendering), which is also where the ruling puts its

0 commit comments

Comments
 (0)