Repository navigation
Commit 1f1a369
docs(skills): the objectstack-data field-types rule teaches percentDisplay and lookupAutofill, and the fields page teaches lookupAutofill (#28487)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao1GXHCbqC69qQauk9Qizcus)_
Fixes #28256
Fixes #28246
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:objectstack-data 技能的字段类型表 `percent` 行新增 `percentDisplay`(不填或
`'bar'` 画进度条,`'plain'` 只显示数字,用于比率和概率);`lookup` / `master_detail` 行列出
`lookupAutofill`,表下新增一段教它(选中一条记录后,把它的指定字段带入本记录,默认不覆盖用户已填的值);文档站
`fields.mdx` 的关系字段小节同步教 `lookupAutofill`。
- 为什么改:两个键的规范与控制台都已落地(#28255 的渲染、#28245 的表单填值),但技能和文档都没教,AI
作者写概率字段仍会得到一条进度条,写报价行也不知道选产品可以带出标价。
- 风险与回滚:纯文档改动,不动代码;技能文件的 token 上限余量为零,新增内容以删除三段重复示例支付(`Select with
Default`、`Email with Uniqueness`、`Lookup (Many-to-Many)`),并把
`vectorConfig` 提示并入文件顶部「不要臆造键」列表,被删的规则在技能别处仍各有一处;回滚即 revert 本 PR。
- 先看:`skills/objectstack-data/rules/field-types.md`(Relational 表下的
`lookupAutofill` 段、`percent`
行、三处删除),`content/docs/data-modeling/fields.mdx`(新小节 Lookup-pick
autofill),`.changeset/28256-data-skill-percent-display-lookup-autofill.md`。
- 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期退出
0,`field-types.md` 读数 3206/3207。
- 需要你做的:受管面(`skills/**`,Tier H)——席位完成契约复审后,由授权账号 Approve,再由席位落地。
## What changes
Two p3 skill-teaching cards folded into one `skills/objectstack-data`
PR, one commit per card.
**#28256 — the `percent` row teaches `percentDisplay`**
(`skills/objectstack-data/rules/field-types.md`, Numbers table). The
row's Config column now lists `percentDisplay` — the read-only face:
unset or `'bar'` draws a progress bar, `'plain'` the number alone, for a
rate or a probability. Read against
`packages/spec/src/data/field.zod.ts:1597` (`z.enum(['bar',
'plain']).optional()`, the describe) and the renderer
`ui/packages/fields/src/index.tsx:978-988` (`PercentCellRenderer`: only
the literal `plain` drops the bar; every read-only host draws this one
renderer, the relay sites
`ui/packages/plugin-grid/src/objectGridGenerateColumns.tsx:358,622,815`
and `ui/packages/plugin-detail/src/fieldEnrichment.ts:230` copy the
key).
**#28246 — the Relational section teaches `lookupAutofill`.** The
`lookup` and `master_detail` rows list the key, and one paragraph under
the table teaches it: the pair shape `[{ target, source, overwrite? }]`,
single-value `lookup` / `master_detail` only (`field.zod.ts:2647-2667`,
the superRefine); a pick copies the picked record's `source` into this
object's `target`, in the form and the line-item grid
(`ui/packages/fields/src/widgets/LookupField.tsx:1061-1085`
`fillDeclaredTargets`,
`ui/packages/components/src/renderers/form/form.tsx:3984-3991`
`onAutofill`, `ui/packages/fields/src/widgets/GridField.tsx:283-300`
`lookupAutofillPatch`); the example `[{ target: 'unit_price', source:
'list_price' }]` is the describe's own (`field.zod.ts:2105`); `target`
is a field of this object an author writes — not the lookup, `readonly`
or computed — named once
(`packages/spec/src/data/object.zod.ts:2255-2300`
`refuseDishonestLookupAutofill`); `source` is a declared, non-`internal`
field of `reference` the target can hold
(`packages/spec/src/stack.zod.ts:4156-4225`
`collectLookupAutofillErrors`, the type rule
`lookupAutofillTypeMismatch` at 4124); the overwrite rule — a pick fills
an empty target or an earlier pick's fill, `overwrite: true` always
replaces (`ui/packages/fields/src/widgets/lookupAutofill.ts`
`declaredLookupAutofillPatch`, the describe at `field.zod.ts:2106`);
client-side only (`field.zod.ts:2107`); in a grid a declared target
leaves the column's same-named `autofill` copy
(`GridField.tsx:290-294`).
**`content/docs/data-modeling/fields.mdx`** (the lookup section only,
triage's one-PR exception, comment 6531273599): the relationship
property table gains a `lookupAutofill` row, the code block gains a
product-lookup example, and a new `#### Lookup-pick autofill` subsection
before *Referential integrity* carries the same rules in full — the
target rule, the source rule with the type table (same type and
multiplicity; a string-valued source into a text target; `number` and
`currency` into each other; a relationship only into a relationship over
the same object — `stack.zod.ts:4124-4150`), the overwrite rule,
client-side only, the grid `autofill` relation, and the bound that a
master-detail collection whose relationship and every column are
authored loads no child fields and so sees no pairs
(`ui/packages/plugin-form/src/MasterDetailForm.tsx:429-435`; named in PR
#28322's acceptance notes as the text this card should state). It links
the generated [Field reference](/docs/references/data/field), which
already carries both keys.
**Changeset**
`.changeset/28256-data-skill-percent-display-lookup-autofill.md`:
`@objectstack/skills` patch, both declaration lines.
### Token ceiling — paid by deletion, never by re-wrap
`field-types.md` sat at exactly its `check-skills-token-ratchet` ceiling
(3207 = ceil(bytes / 4), zero headroom), so every added byte is paid
inside the file. Deleted, each with the home that still carries the
rule:
- `### Select with Default` (251 bytes) — restated the Selection
section's own option example in this file (label, value, color,
`default: true`).
- `### Email with Uniqueness` (329 bytes) — the unique scope and the
field-level `unique: true` reading live in `rules/indexing.md` § *Unique
scope — always state it (ADR-0120)*.
- `### Lookup (Many-to-Many)` (117 bytes) — the multi-value lookup lives
in `SKILL.md` (the Many-to-Many row and the `multiple: true`
blockquote); its `max: 10` read as a selection cap, while
`FieldSchema.max` is the numeric bound (`field.zod.ts:1532`).
- The vector paragraph (132 bytes) — its one rule, that `vectorConfig`
is refused at parse, folds into the invented-key list in the blockquote
at the top of the file (`theme`, `rows`, `vectorConfig`,
`fileAttachmentConfig`); the table row and the example already say
`dimensions` is the flat key.
No line was re-wrapped to buy room.
**Readings** (bytes · ceil(bytes/4) tokens · lines), base `768ec4bf` →
head `0984e3e9`:
| Surface | Before | After |
|:---|:---|:---|
| `skills/objectstack-data/rules/field-types.md` | 12826 B · 3207 tok ·
305 lines | 12824 B · 3206 tok · 273 lines (ceiling 3207) |
| `skills/objectstack-data` bundle, all 15 `.md` files | 163627 B ·
40907 tok | 163625 B · 40907 tok |
| all `skills/*/SKILL.md` | 226235 B | 226235 B (unchanged) |
## Tests
Documentation only — no test file changes. The gates below are the
verification; the skill's eval fixtures are unchanged (no eval case was
asked) and the eval gate was run.
## Acceptance notes
- **Taught only what is on `main`.** Every sentence is read against the
spec schema and the renderer cited above; nothing is taught that `main`
`768ec4bf` does not do.
- **The skill carries the short form, the docs page the full rules.**
The fully-authored master-detail bound and the source type table live in
`fields.mdx`, not in the skill paragraph, which the token ceiling holds
to 639 bytes.
- **`percent` row's "Percentage values (0-100)" is untouched.** The
row's When-to-Use text predates this card; the storage statement
(`percentScaleOf`: a fraction unless `max` is above 1) is not this
card's subject. Noted, not filed.
- **Not touched:** `skills/objectstack-data/evals/*` (no eval case
asked; #28435 owns `hooks-security-seeds-datasources.json`),
`skills/*/references/_index.md` (open PR #28467),
`skills/objectstack-ui` (its `autofill: false` line is correct as is).
- **Dedupe words** for the seat: percentDisplay skill, lookupAutofill
skill, field-types token ceiling.
## Verification
All readings at head `0984e3e9` (= `origin/main` `768ec4bf` + the two
commits).
- **Derived gates** — `node scripts/pm/dispatch-gates.mjs --commands
--repo objectstack-ai/objectstack` → 67 families (the docs gates
included); every line run with stdin closed, exit codes landed on disk
first, then `dispatch-gates.mjs --repo objectstack-ai/objectstack --ran
FILE` → `✓ dispatch-gates --ran: 67 derived famil(ies) accounted for —
66 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)`. 66 families
exit 0, among them `check-skills-token-ratchet` (+ `--self-test`),
`check:skill-identifier-liveness`, `check:corpus-claim-drift`,
`check:doc-authoring`, `check:docs-spec-enumerations`,
`check:doc-anchors`, `check:docs-single-h1`, `check:role-word`,
`check:pm-skill-id-lint`, `check:pm-governed-merges`, `@objectstack/spec
check:docs` / `check:liveness` / `check:skill-examples` (after `turbo
run build --filter='@objectstack/client-react...'` under the verify
lock), `check:closing-keyword-parity`, `check:empty-changeset`,
`check:changeset-no-major`.
- NOT MEASURED: `pnpm check:dual-build-cjs-loads`, exit 3 (PREREQUISITE
NOT MET — it needs every package's `dist`, a full `pnpm build`); the
diff touches no package entry. CI runs it.
- **Skill evals** — `pnpm --dir ui run check:skill-eval-tokens
--self-test` (29 cases) and `pnpm --dir ui run check:skill-eval-tokens`
→ exit 0, `Every must_contain token is taught by its own skill bundle`
(the `objectstack-data` evals still find every token they grade).
- **Tier** — `node scripts/pm/dispatch-gates.mjs --tier` on the two
surfaces: `claude-fable-5-1` MANDATORY (`skills/**`, no one-line exit);
this thread runs on that tier.
- **Changed lines** — 112 (+66 / −46, 3 files), under the 3000
human-merge threshold (read by `--ran`).
Dogfood: not run — the title carries no `!` and `Clause-②` carries no
`(narrowing)` arm.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(No schema touched.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes (CI-owned repo scan; no
`.ts` touched).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request. (Two cards, folded by the dispatch order; one branch, one PR.)
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (Not touched.)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibvc9vjAiGhyhnLTp34)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f763615 commit 1f1a369
3 files changed
Lines changed: 67 additions & 46 deletions
File tree
- .changeset
- content/docs/data-modeling
- skills/objectstack-data/rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
215 | 222 | | |
216 | 223 | | |
217 | 224 | | |
| |||
236 | 243 | | |
237 | 244 | | |
238 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
239 | 280 | | |
240 | 281 | | |
241 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
| 93 | + | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| |||
142 | 151 | | |
143 | 152 | | |
144 | 153 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | 154 | | |
159 | 155 | | |
160 | 156 | | |
| |||
182 | 178 | | |
183 | 179 | | |
184 | 180 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | 181 | | |
200 | 182 | | |
201 | 183 | | |
| |||
209 | 191 | | |
210 | 192 | | |
211 | 193 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | 194 | | |
224 | 195 | | |
225 | 196 | | |
| |||
281 | 252 | | |
282 | 253 | | |
283 | 254 | | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | 255 | | |
288 | 256 | | |
289 | 257 | | |
| |||
0 commit comments