Repository navigation
Commit 934ac07
docs(skills): objectstack-automation teaches that a clearable state lists '' among its targets (#36559)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8Uwe38nh7MLTBwLqZZeHCsq)_
Fixes #36161
Clause-②: no
Metadata-protocol: none
Ride-along: the `employee` lifecycle eval in
`skills/objectstack-data/evals/objects-fields-relationships.json` now
declares `initialStates` (declared by the seat; source: a finding in the
thread of card 36534, the same state-machine teaching theme).
## 维护者速读
- 用户能看到什么变化:用 AI
搭应用的人,照自动化技能写状态机时,会被告知「想让某个状态可以清空,就要在它的去向里写上空值」;此前技能没提,照着写出来的应用会拒绝用户清空状态字段。
- 为什么做:平台已经把「清空状态」当成一次状态流转来判定,技能文字落后于已上线的规则,这是补上那句教学。
- 出错会怎样:只改教学文字,不改任何运行行为;写错了最多是 AI 少写或多写一个空值去向,撤回这个改动即可恢复原文。
- 要你做什么:无。
## What changes
`skills/objectstack-automation/references/state-machines-and-approvals.md`,
state-machine notes, one new entry:
> **Clearing the field is a transition to `''`.** An update to `null` or
`''` is judged from the stored state: a clearable state lists `''` in
its targets, e.g. `paused: ['open', '']`; from any other listed state it
is refused (`invalid_transition`, `constraint.to: ''`).
Quoted from the merged code, not from the card. `checkStateMachine` in
`packages/objectql/src/validation/rule-validator.ts` (main d463c46)
reads the stored state, maps an empty target (`undefined`, `null` or the
empty string) to the key `''`, and answers
`fallback('invalid_transition', { from: fromKey, to: toKey }, …)` when
the stored state's list does not include it. Two points where the skill
text is narrower than the card's sentence, both on purpose:
- The card writes `to: ''`. In the code that pair is the refusal's
`constraint` (`{ from, to: '' }`), so the skill says `constraint.to:
''`.
- The card writes "a clear from any other state is refused". The code
returns no error when the stored state is not a key of `transitions`
(the existing "unlisted from state is not guarded" note), so the skill
says "any other listed state".
The new entry is paid for by shortening the section intro and six
neighbouring notes in the same file; each keeps its fact. The token
ceiling row is untouched.
Ride-along, second commit: in
`skills/objectstack-data/evals/objects-fields-relationships.json`, the
`employee` lifecycle case's expected answer declared a `state_machine`
with `transitions` only, which publish refuses for a machine that runs
on insert (`state-machine-no-initial-states`). It now declares
`initialStates: ['draft']` with the one-clause reason its sibling
`order` case uses, and `must_contain` requires `initialStates`. The
seeds eval in `hooks-security-seeds-datasources.json` that mentions
`state_machine` only says seed rows skip that rule; it teaches no
machine and is unchanged.
## Tests
No code path changes, so there is no test to add or ablate. The one
`os:check` block in the section is byte-identical.
## Acceptance notes
- Scope-out, the ui lane's: the card notes that the Studio validations
panel parses targets with a filter that drops empty strings, so it
cannot write `''` and loses an existing one on edit. Not touched here;
no file under `ui/` is in this diff.
- Commit trailer: the commit carries the model-free trailer pair
AGENTS.md prescribes. The dispatch order asked for a trailer naming a
model; AGENTS.md outranks it.
- Changeset: `skills/` ships as `@objectstack/skills`, so this takes a
`patch` changeset
(`.changeset/36161-automation-skill-clearable-state.md`), not
`skip-changeset`.
## Verification
Readings at head dd527b9 against main d463c46.
| Reading | Before | After |
|:--|--:|--:|
| The edited file, lines | 385 | 386 |
| The edited file, bytes | 23726 | 23734 |
| The edited file, tokens (ceiling 5936) | 5932 | 5934 |
| All `SKILL.md` files, lines | 4951 | 4951 |
| Ratcheted authored catalog, tokens | 197573 | 197575 |
| The eval file (measured, not ratcheted), tokens | 7984 | 8032 |
| Whole shipped bundle, tokens | 293321 | 293371 |
Net `skills/**` lines: +2 (25 added, 23 removed): +1 in the reference,
+1 in the eval file.
Read first: the "Notes" list of the state-machine section in the diff —
the new entry, then the six shortened notes beside it (check that none
lost a fact).
Two-minute check: `node scripts/check-skills-token-ratchet.mjs` exits 0
and prints `state-machines-and-approvals.md is 5934 tokens (ceiling
5936; headroom 2)`; `git grep -n "''" --
skills/objectstack-automation/references/state-machines-and-approvals.md`
shows the clearable-state entry.
<details><summary>Local gate subset (derived by dispatch-gates, 49
families)</summary>
44 exited 0 at dd527b9, among them `check-skills-token-ratchet` (scan
and self-test), `check:skill-refs`, `check:skill-served-sections`,
`check:skill-links`, `check:skill-identifier-liveness`,
`check:skill-compatibility`, `check:skill-frame-sync`,
`check:role-word`, `check:doc-authoring`, `check:nul-bytes`,
`check:published-files`, `check-empty-changeset`,
`check-changeset-no-major`, `check-adr-0087-registration`,
`check-closing-keyword-parity`.
NOT MEASURED locally, left to CI:
- `check:dts-closure`, `check:dual-build-cjs-loads`,
`check:lean-entry-closure`, `check:sourcemap-no-sources-content`,
`check:doc-formula-expressions` — each exited 3, prerequisite not met:
they read built `dist/` and this diff touches no package, so no build
closure was made.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbZeHNsF3RWcWpj7rGj)_
<!-- signed: repo:objectstack#1 · os-warren ·
session_01JQwxbZeHNsF3RWcWpj7rGj -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 92e660d commit 934ac07
3 files changed
Lines changed: 41 additions & 23 deletions
File tree
- .changeset
- skills
- objectstack-automation/references
- objectstack-data/evals
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
49 | 48 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
0 commit comments