Repository navigation
Commit b703678
docs(skills): the registerHook example names the app's onEnable export, and the refusal-list teaching names its routes, the /data bound and its section (#38182)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu5aGSp1oEmXTAmjuazY7oxd)_
Fixes #38161
Fixes #37642
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 是什么:照数据技能写钩子的开发者和 AI 会读到正确的注册位置:示例注释原来写「放在插件的 onEnable
里」,插件根本没有这个方法,照写的钩子永远不会注册;现在写明放在应用配置导出的 onEnable
里,插件则在启动方法里经服务拿引擎注册。拒绝清单一段还补了两点:数据接口会把返回消息截在 500
字,长清单的最后一行在那里会被截掉;哪些接口返回拒绝清单也点了名。动作技能页的「规则在那里」改成点名所指的章节。运行时行为不变。
- 为什么:属于「AI 照技能写出能跑的元数据」。照错误注释写的钩子不跑也不报错,是静默失效。
- 出错会怎样:只是技能文字,写错了是教错,可直接撤回;两个文件都在字数上限,新增靠删同文件里的重复说法来付,没有事实被删掉。
- 要你做的:座位审核和合同审核通过后,技能目录需你批准合并。
## What changes
- `skills/objectstack-data/references/data-hooks.md`, Registration
Methods, method 2 (#38161): the comment `// in your plugin's onEnable()`
named a method no kernel plugin has. It now reads `// in the app's
onEnable export (objectstack.config.ts). A kernel plugin has no ctx.ql:
from start(ctx), ctx.getService('objectql').registerHook(…)`, and the
heading's "the plugin escape hatch" became "the `onEnable` escape
hatch".
- `packages/core/src/types.ts:155` `Plugin` has `init` / `start?` /
`destroy?` and no `onEnable`; `PluginContext` (:16) has `getService`
(:37) and no `ql`.
- `packages/runtime/src/app-plugin.ts:1795-1834` resolves the bundle's
`onEnable` and calls it with `hostContext = { ...ctx, ql, logger,
drivers }`; `packages/spec/src/stack.zod.ts:1319` declares `onEnable` on
the stack.
- `packages/objectql/src/plugin.ts:932` registers the engine as service
`objectql`; `engine.ts:715` is `registerHook`; `AppPlugin.start` itself
reads `ctx.getService('objectql')` (`app-plugin.ts:1464`).
- Same file, Declared refusals, the several-reasons bullet (#37642 N2,
N5): "the HTTP doors answer `details.refusals`" became: `/data` cuts
`userMessage` (a single sentence's too) at 500 characters, so a long
list loses its closing line there; `/data` and `/actions` answer
`details.refusals: [{ reason, message }]` uncut (MCP tools relay the
lines as text).
- Bound: `packages/types/src/data-error-classification.ts:55`
`CLIENT_MESSAGE_MAX = 500`, applied to a declared `userMessage` by
`mapDataError` → `withDeclaredUserMessage` →
`boundedDeclaredUserMessage` (:568-703); the list stays whole
(:609-620). `/actions` uses the unbounded `declaredUserMessage`
(`thrown-http-error.ts:408`, via `actions-door-answer.ts:415-438`).
- Routes: `/data` `withDeclaredRefusalLines`
(`data-error-classification.ts:622`); `/actions`
`action-dispatch.ts:957` → `thrown-http-error.ts:396-404`; MCP
`packages/mcp/src/mcp-http-tools.ts:1474-1498` appends the lines as
text.
- `skills/objectstack-ui/rules/actions.md`, Refusing by code (#37642
N4): "(rules there)" named no place; it now ends "(Declared refusals)",
the last segment of the same paragraph's pointer "objectstack-data →
Lifecycle Hooks → Declared refusals". "closed by" became "then" to pay
the byte.
- `.changeset/38161-skills-hook-registration-refusal-pointers.md`:
`@objectstack/skills` patch.
**Paid by cuts in `data-hooks.md`** (each fact still in the file): the
Error-handling row's "`onError` defaults to `'abort'` unconditionally"
(the row keeps "Also aborts by default"); the repeated transition
expression → "as above" (the code block above carries it); the `after*`
bullet's "(`record` is that row's real state, not the bare payload)"
(the section's bold lead says it); Gotcha 1's one-line `findOne` block →
"re-query it by `ctx.result.id`, as the example below does" (the
copy-paste example and Query shape carry the line); the copy-paste
intro's "(a lookup FK that is **not** in the partial patch)" (Gotcha 1
says it); the `ctx.log` bullet's "two independent causes: (1) … (2)"
scaffolding.
**Skills readings** (lines / bytes, merge base 4f7aa88 → head):
| | before | after |
|:--|--:|--:|
| `data-hooks.md` | 856 / 40477 | 851 / 40480 |
| `actions.md` | 268 / 15670 | 268 / 15671 |
| all `skills/**/SKILL.md`, lines | 4953 | 4953 |
| whole `skills/` tree, bytes | 1224868 | 1224872 |
Both files stay at their token ceilings (10120, 3918); no ceiling line
changed.
The `skills/**` edits were written by isolated sub-agents at the
contract-review tier; `node scripts/pm/verify-review-tier.mjs` on their
transcripts: `PASS — 4 assistant turn(s)` (actions.md) and `PASS — 54
assistant turn(s)` (data-hooks.md), every one served at
CONTRACT_REVIEW_TIER. Not traced: whether the dispatcher's own `/data`
twin (`packages/runtime/src/domains/data.ts`) carries the same cut and
list, so the text names only `/data` and `/actions`.
## Tests
<details><summary>gates (head 7eb3a71)</summary>
Derived by `node scripts/pm/dispatch-gates.mjs --commands` (48 lines).
Run locally, exit 0 (30): `check-skills-token-ratchet.mjs`,
`check-adr-0087-registration.mjs`, `check-changeset-no-major.mjs`,
`check-closing-keyword-parity.mjs`, `check-comment-mask-corpus.mjs`,
`check-doc-route-spelling.mjs --advisory`, `check-empty-changeset.mjs`,
`@objectstack/spec check:skill-refs`, `check:adr-anchors`,
`check:agent-test-spelling`, `check:changeset-gate-self-tests`,
`check:ci-filter-parity`, `check:closed-ceremony-text`,
`check:corpus-claim-drift`, `check:cross-package-test-inputs`,
`check:doc-authoring`, `check:driver-memory-census`,
`check:gitlink-declared`, `check:nul-bytes`, `check:pm-expected-skips`,
`check:pm-governed-merges`, `check:pm-skill-id-lint`,
`check:published-files`, `check:refd-timer-probe`, `check:role-word`,
`check:skill-compatibility`, `check:skill-frame-sync`,
`check:skill-identifier-liveness`, `check:skill-links`,
`check:watch-hint-literal`.
NOT MEASURED locally, reason: they read built `dist/` and no package is
built in this worktree (the diff touches no package source):
`check:doc-formula-expressions`, `check:dts-closure`,
`check:dual-build-cjs-loads`, `check:lean-entry-closure`,
`check:sourcemap-no-sources-content`. Left to CI, as are the
`--self-test` lines.
</details>
## Acceptance notes
- The 4xx `error` text on `/data` is cut at the same 500 characters
(`data-error-classification.ts:1679`); not added, it did not fit the
budget and the card asks for `userMessage`.
- A throw that leaves the dispatcher's `dispatch()` exits through
`errorResponseBase` (`packages/runtime/src/dispatcher-plugin.ts:711`),
where no `refusals` handling was seen; that is why the page does not
promise the list on the dispatcher's other routes. Read only, not filed.
## Verification
Read first: `data-hooks.md` method 2 code block; the several-reasons
bullet under Declared refusals; the last sentence of "Refusing by code"
in `actions.md`.
Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints
`61 authored bundle file(s) within their ceilings`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgWXNEKowao8Fvau3Bs
<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgWXNEKowao8Fvau3Bs -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 3337425 commit b703678
3 files changed
Lines changed: 31 additions & 22 deletions
File tree
- .changeset
- skills
- objectstack-data/references
- objectstack-ui/rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
| 148 | + | |
150 | 149 | | |
151 | 150 | | |
152 | 151 | | |
| |||
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
169 | | - | |
170 | | - | |
| 168 | + | |
171 | 169 | | |
172 | 170 | | |
173 | 171 | | |
| |||
343 | 341 | | |
344 | 342 | | |
345 | 343 | | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
| 344 | + | |
351 | 345 | | |
352 | 346 | | |
353 | 347 | | |
| |||
367 | 361 | | |
368 | 362 | | |
369 | 363 | | |
370 | | - | |
371 | | - | |
| 364 | + | |
372 | 365 | | |
373 | 366 | | |
374 | 367 | | |
| |||
404 | 397 | | |
405 | 398 | | |
406 | 399 | | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
411 | 403 | | |
412 | 404 | | |
413 | 405 | | |
| |||
723 | 715 | | |
724 | 716 | | |
725 | 717 | | |
726 | | - | |
| 718 | + | |
727 | 719 | | |
728 | 720 | | |
729 | 721 | | |
730 | 722 | | |
731 | 723 | | |
732 | 724 | | |
733 | | - | |
| 725 | + | |
| 726 | + | |
734 | 727 | | |
735 | 728 | | |
736 | 729 | | |
| |||
812 | 805 | | |
813 | 806 | | |
814 | 807 | | |
815 | | - | |
816 | | - | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
817 | 812 | | |
818 | 813 | | |
819 | 814 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
| 150 | + | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
0 commit comments