Repository navigation
Commit 3d744f1
docs(skills): give the requiredWhen alias rule and the flow runAs rule one home each (#32326)
<!-- claude-projects-attribution: {"github_login":"huangyiirene"} -->
_Requested by **Irene** · [project
thread](https://claude.ai/code/project/chan_01TJXtQ1tVD26ecLDZxFS67x?thread=cmsg_01TJXtQ1tVD26ecLDZxFS67xA5AFaCmiVemTNyDjX44Zt6)_
Part of #31112
Slice 11 of the card: item 1, the first two of its five duplicated-rule
groups (`conditionalRequired` → `requiredWhen`, and `runAs` for flows
that write `readonly` fields).
## 维护者速读
**需要你做的:** 本 PR 为 **Tier H**(`skills/**`,`check-governed-merges.mjs
--test` 实测 GOVERNED、H(人合)),保持 draft;当前 head 还欠契约审查(contract review),由
skills 席位按 `CONTRACT_REVIEW_TIER` 做记录审查,通过后席位再请你批准。
改了什么:两条在多个技能里重复书写的规则,各留一个归属方,其他位置缩成一句带真实锚点的链接。
`conditionalRequired` 已移除这一条:归 `objectstack-data` § Conditional Field
Rules;`objectstack-formula`、`objectstack-ui` 的复述删掉,改为链接。
「维护 `readonly` 字段的 flow 用 `runAs: 'system'`、`runAs: 'user'`
写它构建期报错」这一条:归 `objectstack-automation` § Failure routing &
`runAs`;`objectstack-data` 的 readonly 条目删掉复述,改为链接,只保留 data 独有的事实(REST/UI
也被剥离、系统 hook/seed/import/migration 豁免、字段保持 `readonly`)。
不改任何规则的教学内容;三个 token 行都缩小(data 6654 → 6606,formula 5973 → 5971,ui 3814 →
3800),automation 未动;`check:skill-links` 验证了两个新锚点。
## Measurement on `main` `351c22c94`: rule statements vs mentions
Only a sentence that states the rule is a duplicate. Every other hit
uses the key inside another rule or an example and stays.
**`conditionalRequired` → `requiredWhen`** (`grep -c
conditionalRequired`: data 1, formula 1, ui 1)
| File:line | Kind | Verdict |
|:--|:--|:--|
| data L225–227 (§ Conditional Field Rules) | states the rule |
**owner**, unchanged |
| formula L277–278 (§ 3. Predicate) | states the rule | **duplicate,
cut** |
| ui L120–121 (§ Field Conditional Rules in Forms) | states the rule |
**duplicate, cut** |
| data L10, L202, L231, L265, L464; formula L5, L75, L97, L428; ui L115
| `requiredWhen` named in a description, an example, or another rule |
mention, stays |
**`runAs`** (`grep -c runAs`: automation 12, data 4)
| File:line | Kind | Verdict |
|:--|:--|:--|
| automation L143–197 (§ Failure routing & `runAs`), 12 lines | the
readonly-write rule, elevate-the-write, identity assignment, org
pinning, hook `runAs` | **owner**, unchanged |
| data L216 "`runAs:'user'` flow — the default" | names who is stripped
(data's `readonly` rule); "— the default" restates automation | clause
cut, rest stays |
| data L219 "`runAs:'system'` flows, system hooks, seeds, …" | names who
is exempt (data's `readonly` rule) | stays |
| data L220–224 | restates the flow-side rule and its build error |
**duplicate, cut** |
## Cut list (砍点逐条核幸存)
| # | Cut text (main `351c22c94`) | Surviving home |
|:--|:--|:--|
| 1 | formula L277–278: "Never emit `conditionalRequired` (use
`requiredWhen`) — it was REMOVED in protocol 17 and is a parse error." |
data SKILL.md L225–227, § Conditional Field Rules: "The
`conditionalRequired` alias was REMOVED in protocol 17 — emitting it is
a parse error." Replaced by a one-line link to that section. |
| 2 | ui L120–121: "Use `requiredWhen` — the `conditionalRequired` alias
was REMOVED in protocol 17 and is now a parse error." | Same data
section. The paragraph above already pointed there in plain text
("**objectstack-data → Conditional Field Rules**"); that pointer is now
a real link. |
| 3 | data L216: the clause "— the default" (a flow's `runAs` defaults
to `'user'`) | automation SKILL.md L158–159: "Under the default `runAs:
'user'` the engine **strips** it". |
| 4 | data L220–223: "So the pattern … is expressed by declaring the
field `readonly` **and** running the maintaining flow `runAs:'system'`
(see **objectstack-automation**), not by removing `readonly`." | Flow
side: automation L158–161 ("a flow maintaining one … runs `runAs:
'system'`"). The data-side half, keep the field `readonly`, stays in
data as the new sentence "Keep the field `readonly` when automation
maintains it". |
| 5 | data L223–224: "Writing a `readonly` field from a `runAs:'user'`
`update_record` node is a build-time **error** (`os validate` / `os
build`)." | automation L162–163: "`os validate` / `os build` fail a
`runAs:'user'` `update_record` writing one (`readonlyWhen`: a warning)".
|
The automation owner already states everything the data duplicate said
about flows, so no fact moved into an owner. Facts only data held stay
in data: REST/UI writes are stripped too; system hooks, seeds, imports
and migrations are exempt.
## Diffs
```diff
--- a/skills/objectstack-data/SKILL.md
+++ b/skills/objectstack-data/SKILL.md
- **`readonly: true` governs the end-user surface, not trusted system writers.**
- A non-system write (REST/UI, and any `runAs:'user'` flow — the default) has
+ A non-system write (REST/UI, and any `runAs:'user'` flow) has
the field **stripped**; the write reports
success but the value never lands. System-context writes —
`runAs:'system'` flows, system hooks, seeds, imports, migrations — are exempt
- and DO write it. So the pattern "users can't edit this, but automation
- maintains it" is expressed by declaring the field `readonly` **and** running
- the maintaining flow `runAs:'system'` (see **objectstack-automation**), not by
- removing `readonly`. Writing a `readonly` field from a `runAs:'user'`
- `update_record` node is a build-time **error** (`os validate` / `os build`).
+ and DO write it. Keep the field `readonly` when automation maintains it; the
+ flow side: [objectstack-automation → Failure routing & `runAs`](../objectstack-automation/SKILL.md#failure-routing--runas).
```
```diff
--- a/skills/objectstack-formula/SKILL.md
+++ b/skills/objectstack-formula/SKILL.md
-Never emit `conditionalRequired` (use `requiredWhen`) — it was REMOVED in
-protocol 17 and is a parse error.
+Conditional requiredness: [objectstack-data](../objectstack-data/SKILL.md#conditional-field-rules).
```
```diff
--- a/skills/objectstack-ui/SKILL.md
+++ b/skills/objectstack-ui/SKILL.md
ObjectUI forms consume them. Their semantics and server behaviour:
-**objectstack-data → Conditional Field Rules**.
+[objectstack-data → Conditional Field Rules](../objectstack-data/SKILL.md#conditional-field-rules).
UI-side: inline master-detail grids evaluate these rules **row-by-row** against
-each child row. Use `requiredWhen` — the `conditionalRequired` alias was REMOVED
-in protocol 17 and is now a parse error.
+each child row.
```
Plus `.changeset/31112-skills-requiredwhen-runas-one-home.md`
(`'@objectstack/skills': patch`).
## Token ratchet (`scripts/check-skills-token-ratchet.mjs`)
| File | main | this PR | ceiling |
|:--|--:|--:|--:|
| `skills/objectstack-data/SKILL.md` | 6654 | 6606 (−48) | 6665 |
| `skills/objectstack-formula/SKILL.md` | 5973 | 5971 (−2) | 5997 |
| `skills/objectstack-ui/SKILL.md` | 3814 | 3800 (−14) | 3814 |
| `skills/objectstack-automation/SKILL.md` | 6687 | 6687 (0, untouched)
| 6687 |
Every row shrinks or holds. The ceilings are shrink-only and are not
lowered here: that edit is in `scripts/`, outside this slice's file
surface.
## Evals and pins
An eval tests what a reader of the whole package can answer, and every
cut rule still lives in its owner, so no eval changes. Per hit:
- `objectstack-data/evals/objects-fields-relationships.json` case 4
("never the removed `conditionalRequired` alias", `must_not_contain:
"conditionalRequired:"`): the owner text is untouched, so it stays true.
- `objectstack-formula/evals/cel-predicates-formulas.json` case 5 and
`objectstack-ui/evals/views-apps-actions-pages.json` case 1
(`must_not_contain: "conditionalRequired:"`): guards against emitting
the key, not quotes of the cut sentence. The rule is one link away in
data. They stay true.
- `objectstack-automation/evals/flows-triggers-approvals.json` cases at
L7, L193, L320, L339 and `integrations-declared.json` L17 (`runAs:
'system'` / `'user'`): automation's text is untouched. They stay true.
- No data eval asserts the `readonly` strip or the `runAs` build error.
Pins: no `packages/*/src/**/*.test.ts` or `scripts/**` gate quotes any
changed line. Grepped for each cut phrase; the only hits are code
comments (`packages/lint/src/validate-readonly-flow-writes.ts` L37,
`packages/spec/src/kernel/metadata-plugin.test.ts` L317) that do not
read the skill. `check-skill-identifier-liveness` registers no section
touched here.
## Contract review
`dispatch-gates --tier` mandates `CONTRACT_REVIEW_TIER` for `skills/**`
(clause ①). The maintainer's standing order for card threads
(2026-11-03) waives that tier for the build; the skills seat runs the
contract review of record at `CONTRACT_REVIEW_TIER`.
## Gates
Head `1a45d0f7` (the commit `7050a425` plus one merge of `origin/main`
`121640b9`, which touches no `skills/` path). `node
scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derives **46** commands; all 46 exit 0, and
so does `pnpm check:changeset-fixed` (its roster sits under
`.changeset/`, which dispatch-gates flags). Run after `pnpm install
--frozen-lockfile --ignore-scripts` and a full `pnpm build` at this
head, under `NODE_OPTIONS=--max-old-space-size=8192`. Record:
`/mnt/project-files/card-31112/s11-gates-1a45d0f7.txt` (`<cmd> :: exit
N` per line). Not measured locally, as dispatch-gates states: the
CI-only jobs and type-check lanes it lists as NOT MEASURED (no
TypeScript is touched here).
Clause-②: no
Metadata-protocol: none
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01J8VVAmL6NoXgETdPLMU3VH
Co-authored-by: Claude <noreply@anthropic.com>1 parent da13003 commit 3d744f1
4 files changed
Lines changed: 16 additions & 11 deletions
File tree
- .changeset
- skills
- objectstack-data
- objectstack-formula
- objectstack-ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 220 | + | |
| 221 | + | |
225 | 222 | | |
226 | 223 | | |
227 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
278 | | - | |
| 277 | + | |
279 | 278 | | |
280 | 279 | | |
281 | 280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | | - | |
| 120 | + | |
122 | 121 | | |
123 | 122 | | |
124 | 123 | | |
| |||
0 commit comments