From b3b374b39eae3e6564ce5953391e2ac8a8f90b69 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 04:58:41 +0000 Subject: [PATCH 1/2] docs(skills): a seed record with a blank key field is refused at load (seeds.md) `skills/objectstack-data/references/seeds.md` teaches the load refusal main makes for a keyed seed record that leaves an `externalId` field blank, with one eval case (id 34). Three restatements in the same file are cut first; the token ceiling row moves by the measured remainder (1759 -> 1812) under the standing ruling (record 6513306068). Claude-Session: https://claude.ai/code/session_01L6bhgTRf6qBRCqPh4JZaZL Co-authored-by: Claude --- .changeset/35480-seeds-load-and-save-refusals.md | 15 +++++++++++++++ scripts/check-skills-token-ratchet.mjs | 12 +++++++++++- .../evals/hooks-security-seeds-datasources.json | 10 ++++++++++ skills/objectstack-data/references/seeds.md | 16 +++++++++------- 4 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 .changeset/35480-seeds-load-and-save-refusals.md diff --git a/.changeset/35480-seeds-load-and-save-refusals.md b/.changeset/35480-seeds-load-and-save-refusals.md new file mode 100644 index 00000000000..cd984749d65 --- /dev/null +++ b/.changeset/35480-seeds-load-and-save-refusals.md @@ -0,0 +1,15 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): the data skill says a seed record with a blank key field is refused at load + +Clause-②: no +Metadata-protocol: none + +objectstack-data's `references/seeds.md`: + +- "`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. +- 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. + +`evals/hooks-security-seeds-datasources.json` gains one case on the refusal. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index e386fc9d6e0..518dc2de77a 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -1846,7 +1846,17 @@ export const CEILINGS = new Map([ // 6984 -> 6570 after the cuts (-414); the teaching nets +466 -> 7036 -> // ceil(7036 / 4) = 1759; headroom was 0, so the ceiling moves +13, the // measured remainder only. Pinned AT the measurement. - ['skills/objectstack-data/references/seeds.md', 1759], + // 1759 -> 1812: `### externalId selection` says every record carries a value + // for each `externalId` field and that a blank one is refused at load, and the + // `externalId` row points at it. Raise path the standing ruling + // 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). PAID DOWN + // FIRST — restatement cut in the same file: the `columns` row's shape literal + // (its own section shows it), the one-row best-practices table (a sentence + // now) and the second telling of what a refused seed value leaves behind. + // Arithmetic in bytes: 7033 -> 6905 after the cuts (-128); the teaching nets + // +340 -> 7245 -> ceil(7245 / 4) = 1812; headroom was 0, so the ceiling moves + // +53, the measured remainder only. Pinned AT the measurement. + ['skills/objectstack-data/references/seeds.md', 1812], // 1351 -> 1343: the body-pin values left the count (#31115, ruling B; see // BODY_PIN_REPIN); the file's count fell by the same 8, headroom unchanged. ['skills/objectstack-platform/references/bootstrap.md', 1343], diff --git a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json index c0242d92b87..3d1fda16ca9 100644 --- a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json +++ b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json @@ -61,6 +61,16 @@ "must_not_contain": [] } }, + { + "id": 34, + "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.", + "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.", + "files": [], + "assertions": { + "must_contain": ["defineSeed", "externalId", "refused"], + "must_not_contain": ["code: ''", "code: null"] + } + }, { "id": 5, "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.", diff --git a/skills/objectstack-data/references/seeds.md b/skills/objectstack-data/references/seeds.md index 3c9597261e0..3b089720490 100644 --- a/skills/objectstack-data/references/seeds.md +++ b/skills/objectstack-data/references/seeds.md @@ -45,9 +45,9 @@ export const SeedData = [statusSeed, categorySeed]; | Field | Default | Purpose | |:------|:--------|:--------| | `object` | derived | Auto-set from `objectDef.name` — never write manually | -| `externalId` | `'name'` | Stable business key (or field list) every mode matches on | +| `externalId` | `'name'` | Stable business key (or field list) every mode matches on; required in every record (below) | | `mode` | `'ignore'` | Import strategy (see below) | -| `columns` | — | Per-column write policy, keyed by field: `{ FIELD: { applyOn: 'create' } }` (below) | +| `columns` | — | Per-column write policy, keyed by field (below) | | `env` | `['prod','dev','test']` | Environments where the seed loads | | `locale` | — (every locale) | BCP-47 tags it loads for; a locale no set of the object names gets none | | `fallback` | — | `true` on ONE `locale` set per object: also loads for a locale no set names | @@ -95,6 +95,11 @@ defineSeed(Invoice, { **Never use `id`** for generated UUIDs — they differ across environments. +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. + | Scenario | Key | |:---------|:----| | Named entities (country, currency) | `'code'` / `'slug'` | @@ -165,13 +170,10 @@ produce byte-identical `dist/objectstack.json`. ### Seed best practices -| Practice | Why | -|:---------|:----| -| TypeScript: `defineSeed()`, never `SeedSchema.parse()` | Lose compile-time field checks otherwise | +In TypeScript use `defineSeed()`, never `SeedSchema.parse()`: it loses compile-time field checks. **Fictional is fine; malformed is not.** A seed row passes the same field -validation as a user's insert; a refused value leaves the table short or empty -while sibling rows point at records that do not exist. +validation as a user's insert; a refused value drops the row its siblings point at. `os validate` / `os build` refuse such a value first, at the record's field — run them before trusting the load. So never mask or placeholder a sample value: no `138****4207`, From 20c06ad509ca413099b8c9eadc9a0855291d6ae1 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 04:59:11 +0000 Subject: [PATCH 2/2] docs(skills): a saved seed must name an existing object (seeds.md) `skills/objectstack-data/references/seeds.md` teaches the save door's 422 for a runtime-saved seed whose `object` resolves to nothing, and that a draft object is enough for a draft seed, with one eval case (id 35). The token ceiling row moves by the measured remainder (1812 -> 1898) under the standing ruling (record 6513306068). Claude-Session: https://claude.ai/code/session_01L6bhgTRf6qBRCqPh4JZaZL Co-authored-by: Claude --- .changeset/35480-seeds-load-and-save-refusals.md | 5 +++-- scripts/check-skills-token-ratchet.mjs | 9 ++++++++- .../evals/hooks-security-seeds-datasources.json | 10 ++++++++++ skills/objectstack-data/references/seeds.md | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.changeset/35480-seeds-load-and-save-refusals.md b/.changeset/35480-seeds-load-and-save-refusals.md index cd984749d65..60ec4ed1285 100644 --- a/.changeset/35480-seeds-load-and-save-refusals.md +++ b/.changeset/35480-seeds-load-and-save-refusals.md @@ -2,7 +2,7 @@ '@objectstack/skills': patch --- -docs(skills): the data skill says a seed record with a blank key field is refused at load +docs(skills): the data skill says a seed record with a blank key field is refused at load, and a saved seed naming an unknown object is refused 422 Clause-②: no Metadata-protocol: none @@ -10,6 +10,7 @@ Metadata-protocol: none objectstack-data's `references/seeds.md`: - "`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. +- 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. - 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. -`evals/hooks-security-seeds-datasources.json` gains one case on the refusal. +`evals/hooks-security-seeds-datasources.json` gains one case on each refusal. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 518dc2de77a..c018d79e581 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -1856,7 +1856,14 @@ export const CEILINGS = new Map([ // Arithmetic in bytes: 7033 -> 6905 after the cuts (-128); the teaching nets // +340 -> 7245 -> ceil(7245 / 4) = 1812; headroom was 0, so the ceiling moves // +53, the measured remainder only. Pinned AT the measurement. - ['skills/objectstack-data/references/seeds.md', 1812], + // 1812 -> 1898: the note under the field table says a `seed` saved at runtime + // names an object that exists or the save answers `422 INVALID_METADATA` at + // `object`, and that a draft object is enough for a draft seed; the `object` + // row points at it in place of "never write manually". Same raise path and + // the same paydown as the step above (one PR, the cuts are its deletion): + // 7245 -> 7590 bytes (+345) -> ceil(7590 / 4) = 1898; headroom was 0, so the + // ceiling moves +86, the measured remainder only. Pinned AT the measurement. + ['skills/objectstack-data/references/seeds.md', 1898], // 1351 -> 1343: the body-pin values left the count (#31115, ruling B; see // BODY_PIN_REPIN); the file's count fell by the same 8, headroom unchanged. ['skills/objectstack-platform/references/bootstrap.md', 1343], diff --git a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json index 3d1fda16ca9..6c76217979b 100644 --- a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json +++ b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json @@ -71,6 +71,16 @@ "must_not_contain": ["code: ''", "code: null"] } }, + { + "id": 35, + "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?", + "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.", + "files": [], + "assertions": { + "must_contain": ["422", "crm_lead", "not defined"], + "must_not_contain": [] + } + }, { "id": 5, "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.", diff --git a/skills/objectstack-data/references/seeds.md b/skills/objectstack-data/references/seeds.md index 3b089720490..3b1bffdba93 100644 --- a/skills/objectstack-data/references/seeds.md +++ b/skills/objectstack-data/references/seeds.md @@ -44,7 +44,7 @@ export const SeedData = [statusSeed, categorySeed]; | Field | Default | Purpose | |:------|:--------|:--------| -| `object` | derived | Auto-set from `objectDef.name` — never write manually | +| `object` | derived | Auto-set from `objectDef.name`; hand-written only in a runtime save (below) | | `externalId` | `'name'` | Stable business key (or field list) every mode matches on; required in every record (below) | | `mode` | `'ignore'` | Import strategy (see below) | | `columns` | — | Per-column write policy, keyed by field (below) | @@ -56,6 +56,12 @@ export const SeedData = [statusSeed, categorySeed]; Full Zod shape: `node_modules/@objectstack/spec/src/data/seed.zod.ts`. +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. + ### Import modes | Mode | Behavior | Use for |