Skip to content

Commit 0169fc1

Browse files
committed
fix(spec): the action refusal sentences and changeset say what the diff publishes
The changeset's Clause-② line named a runtime export the package does not make (the action body runner answers through resolveActionRefusal internally) and listed two of the nine new spec exports; it now lists them all. The save-time sentence for a script action with no body no longer claims no inline target either, and the action key builder's doc calls itself the action twin. Claude-Session: https://claude.ai/code/session_01ADHkmP879Ku8wbNev27oyN Co-authored-by: Claude <noreply@anthropic.com>
1 parent ff1ba66 commit 0169fc1

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎.changeset/34273-action-refusals.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
feat(actions): an action body refuses in the caller's language through a declared refusal catalogue
99

10-
Clause-②: yes (widening) — an action may now declare `refusals` (`ActionRefusalSchema`); translation bundles accept `objects.<object>._actions.<action>.refusals.<CODE>.message` and `globalActions.<action>.refusals.<CODE>.message` (with `….reasons.<REASON>.message`); `@objectstack/spec` exports `ActionRefusalSchema` and `actionRefusalMessageKey`, `@objectstack/runtime` exports `resolveActionRefusal`. Nothing that was accepted before is refused
10+
Clause-②: yes (widening) — an action may now declare `refusals` (`ActionRefusalSchema`); translation bundles accept `objects.<object>._actions.<action>.refusals.<CODE>.message` and `globalActions.<action>.refusals.<CODE>.message` (with `….reasons.<REASON>.message`); `@objectstack/spec` exports `ActionRefusalSchema` and the `ActionRefusal` type (`ui`), `actionRefusalMessageKey` (`system`), and `ACTION_REFUSAL_MESSAGE_HOLE_REFUSED`, `actionRefusalsWithoutSandboxedBody`, `undeclaredActionRefusalCodeAtSave`, `undeclaredActionRefusalReasonAtSave`, `undeclaredActionRefusalAtRun` and `undeclaredActionRefusalReasonAtRun` (`data`); `@objectstack/runtime` adds no export: the action body runner answers through `resolveActionRefusal` internally. Nothing that was accepted before is refused
1111
Metadata-protocol: added
12-
Skills-docs: follow-up — `skills/objectstack-i18n/SKILL.md` lists the hook refusal key only, and no skill teaches an action's `refusals`; owed to a follow-up card. `content/docs/ui/actions.mdx` and `content/docs/ui/translations.mdx` gain the section and the key row here
12+
Skills-docs: follow-up #34824 — `skills/objectstack-i18n/SKILL.md` lists the hook refusal key only and `skills/objectstack-ui/rules/actions.md` teaches no action `refusals`; `content/docs/ui/actions.mdx` and `content/docs/ui/translations.mdx` gain the section and the key row here
1313

1414
A `script` action's `js` body can now refuse the way a hook does: declare the refusals it may throw, keyed by code, and throw the code instead of the sentence — `refusals: { NOT_DRAFT: { message: 'Only a draft invoice can be signed off.', status: 409 } }`, then `throw { code: 'NOT_DRAFT' }`. The server answers with the entry's sentence in the caller's locale (the request's `executionContext.locale`), else the declared one, on the refusal's `userMessage`, with the entry's status (400 when it names none). The entry is the hook catalogue's, built by one shared factory: optional `reasons` (further sentences under one code) and `params` (the names a `{{ }}` hole may fill), under the same rules.
1515

‎packages/spec/src/data/hook-refusal-codes.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ export function actionRefusalsWithoutSandboxedBody(type: string, language: strin
552552
? `\`type: '${type}'\`, which runs no code of the action's own`
553553
: language !== undefined
554554
? `a \`${language}\` body`
555-
: 'no `body` and no inline `target` function';
555+
: 'no `body` (an inline `target` function `os build` could not lower leaves none)';
556556
return (
557557
"`refusals` is answered for a `type: 'script'` action's sandboxed `body` (`language: 'js'`) and for its inline "
558558
+ `\`target\` function (which \`os build\` lowers to a \`js\` body), and this action has ${has}: nothing it runs `

‎packages/spec/src/system/i18n-resolver.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4462,7 +4462,7 @@ export function hookTextMessageKey(hookName: string, key: string): string {
44624462

44634463
/**
44644464
* Dot-notation i18n key for an action's declared refusal message (#34273,
4465-
* `ActionSchema.refusals`) — the hook twin of {@link hookRefusalMessageKey},
4465+
* `ActionSchema.refusals`) — the action twin of {@link hookRefusalMessageKey},
44664466
* at the address every action translation is read at
44674467
* ({@link actionTranslationNode}):
44684468
*

‎packages/spec/src/ui/action-refusals.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('Action.refusals — the declared catalogue', () => {
6060
});
6161

6262
it.each([
63-
['no body', { type: 'script' }, "no `body` and no inline `target` function"],
63+
['no body', { type: 'script' }, "no `body` (an inline `target` function `os build` could not lower leaves none)"],
6464
['an expression body', { type: 'script', body: { language: 'expression', source: 'record.amount > 0' } }, 'a `expression` body'],
6565
['a url action', { type: 'url', target: 'https://example.com' }, "`type: 'url'`"],
6666
['a flow action', { type: 'flow', target: 'approve_invoice' }, "`type: 'flow'`"],

0 commit comments

Comments
 (0)