You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3812688
Browse filesBrowse the repository at this point in the historyBrowse files
docs(skills): fit the hook refusal section under the data-hooks token ceiling
Pays for the new section by deleting the error-handling examples the handler
and onError sections already carry, and folds the testing pointer into the
references list.
Claude-Session: https://claude.ai/code/session_01WGufzfyVQuRsL6SRGuKCem
Co-authored-by: Claude <noreply@anthropic.com>
-**Codes** are SCREAMING_SNAKE (`CREDIT_LIMIT`). The error envelope carries
1010
-
it as `declaredCode`, beside the status's registered `code`
1011
-
(`VALIDATION_ERROR` for 400), so a client can branch on it.
1012
-
-**The message is translated** through
1013
-
`hooks.<hook>.refusals.<CODE>.message` in the caller's locale; `os i18n
1014
-
extract` scaffolds one key per declared entry and `os i18n check` counts them.
1015
-
The message is plain text — no `{{ }}` holes are filled. The body's own
1016
-
`Error` text and `status` are not what the caller reads.
1017
-
-**An undeclared code is refused loudly.** A code the body throws literally
1018
-
(`{ code: 'X' }`, or `e.code = 'X'; throw e`) that the catalogue does not
1019
-
declare fails the save at `body.source`. Any other undeclared code — or a
1020
-
throw with no code — is a `500` fault at run time, naming the hook and the
1021
-
code. So once a hook declares `refusals`, every refusal it makes is one of them.
1022
-
- An error a `ctx.api` call raised that the body lets leave unchanged, and a
1023
-
crash (`TypeError`), pass through as before; they are not the body's refusal.
1024
-
- The catalogue is read for a sandboxed `body`. An inline `handler` keeps
1025
-
throwing its own errors.
1026
-
1027
-
---
1028
-
1029
-
## Testing Hooks
1030
-
1031
-
Hook test harnesses — vitest units and `LiteKernel` integration setups — are the
1032
-
**objectstack-platform** skill's surface (its frontmatter claims "test harnesses via
1033
-
LiteKernel"): see [objectstack-platform/SKILL.md](../../objectstack-platform/SKILL.md).
1034
-
1035
-
---
956
+
- Codes are SCREAMING_SNAKE; the error envelope carries one as `declaredCode`.
957
+
- The plain-text message is translated via `hooks.<hook>.refusals.<CODE>.message`
958
+
in the caller's locale; the body's own error text and `status` are not used.
959
+
- An undeclared code, or none, is refused: at save if thrown literally, else as
960
+
a `500` fault. Unchanged `ctx.api` errors and crashes pass through.
1036
961
1037
962
---
1038
963
@@ -1042,5 +967,6 @@ LiteKernel"): see [objectstack-platform/SKILL.md](../../objectstack-platform/SKI
1042
967
-[Project hooks pattern](../SKILL.md#lifecycle-hooks) — Hook integration in the data skill
1043
968
-[objectstack-platform/references/plugin-hooks.md](../../objectstack-platform/references/plugin-hooks.md) — plugin/kernel hooks (a different extension point)
1044
969
-[objectstack-automation](../../objectstack-automation/SKILL.md) — Flows and Workflows
970
+
-[objectstack-platform/SKILL.md](../../objectstack-platform/SKILL.md) — hook test harnesses (vitest units, `LiteKernel`)
0 commit comments