Repository navigation
Commit 144d368
docs(skills): data-hooks says which refused regex patterns are errors and which only warn (#36970)
Fixes #36727
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:使用数据技能包的 AI
助手,以前被告知「钩子脚本里写错的正则只会得到警告」,现在被告知实情:运行时也拒绝的正则会在保存和校验时直接报错,只有三种运行时其实能跑的写法才是警告。
- 为什么做:上一张已合并的卡把这类正则从警告改成了报错,技能包里这句话没跟上,AI 会照旧说法写出发布时被拦下的脚本。
- 出错会怎样:最坏是 AI 读到的说明仍不够准确,不影响任何运行行为;可以直接撤回本次合并。
- 要你做什么:无。
## What changes
One bullet of `skills/objectstack-data/references/data-hooks.md`,
"Refused when it does not compile". Its last sentence said "A regex
pattern the checking engine refuses is a warning: the runtime may accept
it." That stopped being true when the compile rules were narrowed (merge
commit `fe190968eb`,
`packages/lint/src/validate-action-body-compiles.ts`).
The sentence now reads: "A regex pattern the runtime refuses too is that
error; only a duplicate named group, a modifier group (`(?i:a)`) or a
Unicode property name only the runtime knows (any refused one on a
pre-17.0-Unicode host) warns."
Checked against the landed code, not the card's words:
- `judgeBodyCompile` answers `warning` for the shape
`regexp-dialect-gap` alone; `regexp-pattern` and every other shape is
`error`.
- The warning arm is the two V8 reasons `Duplicate capture group name`
and `Invalid group` (`REGEXP_DIALECT_GAP_REASONS`), plus a property-name
refusal where every refused name is on
`REGEXP_PROPERTY_NAMES_ONLY_QUICKJS_KNOWS`.
- `hostUnicodeAtLeastMeasured()` false (host Unicode tables older than
17.0, or none named) makes every property-name refusal a warning.
- The hook and job rules read the same `judgeBodyCompile`, so "that
error" is `hook-body-does-not-compile` (the three commands and a runtime
save, `422 INVALID_METADATA`) and `job-body-does-not-compile` (the three
commands), as the bullet already said.
The file had 1 token of headroom, so the new sentence is paid for inside
the same bullet. Dropped: "naming the hook, the `SyntaxError` and its
line", the spelled-out rename example (`const data = ctx.input || {};`),
and a few connecting words. Nothing outside the bullet moved, and no
ceiling moved.
Size readings (`node scripts/check-skills-token-ratchet.mjs`, tokens are
`ceil(bytes / 4)`):
| | before | after |
|:--|:--|:--|
| `data-hooks.md` lines | 885 | 885 |
| `data-hooks.md` bytes | 40484 | 40488 |
| `data-hooks.md` tokens (ceiling 10122) | 10121 | 10122 |
| authored bundle tokens (ceiling 202623) | 197655 | 197656 |
| whole shipped tree tokens | 294165 | 294166 |
| all `SKILL.md` lines | 4941 | 4941 |
A changeset is included (`@objectstack/skills`, patch), as every earlier
edit of this file carries one.
## Tests
Prose only: no tested behaviour changed, so no test and no ablation.
Head `15b10bbc584`.
## Acceptance notes
- The bullet teaches the hook and job rules only, as before. The action
rule takes the same split; its paragraph in this file points here and
was not touched.
- The twelve measured property-name spellings are not listed in the
skill: the token ceiling has no room, and the lint finding names the
pattern. They are in `content/docs/automation/hook-bodies.mdx`.
## Verification
Read first: the one hunk in `data-hooks.md`, against `judgeBodyCompile`
and `isRegexpDialectGap` in
`packages/lint/src/validate-action-body-compiles.ts`.
Two-minute check: `node scripts/check-skills-token-ratchet.mjs` exits 0
and prints `data-hooks.md is 10122 tokens (ceiling 10122; headroom 0)`.
Derived gates (`node scripts/pm/dispatch-gates.mjs --commands`,
reconciled with `--ran`): 48 derived, 44 run and exit 0, 4 NOT MEASURED
(`check:dts-closure`, `check:dual-build-cjs-loads`,
`check:lean-entry-closure`, `check:sourcemap-no-sources-content` exit 3,
PREREQUISITE NOT MET: they read a whole-workspace build this one-file
prose edit did not make; CI runs them).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 23d61fa commit 144d368
2 files changed
Lines changed: 17 additions & 9 deletions
| 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 | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
| |||
0 commit comments