Skip to content

Commit 908d56c

Browse files
docs(skills): teach five landed refusals and behaviours in the data, query and ui skills (#35757)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuEoKvgs2TW7hc47KRGVnwtY)_ Fixes #35496 Fixes #35714 Fixes #35480 Fixes #35456 Fixes #35692 Clause-②: no Metadata-protocol: none Skills-docs: updated here This pull supersedes #35743, #35746, #35750 and #35751: it carries their commits unchanged, merged onto current `main`, with one changeset in place of four. Those four pulls are closed. Merging closes all five cards. **Update at `370465fea` (2026-11-20, after two contract-review rounds).** Three commits follow the first folded head `0c80caa0b`: 1. `ee231bb06` empties `must_not_contain` of eval case 34 (record 7034102949, S1: the two forbidden tokens were in the case's own reference answer). 2. `5e1710787` merges `origin/main` `f44758b21`, no conflict. 3. `370465fea` corrects the body-table placement (record 7046910845, S2): #35824 landed on `main` after this pull was written and draws an unplaced body table after the open field sections, not above them. Three carriers changed: `record-page.md` step 2, the reference answer of `record-page.json` case 1 (the table sits after the lead's open field sections; `relatedLists` puts it first among the tables), and the changeset clause. Readings at `370465fea` against `f44758b21`: `record-page.md` 65 lines / 3944 bytes / 986 tokens under its unmoved row of 991; `filters.md` 2596/2596, `seeds.md` 1898/1898, `data-hooks.md` 10117/10122, `relationships.md` 4198/4203, all as below; ratcheted tokens / ceilings 197118 / 202279 to 197374 / 202541 (+256 / +262, the two raises); eval fixtures 74969 to 76080; bundle total 286640 to 288007. The token ratchet now prints `60 authored bundle file(s)` (main added one). `check:skill-examples` is measured at this head, exit 0 (`346 prose examples type-check`), and `node ui/scripts/check-skill-eval-tokens.mjs` exits 0; the gate block under Verification was taken at `0c80caa0b`. ## 维护者速读 - 用户能看到什么变化:照着已发布技能写应用的 AI 和开发者,现在会写对五件事:「本 ISO 周」周键占位符只能用在文本字段上;钩子和定时任务脚本编译不过会被拒收以及怎么改;初始化数据每条记录都要填识别键;运行时保存的初始化数据必须指向已存在的对象;主从子表默认就是记录页里的整宽表格。平台行为不变。 - 为什么做:属于「已发布技能文档跟上平台行为」这条线,这五条行为都已上线而技能还没写;四份改动共用同一张技能字数预算表,合成一份可避免互相排队返工。 - 出错会怎样:只改说明文字和评测样例,不动运行时;写错了 AI 会按错的说法写应用并在校验或保存时碰壁,撤回这一个合并即可恢复原文。 - 要你做什么:这是对外发布的技能文字(需人工合入的受管范围),并按既有裁决抬高了两个文件的字数上限(先删重复、余额按实测);请在席位核对之后审批一次。 ## What changes Text only: nine files under `skills/`, two ceiling rows in `scripts/check-skills-token-ratchet.mjs`, one changeset. No package source moves. Folded head `370465fea`; `origin/main` `f44758b21` is merged in (merge commit `5e1710787`, no conflict). The readings below marked `ca4ec2a2f` were taken at the first base, before that merge; the update block above gives the current ones. | Card | Source pull, head | Skill text | Eval | Ceiling row | |:--|:--|:--|:--|:--| | the period-key card (line 3) | #35743, `47fe01057` | `skills/objectstack-query/rules/filters.md`, "Date Macros" | `filters-pagination-search.json` id 10 | `filters.md` 2473 to 2596 | | the compile-refusal card (line 4) | #35746, `0c9f76eb3` | `skills/objectstack-data/references/data-hooks.md`, "Sandbox restrictions" | `hooks-security-seeds-datasources.json` id 33 | none | | the keyed-record card (line 5) | #35750, commit `b3b374b39` | `skills/objectstack-data/references/seeds.md`, "`externalId` selection" | same file, id 34 | `seeds.md` 1759 to 1812 | | the unknown-object card (line 6) | #35750, commit `20c06ad50` | `seeds.md`, the note under the field table | same file, id 35 | `seeds.md` 1812 to 1898 | | the body-table card (line 7) | #35751, `1ea279acf` | `skills/objectstack-data/rules/relationships.md`, `skills/objectstack-ui/rules/record-page.md` | `record-page.json` case 1, `evals/README.md` | none | Read first, by risk: 1. `skills/objectstack-query/rules/filters.md`, the **Period key** paragraph, and `skills/objectstack-data/references/seeds.md`, the two added paragraphs: every clause is a claim about the runtime, sourced below. 2. `scripts/check-skills-token-ratchet.mjs`, the two row comments (deletion lists and arithmetic). 3. `skills/objectstack-ui/evals/record-page.json` case 1: its must and must-not lists decide what a graded answer may contain. Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints `filters.md is 2596 tokens (ceiling 2596; headroom 0)`, `seeds.md is 1898 tokens (ceiling 1898; headroom 0)`, `data-hooks.md is 10117 tokens (ceiling 10122; headroom 5)` and `59 authored bundle file(s) within their ceilings`. **Where the sentences were sourced.** The four source pulls read `origin/main` at `598a34d04` (#35743, #35746) and `03bce5c22` (#35750, #35751). The 31 source files the tables below cite are byte-identical at `ca4ec2a2f` (`git diff --stat` from each of those two commits to `origin/main` over the 31 paths is empty), so every line number below held at this pull's first base. At `f44758b21`, now merged, 23 of the 31 are unchanged and line numbers in the other 8 have shifted (`filter-tokens.ts`, `filter-tokens.test.ts`, the comparand door test, `api-surface/data.json`, `field.zod.ts`, the ui core `index.ts`, `buildDefaultPageSchema.ts` and its body-tables test); only the last two changed a taught fact, the placement sentence, corrected in commit `370465fea`. ### 1. The `{current_iso_week}` period key (from #35743) `filters.md`, section "Date Macros (declarative filter metadata)": - A new **Period key** paragraph beside the date-macro bullets and the session tokens: `{current_iso_week}` is a member of `PERIOD_KEY_TOKENS`, not a date macro; it resolves to today's ISO week key `YYYY-Www` in the workspace time zone, Monday-start weeks, ISO week-year at year edges (2027-01-01 is `2026-W53`); it is text, for a text field storing week keys; a `date` / `datetime` / `time` field refuses it with `INVALID_FILTER` / 400 like the literal key, and the date-field spelling is `{current_week_start}` / `{current_week_end}`; a date dashboard filter's `defaultValue` and `calendar.initialDate` refuse it, a text dashboard filter may default to it; there is no last- or next-week key. - The session-token example carries the week key on a text field (`cost_week: '{current_iso_week}'`). - **Scope** names `resolveFilterPlaceholders()` as the client resolver, the one call over `resolveDateMacros()`, `resolvePeriodKeyTokens()` and `resolveContextTokens()`. - The spelling check is `isKnownFilterToken(tok)`, the one predicate that answers for all three vocabularies. The two predicates the file named before both answer `false` for `current_iso_week`. Eval 10: a text week-key field filtered with the token and a date field filtered with the week's boundaries, never with the token. | Sentence in the skill | Source on main | |:---|:---| | a list of its own, not a date macro | `packages/spec/src/data/date-macros.zod.ts:62-67` and `:179-181` (`PERIOD_KEY_TOKENS`), `:190-192` | | `YYYY-Www`, workspace time zone, Monday-start weeks, ISO week-year | `packages/spec/src/data/date-macros.zod.ts:69-74` and `:344-348`; server resolver `packages/core/src/utils/filter-tokens.ts:471-473` | | 2027-01-01 is `2026-W53` | `packages/core/src/utils/filter-tokens.test.ts:568` (parity table row), spec prose `date-macros.zod.ts:72` | | text, for a text field storing week keys | `date-macros.zod.ts:75-80`; positive control `packages/objectql/src/engine-temporal-comparand-door.test.ts:646-647` | | `date` / `datetime` / `time` refuse it, `INVALID_FILTER` / 400, like the literal key | `packages/objectql/src/engine-temporal-comparand-door.test.ts:621-641` (both wrappings, code and status asserted, the literal `2026-W47` in the same loop); over HTTP `packages/rest/src/data-temporal-write-real-day-iso.test.ts:385` | | use `{current_week_start}` / `{current_week_end}` on a date field | `date-macros.zod.ts:133` (the two tokens); the same door test's title and its positive control | | a date dashboard filter's `defaultValue` refuses it, a text one may default to it | `packages/spec/src/ui/dashboard.test.ts:506-518`; `packages/spec/src/ui/dashboard.zod.ts:1663-1676` | | `calendar.initialDate` refuses it | `packages/spec/src/ui/calendar-config-initial-date.test.ts:94` | | both spellings, in every vocabulary | `ui/packages/core/src/utils/date-macros.ts:255` (the same wrapper pattern); `filter-tokens.test.ts:603-604` | | client resolver `resolveFilterPlaceholders()` over the three | `ui/packages/core/src/utils/filter-tokens.ts:301-308`; exported at `ui/packages/core/src/index.ts:221-234` | | `isKnownFilterToken(tok)` | `packages/spec/src/data/context-tokens.zod.ts:333-335`; listed in `packages/spec/api-surface/data.json:1057` | | no last- or next-week key | `PERIOD_KEY_TOKENS` has one member (`date-macros.zod.ts:179-181`) | ### 2. A hook or job `js` body that does not compile (from #35746) `data-hooks.md`, section "Sandbox restrictions", gains one bullet after "Rejected by `objectstack build`": > - **Refused when it does not compile:** a `js` source is compiled, unrun, inside its `(async (ctx) => { … })` wrapper, where `ctx` is already declared. So `const ctx = ctx.input || {};` (or `let ctx`, one name declared twice, any syntax error) is `hook-body-does-not-compile`: an **error** from `os validate`, `os build`, `os lint` and a runtime hook save (`422 INVALID_METADATA`), naming the hook, the `SyntaxError` and its line. Fix: use `ctx` as it is, or rename the local (`const input = ctx.input || {};`). A job's `js` body runs in the same wrapper: `job-body-does-not-compile`, from the three commands. A regex pattern the checking engine refuses is a warning: the runtime may accept it. Eval case 33, at the end of the array: the refused `const ctx = …` body under `os validate`, graded on naming `hook-body-does-not-compile` and on `input.status`, a token both repairs carry and the refused source does not. One deliberate difference from the card's wording: the card says the "save door" refuses a hook or job body. Main refuses a job body at the three commands only, because no door publishes a job (`packages/spec/src/kernel/metadata-plugin.zod.ts:1040`, `allowRuntimeCreate: false`; `packages/lint/src/authoring-rules.ts:2986`, `runtimeTypes: ['hook']`). The skill says exactly that. No published skill teaches a job `js` body anywhere else, so the job sentence lives in this one bullet. | Sentence in the skill | Source on main | |:---|:---| | the two rule ids | `packages/lint/src/validate-hook-body-compiles.ts:51` and `:54` | | compiled, unrun, inside the `(async (ctx) => { … })` wrapper | `packages/lint/src/action-body-wrapper.ts:52-54`; compiled inside it at `validate-hook-body-compiles.ts:98` (hooks) and `:120` (jobs); the runtime runs the same expression at `packages/runtime/src/sandbox/quickjs-runner.ts:435` | | `js` bodies only | `validate-hook-body-compiles.ts:73-76` | | an error from `os validate`, `os build`, `os lint` and a runtime hook save | `packages/lint/src/authoring-rules.ts:2980-2987`; pinned by `packages/lint/src/validate-hook-body-compiles.test.ts:137-146` and `:148-160` | | `422 INVALID_METADATA` at the runtime door | `packages/metadata-protocol/src/runtime-authoring-gate.ts:1683-1684` | | a regex pattern the checking engine refuses is a warning, the runtime may accept it | `validate-hook-body-compiles.ts:32-34`, test `:94-95`; `packages/lint/src/validate-action-body-compiles.ts:204` and the message at `:217-219` | | naming the hook, the `SyntaxError` and its line | `validate-hook-body-compiles.ts:105-113`; `validate-action-body-compiles.ts:190` | <details><summary>Probe run by the source pull on 598a34d (the rule called on one hook and one job per body)</summary> ```text const ctx = ctx.input || {}; -> hook-body-does-not-compile error + job-body-does-not-compile error let ctx; -> both ids, error let x = 1; let x = 2; -> both ids, error (Identifier 'x' has already been declared, line 1) if (ctx.input.a { } -> both ids, error (Unexpected token, line 1) const r = /(?[a]x)|(?[a]y)/; -> both ids, warning (a duplicate named group; the angle brackets of the group name are written as square brackets here) const input = ctx.input || {}; -> no finding language: 'expression' body -> no finding ``` Not re-run at the folded head: the three files the probe exercises are among the 31 unchanged ones. </details> ### 3 and 4. Two seed refusals (from #35750) **Keyed records (commit `b3b374b39`).** "Every record carries a value for each `externalId` field (each field of a list; `name` when the seed names none). One left blank (no value, `null` or `''`; whitespace is a value) is refused at load in every mode: the result names the object, record index, field and fix, and the other records still load." The `externalId` row of the field table points at it. Eval id 34: an `upsert` seed keyed on `code` where two records have none. | Sentence in the skill | Source on main | |:---|:---| | in every mode (the keyed modes are `upsert`, `update`, `ignore`, every mode the skill teaches) | `packages/metadata-protocol/src/seed-loader.ts:1840` | | blank is no value, `null` or `''`; whitespace is a value | `seed-loader.ts:469-471` (`isBlankSeedKeyValue`, no trim) | | `name` when the seed names none | `seed-loader.ts:69` (`DEFAULT_EXTERNAL_ID_FIELD`); the refusal says so at `:493-494` | | each field of a list | `seed-loader.ts:2346` | | the result names the object, record index, field and fix | `seed-loader.ts:506-510` | | the other records still load | `seed-loader.ts:2347-2364` (`errors.push`, `continue`); pinned by `packages/metadata-protocol/src/seed-loader-empty-key-warn.test.ts:139` | **Unknown object (commit `20c06ad50`).** "A `seed` saved at runtime names its `object` itself. One that resolves to nothing is refused: `422 INVALID_METADATA` at `object`, "which is not defined". Correct the name to the object's full name (`crm_lead`, not `lead`) or create the object first: a draft of it is enough for a draft seed; a live seed needs it published." The `object` row now reads "hand-written only in a runtime save (below)" in place of "never write manually", the one sentence in the file that contradicted the note. Eval id 35: a draft seed saved with `object: 'lead'` when the object is `crm_lead`. | Sentence in the skill | Source on main | |:---|:---| | the save door asks it; publish promotion and restore leave it to the load | `packages/metadata-protocol/src/protocol-save-door-refusals.ts:1087-1091` | | `422 INVALID_METADATA`, one finding at path `object` | `protocol-save-door-refusals.ts:1180-1192` | | "which is not defined", the full name, a draft is enough for a draft seed, publish for a live one | `protocol-save-door-refusals.ts:1174-1184`; pinned by `packages/metadata-protocol/src/protocol.seed-external-id-refusal.test.ts:381-421` | Doors not taught: `os validate` and `os build` judge seed record values, not a blank key and not a seed's object; the skill names only the load (first rule) and the runtime save (second rule). Ids 34 and 35 sit directly after the existing seed cases (ids 4, 30, 31), as #35750 placed them. ### 5. A `master_detail` child is a body table by default (from #35751) - `relationships.md`, "Detail-page related lists": the lead sentence states both defaults and that `inlineEdit` plays no part. The example no longer writes `inlineEdit: true` and `relatedList: 'primary'` on a `master_detail` field. The list reads `'primary'` (default for a `master_detail` FK), `false`, `true` (default for a `lookup` FK). - `record-page.md`, step 2: the same defaults; the table is drawn after the open field sections (it said "after the first field section"); "put the tasks first" is the parent's `relatedLists`; the example field drops `relatedList: 'primary'`. - `evals/record-page.json`, case 1: the prompt is unchanged. The expected answer adds no placement flag. `must_contain` is `relatedListFilter` and `relatedLists`; `must_not_contain` gains `inlineEdit:` (the authored key, so prose that only names it still passes). `evals/README.md` follows. | Skill sentence (after) | Source on main | |:---|:---| | A `master_detail` child with no `relatedList` is a body table | `packages/spec/src/data/related-list-body-table.ts:62-67`; verdict table rows `related-list-body-table.test.ts:36-40`; `packages/spec/src/data/field.zod.ts:2129-2134` | | A `lookup` child with no `relatedList` is a panel | `related-list-body-table.test.ts:31,35`; `field.zod.ts:2134` | | `'primary'` is the body table on either type | `related-list-body-table.ts:64`; `related-list-body-table.test.ts:34,41` | | `true` is a panel, also on a `master_detail` | `related-list-body-table.ts:65`; `related-list-body-table.test.ts:42,44` | | `false` hides the list | `related-list-body-table.test.ts:43,45`; `field.zod.ts:2113` | | `inlineEdit` governs entry in the parent's form only | `field.zod.ts:2085`; `related-list-body-table.ts:16-18`; test rows 37-40 and 44-45 | | Body tables are drawn after the field sections the record page draws open; closed trailing sections follow the tables | `ui/packages/plugin-detail/src/synth/buildDefaultPageSchema.ts:844-859` and `:904-906`; `ui/packages/plugin-detail/src/synth/__tests__/buildDefaultPageSchema.bodyTables-27055.test.ts:57-68`, `:87-90`, `:205-209` (main `f44758b21`) | | The parent's `relatedLists` orders the tables | `ui/packages/app-shell/src/utils/deriveRelatedLists.ts:428`; `field.zod.ts:2120-2123` | ## Token budget Standing ruling for `skills/**`, quoted verbatim: 「A:先削重复,余额按实测提高」 (maintainer, 2026-10-27; ruling record 6513306068). Counting is the gate's, `ceil(utf8 bytes / 4)`. Before-readings at `origin/main` `ca4ec2a2f`, after-readings at the folded head `ee231bb06`. Both moved rows sit at the values the source pulls pinned; nothing on `main` moved either file in between. **`filters.md`, deleted first, all in the same section:** 1. The wrapper regex in the "Both spellings parse" bullet, which restated in pattern form the sentence it sat in. 2. The code comment `// List-view / dashboard filter values`, which repeated the sentence above its block. 3. The second date-macro comparison in the session-token example (`close_date` with `{current_year_start}`); the week key takes its place. 4. The two per-vocabulary predicates, replaced by the one predicate. 5. The driver sentence's list of value kinds ("ISO strings and concrete ids"), now "resolved values". **`seeds.md`, deleted first, in the same file:** 1. The `columns` row's shape literal (`{ FIELD: { applyOn: 'create' } }`), which its own section and code block show. 2. The one-row best-practices table, now one sentence with the same content. 3. The second telling of what a refused seed value leaves behind, which the validation paragraph above it already says ("a refused row never lands"). Arithmetic in bytes: `filters.md` 9876 to 10382, +506, 127 tokens, the row's 4 tokens of headroom absorbed, ceiling +123. `seeds.md` 7033 to 6905 after the cuts (-128); the first rule nets +340 (7245, ceiling 1812); the second +345 (7590, ceiling 1898); the cuts pay for 128 bytes of 813 and the remainder is the measured raise. **`data-hooks.md`, paid in full, no row move:** the new bullet is +713 bytes; six restatements removed, 713 bytes, each with its other home in the file. | Removed | Its other home in `data-hooks.md` | |:--|:--| | The `body` implementation stub under "Key Properties Explained" | the schema listing's `body` comment, "The `body` shape", "Error Handling" | | "(This is unlike `ctx.input` / `ctx.result` inside the body, which stay partial, see Gotcha 1.)" | the `ctx.input` and `ctx.result` rows of the sandbox `ctx` table, and Gotcha 1 | | Listing comment "Matches the `organization_id` column + `current_user.organizationId` (RLS)" | "Reading the current organization" | | Pattern 4's five-line static-masking note, shortened to two lines | the "Why so few?" note | | Pattern 4's comment "Never a session claim (`ctx.session.roles` is gone, ctx table above)" | the `ctx.session` row of the sandbox table, and the `HookContext` listing comment on privilege | | Best Practices "use `before*` for validation and `after*` for side effects" | the "Purpose" row of "Before vs After Hooks" and the events table | | Reading | Before (`ca4ec2a2f`) | After (`ee231bb06`) | |:---|---:|---:| | `filters.md` lines / bytes / tokens | 208 / 9876 / 2469 | 215 / 10382 / 2596 | | `filters.md` ceiling row | 2473 (headroom 4) | 2596 (headroom 0) | | `seeds.md` lines / bytes / tokens | 182 / 7033 / 1759 | 190 / 7590 / 1898 | | `seeds.md` ceiling row | 1759 (headroom 0) | 1898 (headroom 0) | | `data-hooks.md` lines / bytes / tokens | 888 / 40467 / 10117 | 884 / 40467 / 10117 | | `data-hooks.md` ceiling row | 10122 (headroom 5) | 10122 (headroom 5), not moved | | `relationships.md` lines / bytes / tokens | 411 / 16811 / 4203 | 408 / 16790 / 4198 | | `relationships.md` ceiling row | 4203 (headroom 0) | 4203 (headroom 5), not moved | | `objectstack-ui/rules/record-page.md` lines / bytes / tokens | 65 / 3961 / 991 | 65 / 3939 / 985 | | `record-page.md` ceiling row | 991 (headroom 0) | 991 (headroom 6), not moved | | `hooks-security-seeds-datasources.json` lines / bytes (not ratcheted) | 331 / 31633 | 361 / 34938 | | `filters-pagination-search.json` lines / bytes (not ratcheted) | 95 / 7590 | 105 / 8638 | | `record-page.json` lines / bytes (not ratcheted) | 56 / 3237 | 57 / 3288 | | all `skills/*/SKILL.md`, lines summed | 4844 | 4844 (none touched) | | whole `skills/` tree, lines | 22518 | 22567 (+49) | | ratcheted (authored) tokens / ceilings | 195871 / 201053 | 196126 / 201315 (+255 / +262) | | eval fixtures, tokens (not ratcheted) | 70045 | 71144 (+1099) | | bundle total, tokens | 280469 | 281823 (+1354) | The sum of the two ceiling raises is 123 + 139 = 262, the whole movement of the ceiling total. The base readings differ from the ones the source pulls printed (`SKILL.md` lines 4861, ratcheted 196132, bundle 280730) because `main` shortened seven `SKILL.md` files and `skills/README.md` between their bases and `ca4ec2a2f`; none of the files this pull touches moved. ## Fold note The five cards share one defect shape (a landed behaviour the published skill did not teach) and one fix (one paragraph and one eval case, the ratchet paid by same-file deletion first). They sit in one package, `@objectstack/skills`, with the same landing and review tier (Tier H governed surface), and all five were triaged p2. Each card keeps its own eval case as its independent check: ids 10, 33, 34, 35 and `record-page.json` case 1. Left out on purpose: #35696 and #35647, both on `skills/objectstack-ui/rules/actions.md`, which wait for #35673. **Folded tree against the four sources.** The four heads were merged with `git merge --no-ff`, no rebase, their eight commits kept; all four merges were clean, no conflict was resolved by hand. - At the first folded head `0c80caa0b`, eight files were byte-identical to their one source head; six still are, and `record-page.md` and `record-page.json` now differ from #35751's head by the placement phrase (commit `370465fea`). The eight were (same blob id): `filters.md`, `filters-pagination-search.json`, `data-hooks.md`, `seeds.md`, `relationships.md`, `objectstack-ui/evals/README.md`, `record-page.json`, `objectstack-ui/rules/record-page.md`. - Two files have two sources each. `scripts/check-skills-token-ratchet.mjs`: the 35 changed lines against `origin/main` are exactly the union of the two source diffs (the `filters.md` row and the `seeds.md` row). `hooks-security-seeds-datasources.json`: the 30 added lines are the union of the two source diffs except one: case 34's `must_not_contain` is empty where #35750 wrote two tokens (contract-review should-fix S1 of record 7034102949, commit `ee231bb06`); it parses, holds 35 cases with unique ids, ids 34 and 35 after id 31 and id 33 last. - The one difference: the four changeset files are replaced by `.changeset/35496-skills-teach-five-landed-behaviours.md`. It carries the four bodies under one title, with four bold lead-ins added. One sentence was reworded: #35751 wrote "Both rules files are shorter than before. No ceiling moves.", which is no longer true of a tree where two other rows move; it now reads "Both of those rules files are shorter than before, and neither one's token ceiling moves." **Prior review inputs, cited and not relied on** (each was made on a source head, none on this one): contract-review records 7031292409 (#35743 at `47fe0105`) and 7031303652 (#35746 at `03b9383f`; its S1 and S2 were answered in `0c9f76eb`), and the seat ACCEPT records 7031096611 and 7031127238. ## Tests No package source changes, so no build closure, unit test or ablation is owed. Five eval cases, one per card (above). Local readings are gates, taken at `0c80caa0b`; the one later commit, `ee231bb06`, changes one eval JSON line, and at it the token ratchet with its self-test, the skill gates, the two changeset gates and the overlap check were re-run, all exit 0. The readings are under Verification. ## Acceptance notes Carried from the source pulls: - Period key: the `this_week` preset the card offers as a date-field alternative is left out; where a preset is a legal filter comparand is a separate rule not measured here. The server reads the request's reference time zone (`filter-tokens.ts:172`, UTC when the request carries none); the skill says "workspace time zone", the wording of the spec's own description table. Whole-value only is true on main and not written again: the section's "Unknown tokens" paragraph already says it for every token. - `filters.md`: the section's opening ("compute the date yourself" for ad-hoc queries) and its Scope paragraph ("use tokens in a hand-issued engine query too") pull in different directions. Older text, not changed. - Compile refusal: the neighbouring bullet's older "Rejected by `objectstack build`" wording is left as it is. - Seeds: the first rule is stated once, in "`externalId` selection", with a pointer from the `externalId` row; the composite-key sentence is covered by "each field of a list". - Body table: `relationships.md` lost one true clause to pay for the new text, "owned (`master_detail`) children first" (the derived order when the parent declares no `relatedLists`, `deriveRelatedLists.ts:424-428`); the Order bullet under it still teaches the authored order. An explicit `relatedList: 'primary'` on a `master_detail` field stays valid and the eval does not forbid it. - `record-page.md` step 1 still says the tab row is "Overview, Activity, one tab per panel", while `buildDefaultPageSchema.bodyTables-27055.test.ts:94-97` says no per-list tab is emitted any more. Read only, not measured in a running console, outside these cards. This pull touches `skills/**`, a governed surface: it stays a draft, with no reviewer request and no auto-merge from this side. ## Verification `node scripts/pm/dispatch-gates.mjs --commands` derived 67 families for this diff (the edit to one `scripts/*.mjs` file matches the script-population families); all 67 were run at `0c80caa0b`, plus `check:skill-docs`, `check:skill-examples` and the overlap check outside the derivation. `--ran` reconciliation: `67 derived famil(ies) accounted for — 64 run, 3 NOT-MEASURED (3 DERIVED from a recorded exit 3)`. <details><summary>Local gate readings at 0c80caa (exit code first, captured before any pipe)</summary> ```text 0 node scripts/check-skills-token-ratchet.mjs ✓ 59 authored bundle file(s) within their ceilings; 11 generator-owned file(s) and 39 eval fixture(s) measured, not ratcheted. 0 node scripts/check-skills-token-ratchet.mjs --self-test ✓ self-test: 104 cases pass. 0 pnpm --filter @objectstack/spec run check:skill-refs ✅ 10 generated files in sync with packages/spec 0 pnpm --filter @objectstack/spec run check:skill-docs ✅ Skill docs in sync (outside the derivation) 0 pnpm --filter @objectstack/spec run check:skill-served-sections ✓ 24 served section(s), each heading exactly once in its file 0 pnpm check:skill-links ✓ 268 relative link(s) in 74 published skill file(s) resolve; 138 fragment(s) name a real heading 0 pnpm check:skill-identifier-liveness OK, Leg 1: 545 citation(s) over 74 published file(s) 0 pnpm check:skill-compatibility 0 pnpm check:skill-frame-sync 0 pnpm check:pm-skill-id-lint ✓ 130 file(s) clean 0 pnpm check:doc-authoring 0 pnpm check:nul-bytes OK (scanned 26278 text file(s)) 0 node scripts/check-empty-changeset.mjs --base origin/main ✓ No changeset from the merge base modified or deleted by this diff 0 node scripts/check-changeset-no-major.mjs --base origin/main 0 node scripts/check-adr-0087-registration.mjs --base origin/main 0 pnpm check:pm-dispatch-gates the battery (the fast tier) took 448.7s on this box 0 node scripts/pm/overlap-check.mjs --exclude-pr=35743,35746,35750,35751 VERDICT clean exit 0 (origin/main merges cleanly; the one other open pull sharing the ratchet script merges cleanly) 0 the other 49 derived families (script self-tests, changeset-gate self-tests, declaration mirrors, comment-mask corpus, closing-keyword parity, role-word, ratchet-remedy-authority, scripts-symbol-anchors, corpus-claim-drift, closed-ceremony-text, published-files, dts-closure, sourcemap-no-sources-content and the rest of the list) 3 pnpm --filter @objectstack/lint run check:doc-formula-expressions PREREQUISITE NOT MET: NOT MEASURED 3 pnpm check:dual-build-cjs-loads PREREQUISITE NOT MET: NOT MEASURED 3 pnpm check:lean-entry-closure PREREQUISITE NOT MET: NOT MEASURED 3 pnpm --filter @objectstack/spec run check:skill-examples PREREQUISITE NOT MET: NOT MEASURED (outside the derivation) ``` </details> NOT MEASURED: the four exit-3 families above, reason: each reads built output of packages this diff does not touch (only `@objectstack/spec` was built here). CI builds them. #35751 measured `check:skill-examples` green on its own head with the client packages built (`346 prose examples type-check`), and the one `os:check` block this diff edits, in `record-page.md`, is byte-identical to that head. The overlap check excludes the four superseded pulls by number: this branch contains their commits, so they overlap it by construction. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgTRf6qBRCqPh4JZaZL <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgTRf6qBRCqPh4JZaZL --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent c7174c3 commit 908d56c

11 files changed

Lines changed: 170 additions & 55 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the data, query and ui skills teach five landed refusals and behaviours
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Five pieces of published skill text, one per landed behaviour the skills did not teach. Each comes with its own eval case.
11+
12+
**The `{current_iso_week}` period key.** objectstack-query's `rules/filters.md`, section "Date Macros", now names the period key beside the date macros and the session tokens. `{current_iso_week}` (or `${current_iso_week}`) resolves to today's ISO week key, `YYYY-Www`, in the workspace time zone: Monday-start weeks, the ISO week-year at year edges. It is text, for a text field that stores week keys. A `date`, `datetime` or `time` field refuses it with `INVALID_FILTER` / 400, as it refuses the literal key; a date dashboard filter's `defaultValue` and `calendar.initialDate` refuse it too. On a date field write `{current_week_start}` / `{current_week_end}`. The section also names `resolveFilterPlaceholders()` as the client resolver for all three vocabularies and `isKnownFilterToken()` as the one spelling check. One eval case covers the text-field / date-field split.
13+
14+
**A hook or job `js` body that does not compile is refused.** objectstack-data's `references/data-hooks.md`, "Sandbox restrictions":
15+
16+
- A new bullet says a `js` source is compiled, without being run, inside the `(async (ctx) => { … })` wrapper the runtime runs it in, where `ctx` is already declared. `const ctx = ctx.input || {};` (or `let ctx`, one name declared twice, any syntax error) is `hook-body-does-not-compile`: an error from `os validate`, `os build`, `os lint` and a runtime hook save (`422 INVALID_METADATA`), naming the hook, the `SyntaxError` and its line. The fix is to use `ctx` as it is or rename the local (`const input = ctx.input || {};`). A job's `js` body runs in the same wrapper and is `job-body-does-not-compile` from the three commands. A regular-expression pattern the checking engine refuses is a warning: the runtime may accept it.
17+
- Six restatements in the same file were removed to pay for the new text; the file is four lines shorter and no larger in tokens than before.
18+
19+
`evals/hooks-security-seeds-datasources.json` gains one case on the refusal and its fix.
20+
21+
**A seed record with a blank key field is refused at load, and a saved seed naming an unknown object is refused 422.** objectstack-data's `references/seeds.md`:
22+
23+
- "`externalId` selection" says every record carries a value for each `externalId` field (each field of a list, or `name` when the seed names none), and that a record leaving one blank (no value, `null` or `''`; whitespace is a value) is refused at load in every mode: the load result names the object, the record index, the field and the fix, and the other records still load. The `externalId` row of the field table points at it.
24+
- The note under the field table says a `seed` saved at runtime names its `object` itself, and that one resolving to nothing is refused with `422 INVALID_METADATA` at `object` ("which is not defined"). The fix is the object's full name (`crm_lead`, not `lead`) or creating the object first: a draft of it is enough for a draft seed, a live seed needs it published. The `object` row points at the note.
25+
- Three restatements in the same file were removed to pay for part of the new text: the `columns` row's shape literal, the one-row best-practices table (now a sentence) and the second telling of what a refused seed value leaves behind.
26+
27+
`evals/hooks-security-seeds-datasources.json` gains one case on each refusal.
28+
29+
**A `master_detail` child is a record-page body table by default.** The record page draws a `master_detail` child as a full-width body table whenever its FK declares no `relatedList`. The skills still tied that to `inlineEdit`. They now teach the rule the runtime applies.
30+
31+
- objectstack-data's `rules/relationships.md`, "Detail-page related lists": a `master_detail` child is a body table by default and a `lookup` child is a panel. `inlineEdit` governs entry in the parent's form only. The `relatedList` list reads `'primary'` (the `master_detail` default), `true` (the `lookup` default) and `false`. The example no longer writes `inlineEdit` and `relatedList: 'primary'` on a `master_detail` field to get the table.
32+
- objectstack-ui's `rules/record-page.md`, step 2: the same defaults, the body table is drawn after the open field sections (it used to say after the first one), and "put the tasks first" is the parent's `relatedLists`. The example field drops its `relatedList: 'primary'`.
33+
- objectstack-ui's `evals/record-page.json`, case 1: the expected answer adds no placement flag to a `master_detail` field, and an answer that authors `inlineEdit` fails the case. `evals/README.md` follows.
34+
35+
Both of those rules files are shorter than before, and neither one's token ceiling moves.

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,21 @@ export const CEILINGS = new Map([
13701370
// paragraph (home: SKILL.md, String Operators) and a second `$between` Date
13711371
// example (home: the operator table's `$between` row). Arithmetic in bytes:
13721372
// 9925 -> 9892 (-33 net) -> ceil(9892 / 4) = 2473; headroom 0 tokens.
1373-
['skills/objectstack-query/rules/filters.md', 2473],
1373+
// 2473 -> 2596 (#35496): the `{current_iso_week}` period key in § Date Macros
1374+
// (its `YYYY-Www` value, the text-field-only rule, the `INVALID_FILTER` / 400
1375+
// refusal on date / datetime / time fields, the two date-only surfaces that
1376+
// refuse it) and the client resolver that covers all three vocabularies.
1377+
// Raise path the standing ruling 「A:先削重复,余额按实测提高」 (ruling record
1378+
// 6513306068, letter B). PAID DOWN FIRST — five restatements cut in the same
1379+
// section: the wrapper regex beside the prose that already says both
1380+
// spellings parse, the code comment repeating the sentence above its block,
1381+
// the second date-macro comparison in the session-token example (the week key
1382+
// takes its place), the two per-vocabulary predicates (one predicate answers
1383+
// for all three) and the driver sentence's list of value kinds. Arithmetic in
1384+
// bytes: 9876 landed -> 10382, +506 -> 127 tokens, the row's 4 tokens of
1385+
// headroom absorbed, ceiling +123, pinned AT the measurement.
1386+
// ceil($(wc -c < skills/objectstack-query/rules/filters.md) / 4) == ceil(10382 / 4)
1387+
['skills/objectstack-query/rules/filters.md', 2596],
13741388
['skills/objectstack-query/rules/pagination.md', 1382],
13751389

13761390
// objectstack-ui `rules/` — the five files the #14296 item 1 split created.
@@ -1846,7 +1860,24 @@ export const CEILINGS = new Map([
18461860
// 6984 -> 6570 after the cuts (-414); the teaching nets +466 -> 7036 ->
18471861
// ceil(7036 / 4) = 1759; headroom was 0, so the ceiling moves +13, the
18481862
// measured remainder only. Pinned AT the measurement.
1849-
['skills/objectstack-data/references/seeds.md', 1759],
1863+
// 1759 -> 1812: `### externalId selection` says every record carries a value
1864+
// for each `externalId` field and that a blank one is refused at load, and the
1865+
// `externalId` row points at it. Raise path the standing ruling
1866+
// 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). PAID DOWN
1867+
// FIRST — restatement cut in the same file: the `columns` row's shape literal
1868+
// (its own section shows it), the one-row best-practices table (a sentence
1869+
// now) and the second telling of what a refused seed value leaves behind.
1870+
// Arithmetic in bytes: 7033 -> 6905 after the cuts (-128); the teaching nets
1871+
// +340 -> 7245 -> ceil(7245 / 4) = 1812; headroom was 0, so the ceiling moves
1872+
// +53, the measured remainder only. Pinned AT the measurement.
1873+
// 1812 -> 1898: the note under the field table says a `seed` saved at runtime
1874+
// names an object that exists or the save answers `422 INVALID_METADATA` at
1875+
// `object`, and that a draft object is enough for a draft seed; the `object`
1876+
// row points at it in place of "never write manually". Same raise path and
1877+
// the same paydown as the step above (one PR, the cuts are its deletion):
1878+
// 7245 -> 7590 bytes (+345) -> ceil(7590 / 4) = 1898; headroom was 0, so the
1879+
// ceiling moves +86, the measured remainder only. Pinned AT the measurement.
1880+
['skills/objectstack-data/references/seeds.md', 1898],
18501881
// 1351 -> 1343: the body-pin values left the count (#31115, ruling B; see
18511882
// BODY_PIN_REPIN); the file's count fell by the same 8, headroom unchanged.
18521883
['skills/objectstack-platform/references/bootstrap.md', 1343],

‎skills/objectstack-data/evals/hooks-security-seeds-datasources.json‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,26 @@
6161
"must_not_contain": []
6262
}
6363
},
64+
{
65+
"id": 34,
66+
"prompt": "Our `sales_team` seed is `upsert`, keyed on `externalId: 'code'`. Two of its ten records have no `code` yet; we want to load all ten now and fill those two codes in later. Write the seed.",
67+
"expected_output": "Redirects: the two records cannot load without a `code`. Every record carries a value for each `externalId` field, and a record that leaves one blank (no value, `null` or `''`) is refused at load: the load result names the object, the record index, the blank field and the fix, and the other eight records still load. So the answer gives those two records a real `code` now (`defineSeed(SalesTeam, { externalId: 'code', mode: 'upsert', records })` with ten codes), or keys the seed on a field every record carries. It does not write `code: ''` or `code: null`, does not pad the key with whitespace to pass, and does not switch the mode: `ignore`, `upsert` and `update` all refuse the record.",
68+
"files": [],
69+
"assertions": {
70+
"must_contain": ["defineSeed", "externalId", "refused"],
71+
"must_not_contain": []
72+
}
73+
},
74+
{
75+
"id": 35,
76+
"prompt": "In the running app I saved a draft `seed` item with `object: 'lead'` and three records, through the metadata save. The save answered 422. Our lead object is `crm_lead`, still a draft in the same package. What is wrong, and what do I save instead?",
77+
"expected_output": "The seed names an object that does not exist: the save door refuses a `seed` whose `object` resolves to nothing with `422 INVALID_METADATA`, one finding at `object` saying the seed loads its records into object 'lead', which is not defined, so publishing it would load no record. The fix is the object's full name: save the seed with `object: 'crm_lead'`. The draft `crm_lead` is enough for a draft seed, so nothing has to be published first; a live (published) seed needs the object published. Does not create a second `lead` object to satisfy the save and does not retry the same body.",
78+
"files": [],
79+
"assertions": {
80+
"must_contain": ["422", "crm_lead", "not defined"],
81+
"must_not_contain": []
82+
}
83+
},
6484
{
6585
"id": 5,
6686
"prompt": "Finance may edit a contract's legal terms (`governing_law`, `liability_cap`) while it is a draft, not once approved, signing or active; legal still edits them.",
@@ -326,6 +346,16 @@
326346
"amount_paid: 2000"
327347
]
328348
}
349+
},
350+
{
351+
"id": 33,
352+
"prompt": "`os validate` reports an error on this `beforeInsert` hook on `lead`, and I cannot see why: `body: { language: 'js', source: \"const ctx = ctx.input || {}; if (!ctx.status) ctx.status = 'new';\", capabilities: [] }`. What is wrong, and what should the source be?",
353+
"expected_output": "The `js` source is compiled inside the wrapper the runtime runs it in, `(async (ctx) => { … })`, where `ctx` is already the parameter: `const ctx = …` declares it a second time, a SyntaxError before any statement runs. The finding is `hook-body-does-not-compile`, an error from `os validate`, `os build` and `os lint`, and a runtime save of the hook is refused with `422 INVALID_METADATA`. Fix: use `ctx` as it is (`if (!ctx.input.status) ctx.input.status = 'new';`) or give the local another name (`const input = ctx.input || {}; if (!input.status) input.status = 'new';`). Does not suppress the rule, and does not move the logic to a deprecated `handler`.",
354+
"files": [],
355+
"assertions": {
356+
"must_contain": ["hook-body-does-not-compile", "input.status"],
357+
"must_not_contain": []
358+
}
329359
}
330360
]
331361
}

