Repository navigation
Commit 2c93001
docs(skills): data-hooks says an action body's input and ctx are already bound and names the refused redeclaration (#36143)
Fixes #34988
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:让 AI 写「动作脚本」的客户,技能手册现在会先说明脚本里已有两个现成的参数,不能再声明同名变量;以前手册没提,AI
照常见写法写出的脚本在校验和保存时被拒。
- 为什么做:属于「教 AI 正确编写元数据的技能手册」这条线,补上平台已经拒收、手册却没教的一处。
- 出错会怎样:只改说明文字,不改平台行为;最坏是措辞误导作者,撤回这次合并即可恢复原文。
- 要你做什么:这是对外发布的技能手册,需要你审阅并合并。
## What changes
`skills/objectstack-data/references/data-hooks.md`, and its eval case
33:
- **The action wrapper paragraph** (under the sandbox `ctx` table) now
reads: the action params arrive as `input`; both names are already
bound; `const input = ctx.input || {};` or `let ctx` is
`action-body-does-not-compile`, refused like a hook body's, with a link
to the hook compile paragraph in § Sandbox restrictions, which carries
the commands (`os validate`, `os build`, `os lint`), the runtime save
(`422 INVALID_METADATA`) and the fix.
- **The hook compile paragraph** it links to: the suggested local is now
`const data = ctx.input || {};` (was `const input = …`, the exact line
an action body is refused for, now one click away from the action
warning); `a runtime hook save` became `a runtime save`, so the sentence
holds for the action and object saves too.
- **Paid for inside the file.** The file sat 2 tokens under its
shrink-only ceiling on `origin/main` (`check-skills-token-ratchet`:
10120 of 10122), so the new text is paid for by two deletions of
restatement: the hook paragraph no longer re-prints the `(async (ctx) =>
{ … })` wrapper that § The `body` shape shows, and the `condition`
paragraph no longer repeats the `input.id` / single-record-context
clause that the "Why so few?" note states with the same ADR-0058
citation.
The rule id and the refusal are quoted from the code on `origin/main`:
`ACTION_BODY_DOES_NOT_COMPILE = 'action-body-does-not-compile'` in
`packages/lint/src/validate-action-body-compiles.ts`, and the ADR-0087
entry `action-body-does-not-compile-refused` ("Refused at error as
`action-body-does-not-compile` (422 INVALID_METADATA at the doors)",
loaded by `os validate` / `os build` / `os lint`).
- **Eval case 33**
(`skills/objectstack-data/evals/hooks-security-seeds-datasources.json`,
rework round 1 on the L2 should-fix S1): `must_contain` is now
`hook-body-does-not-compile` and `ctx.input` (a token both printed fixes
carry; the old `input.status` failed the `const data = …` rename the
paragraph now prints), and `expected_output` spells that rename.
Changeset: `.changeset/34988-action-wrapper-redeclare.md`,
`@objectstack/skills` patch (the catalog ships in that package).
## Tests
Text only; no tested behaviour changes, so no ablation.
Skills size readings (head `7613457f`; `data-hooks.md` unchanged since
`54a18393`):
| Reading | Before | After |
|:--|:--|:--|
| `data-hooks.md`, lines | 884 | 885 |
| `data-hooks.md`, tokens (`ceil(utf8 bytes / 4)`) | 10120 | 10121
(ceiling 10122) |
| All `skills/*/SKILL.md`, lines | 4945 | 4945 |
| Whole shipped tree, tokens | 288733 | 288734 |
## Acceptance notes
- Card Done-when, each clause: parameters named as already bound (yes);
the refused redeclaration shown (`const input = ctx.input || {};`, `let
ctx`); the lint rule linked (rule id `action-body-does-not-compile` plus
the link to the paragraph listing the commands that report it).
- The claim's file surface was the action wrapper paragraph only. Three
more spots in the same file were touched, all forced by the token
ceiling or by the link: the two restatement deletions and the hook
paragraph's two wording changes above. No ceiling row was moved.
- `os explain action-body-does-not-compile` (the rule carries an
explanation in `packages/lint/src/rule-explanations.ts`) did not fit the
ceiling and is not mentioned.
## Verification
- First file to read:
`skills/objectstack-data/references/data-hooks.md`, the hunk under the
`ctx` table (the new teaching), then the `condition` hunk (the riskiest
one: a deletion in text this card did not own).
- Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints
`skills/objectstack-data/references/data-hooks.md is 10121 tokens
(ceiling 10122; headroom 1)` and exits 0.
Local gates at `54a18393`: the 48 commands `dispatch-gates --commands`
derives; 43 exited 0 (among them `check:skill-links`,
`check:skill-refs`, `check:skill-identifier-liveness`,
`check:doc-authoring`, `check:nul-bytes`, `check-skills-token-ratchet`,
`check-empty-changeset`); 5 exited 3, NOT MEASURED, reason: they need a
full workspace build this text change does not warrant, left to CI
(`check:doc-formula-expressions` in `@objectstack/lint`,
`check:dts-closure`, `check:dual-build-cjs-loads`,
`check:lean-entry-closure`, `check:sourcemap-no-sources-content`).
`overlap-check` against `origin/main` and open pulls 36089, 36087,
36067, 36104: merges cleanly.
---
_Generated by [Claude
Code](https://claude.ai/code/session_017xRBcSPM86QhYAcidhG5Bu)_
<!-- signed: repo:objectstack#6 · sunhaolin ·
session_017xRBcSPM86QhYAcidhG5Bu -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a64c3b8 commit 2c93001
3 files changed
Lines changed: 17 additions & 8 deletions
File tree
- .changeset
- skills/objectstack-data
- evals
- references
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
353 | | - | |
| 353 | + | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
| 356 | + | |
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
| 167 | + | |
169 | 168 | | |
170 | 169 | | |
171 | 170 | | |
| |||
248 | 247 | | |
249 | 248 | | |
250 | 249 | | |
251 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| |||
338 | 339 | | |
339 | 340 | | |
340 | 341 | | |
341 | | - | |
| 342 | + | |
342 | 343 | | |
343 | 344 | | |
344 | | - | |
| 345 | + | |
345 | 346 | | |
346 | | - | |
| 347 | + | |
347 | 348 | | |
348 | 349 | | |
349 | 350 | | |
| |||
0 commit comments