‎skills/objectstack-data/references/data-hooks.md‎

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@ const myHook = defineHook({
123123

124124
### Key Properties Explained
125125

126-
#### `body` — Implementation
127-
128-
A `source` of statements against `ctx`; a throw aborts the write
129-
([Sandboxed Hook Bodies](#sandboxed-hook-bodies-body--what-the-sandbox-ctx-can-call)).
130-
131126
#### `condition` — Declarative Filtering
132127

133128
Skip the hook if the condition is false. Author it as a **CEL
@@ -155,9 +150,7 @@ made total over the object's **declared** fields (`null` when a declared field i
155150
in neither). So:
156151

157152
- Reference **any** declared field, not just the ones this update touches —
158-
`record.done == true` works on an update that only sets `status`. (This is
159-
unlike `ctx.input` / `ctx.result` inside the body, which stay partial — see
160-
Gotcha 1.)
153+
`record.done == true` works on an update that only sets `status`.
161154
- `record` describes the record's **state**, not the diff. `record.done == true`
162155
fires on every update of an already-done record, not only on the update that
163156
set it. **For the transition, compare against `previous`**:
@@ -344,6 +337,15 @@ The body runs in an isolated QuickJS VM, **not** Node:
344337
a name bound at module scope, e.g. a `const slugify = …` helper sitting next to
345338
the hook. A `body` must be **self-contained**: inline the helper, or keep that
346339
hook as a bundled (deprecated) `handler`.
340+
- **Refused when it does not compile:** a `js` source is compiled, unrun, inside
341+
its `(async (ctx) => { … })` wrapper, where `ctx` is already declared. So
342+
`const ctx = ctx.input || {};` (or `let ctx`, one name declared twice, any
343+
syntax error) is `hook-body-does-not-compile`: an **error** from `os validate`,
344+
`os build`, `os lint` and a runtime hook save (`422 INVALID_METADATA`), naming
345+
the hook, the `SyntaxError` and its line. Fix: use `ctx` as it is, or rename
346+
the local (`const input = ctx.input || {};`). A job's `js` body runs in the
347+
same wrapper: `job-body-does-not-compile`, from the three commands. A regex
348+
pattern the checking engine refuses is a warning: the runtime may accept it.
347349

348350
> **A deadline stamped from an hours table is calendar hours** — nights, weekends and
349351
> holidays count. Name it `*_CALENDAR_HOURS` (`SLA_CALENDAR_HOURS`, or its camelCase)
@@ -450,8 +452,7 @@ interface HookContext {
450452
// Execution context
451453
session?: {
452454
userId?: string;
453-
organizationId?: string; // Active org — the single blessed name. Matches the
454-
// `organization_id` column + `current_user.organizationId` (RLS).
455+
organizationId?: string; // Active org — the single blessed name.
455456
// The former `tenantId` alias was removed in v16.
456457
// Privilege is judged by the security service,
457458
// never by a session claim.
@@ -660,11 +661,8 @@ const cascadeAccountUpdate = defineHook({
660661

661662
A `body` cannot do this: it writes back only `ctx.input`, and its `ctx.result` is a snapshot.
662663

663-
> For **static** field masking (a field is always hidden/masked for a permission
664-
> set or position), prefer declarative **field-level metadata** (secret/masked
665-
> fields) — it applies on every read path automatically. Use an `afterFind` hook
666-
> only for masking that depends on runtime logic the field metadata can't
667-
> express.
664+
> Static masking is declarative **field-level metadata** (secret/masked fields);
665+
> an `afterFind` hook is only for masking that depends on runtime logic.
668666
669667
```typescript
670668
const maskSensitiveData = defineHook({
@@ -674,7 +672,6 @@ const maskSensitiveData = defineHook({
674672
handler: async (ctx) => {
675673
// Exempt the engine's own elevated reads (`isSystem`) — internal writes
676674
// and self-reads must see the real values.
677-
// ⚠️ Never a session claim (`ctx.session.roles` is gone, ctx table above).
678675
const isElevated = ctx.session?.isSystem === true;
679676

680677
if (!isElevated) {
@@ -777,9 +774,8 @@ the layout both real hook modules in the repo use.
777774

778775
## Best Practices
779776

780-
✅ **DO** — use `before*` for validation and `after*` for side effects; set
781-
`async: true` for non-critical background work; go through `ctx.api` for
782-
cross-object operations; refuse a business rule by a
777+
✅ **DO** — set `async: true` for non-critical background work; go through
778+
`ctx.api` for cross-object operations; refuse a business rule by a
783779
[declared code](#declared-refusals-refusals); test hooks in isolation.
784780

785781
❌ **DON'T** — do expensive work in `before*` (it blocks the transaction); write

‎skills/objectstack-data/references/seeds.md‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ export const SeedData = [statusSeed, categorySeed];
4444

4545
| Field | Default | Purpose |
4646
|:------|:--------|:--------|
47-
| `object` | derived | Auto-set from `objectDef.name` — never write manually |
48-
| `externalId` | `'name'` | Stable business key (or field list) every mode matches on |
47+
| `object` | derived | Auto-set from `objectDef.name`; hand-written only in a runtime save (below) |
48+
| `externalId` | `'name'` | Stable business key (or field list) every mode matches on; required in every record (below) |
4949
| `mode` | `'ignore'` | Import strategy (see below) |
50-
| `columns` | — | Per-column write policy, keyed by field: `{ FIELD: { applyOn: 'create' } }` (below) |
50+
| `columns` | — | Per-column write policy, keyed by field (below) |
5151
| `env` | `['prod','dev','test']` | Environments where the seed loads |
5252
| `locale` | — (every locale) | BCP-47 tags it loads for; a locale no set of the object names gets none |
5353
| `fallback` | — | `true` on ONE `locale` set per object: also loads for a locale no set names |
@@ -56,6 +56,12 @@ export const SeedData = [statusSeed, categorySeed];
5656

5757
Full Zod shape: `node_modules/@objectstack/spec/src/data/seed.zod.ts`.
5858

59+
A `seed` saved at runtime names its `object` itself. One that resolves to
60+
nothing is refused: `422 INVALID_METADATA` at `object`, "which is not defined".
61+
Correct the name to the object's full name (`crm_lead`, not `lead`) or create
62+
the object first: a draft of it is enough for a draft seed; a live seed needs
63+
it published.
64+
5965
### Import modes
6066

6167
| Mode | Behavior | Use for |
@@ -95,6 +101,11 @@ defineSeed(Invoice, {
95101
**Never use `id`** for generated UUIDs — they
96102
differ across environments.
97103

104+
Every record carries a value for each `externalId` field (each field of a
105+
list; `name` when the seed names none). One left blank (no value, `null` or
106+
`''`; whitespace is a value) is refused at load in every mode: the result names
107+
the object, record index, field and fix, and the other records still load.
108+
98109
| Scenario | Key |
99110
|:---------|:----|
100111
| Named entities (country, currency) | `'code'` / `'slug'` |
@@ -165,13 +176,10 @@ produce byte-identical `dist/objectstack.json`.
165176

166177
### Seed best practices
167178

168-
| Practice | Why |
169-
|:---------|:----|
170-
| TypeScript: `defineSeed()`, never `SeedSchema.parse()` | Lose compile-time field checks otherwise |
179+
In TypeScript use `defineSeed()`, never `SeedSchema.parse()`: it loses compile-time field checks.
171180

172181
**Fictional is fine; malformed is not.** A seed row passes the same field
173-
validation as a user's insert; a refused value leaves the table short or empty
174-
while sibling rows point at records that do not exist.
182+
validation as a user's insert; a refused value drops the row its siblings point at.
175183
`os validate` / `os build` refuse such a value first, at the
176184
record's field — run them before trusting the load. So never mask or
177185
placeholder a sample value: no `138****4207`,

0 commit comments

Comments
 (0)