Skip to content

docs(skills): seeds.md teaches the blank-key load refusal and the unknown-object save refusal - #35750

Closed
objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/issue-35480-seeds-load-refusals
Closed

objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/issue-35480-seeds-load-refusals

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #35480
Fixes #35456

Clause-②: no
Metadata-protocol: none
Skills-docs: updated here

维护者速读

  • 用户能看到什么变化:用技能写初始化数据的作者(多数是 AI)会被告知两条规矩:每条记录都要填上用来识别它的键值,否则这一条在加载时被拒收;运行时保存的初始化数据必须指向一个已存在的对象,否则保存被拒。
  • 为什么做:这两条拒收都已经在主干上线,对外发布的数据技能还没写;属于「已发布技能与运行时保持一致」这条线,替按技能写数据的应用作者解决。
  • 出错会怎样:只改说明文字和两条评测,不改运行时;写错了作者会按错的说明写数据,撤回本次合并即可恢复原文。
  • 要你做什么:这份改动动了对外发布的技能文字并按既有裁决抬高了一个文件的字数上限(先删重复、余额按实测),请在席位核对之后审阅并决定是否合入。

What changes

Two commits, one per card.

Commit Card Text Eval
b3b374b39 the keyed-record card (first Fixes line) ### externalId selection gains the rule; the externalId row points at it; three restatements cut case id 34
20c06ad50 the unknown-object card (second Fixes line) a note under the field table; the object row points at it case id 35

Both land in skills/objectstack-data/references/seeds.md and skills/objectstack-data/evals/hooks-security-seeds-datasources.json, with one changeset (@objectstack/skills, patch) and the seeds.md row of scripts/check-skills-token-ratchet.mjs.

What the skill now says, and where main says it

Every sentence is a reading of origin/main at 03bce5c22.

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."

  • Keyed modes are upsert, update, ignore: packages/metadata-protocol/src/seed-loader.ts:1840. Those are every mode the skill teaches (insert / replace are refused, as the same file already says), so the skill says "in every mode".
  • Blank is undefined, null or '', with no trim: seed-loader.ts:469-471 (isBlankSeedKeyValue, docblock: "A whitespace-only value is a value here (no trim)").
  • The default key is name: seed-loader.ts:69 (DEFAULT_EXTERNAL_ID_FIELD), and the refusal says so: seed-loader.ts:493-494.
  • Any component of a composite key: seed-loader.ts:2346 filters every key field.
  • The refusal names the object, the record index, the blank field(s) and the fix: seed-loader.ts:506-510.
  • The record is skipped and the loop goes on, so the others load; it is reported in the load result: seed-loader.ts:2347-2364 (errors.push, continue).
  • Pinned by packages/metadata-protocol/src/seed-loader-empty-key-warn.test.ts:139 (composite component, single field, default name; siblings converge).

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 save door alone asks it (door === 'save'); the publish promotion and the restore doors 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.
  • The door's own words, "which is not defined", "Correct the name to the object's full name (e.g. 'crm_lead', not 'lead')", "a draft of it is enough for this draft", "or create and publish the object first": protocol-save-door-refusals.ts:1174-1184.
  • Pinned by packages/metadata-protocol/src/protocol.seed-external-id-refusal.test.ts:381-421 (draft save, publish save, and a publish save whose object is only a draft).

Doors not taught. os validate and os build judge seed record values (packages/cli/src/utils/seed-record-values.ts), not a blank key and not a seed's object; the skill names only the load (first rule) and the runtime save (second rule).

Token budget: the standing ruling, and the deletion

seeds.md was at 1759 of 1759 tokens. The raise follows the standing ruling in the header of scripts/check-skills-token-ratchet.mjs (maintainer, 2026-10-27, ruling record 6513306068), verbatim:

「A:先削重复,余额按实测提高」

Deletion in the same file, shown in the diff of commit b3b374b39:

  • the columns row's shape literal ({ FIELD: { applyOn: 'create' } }), which its own section and code block show;
  • the one-row best-practices table, now one sentence with the same content;
  • the second telling of what a refused seed value leaves behind ("leaves the table short or empty while sibling rows point at records that do not exist"), which the validation paragraph above it already says ("a refused row never lands").
Reading Before After
seeds.md lines 182 190 (+8)
seeds.md bytes 7033 7590
seeds.md tokens (ceil(bytes / 4)) 1759 1898 (+139)
seeds.md ceiling row 1759 1898 (headroom 0, pinned at the measurement)
bundle, ratcheted (authored) tokens 196132 196271 (+139)
bundle, eval fixtures (not ratcheted) 70045 70589 (+544)
bundle total, whole shipped tree 280730 281413 (+683)

Arithmetic in bytes: 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; the remainder is the measured raise.

Contradiction search (the second card's done-when)

grep -rni seed skills/objectstack-data --include=*.md outside seeds.md: SKILL.md :5, :6, :20, :221, :295, :451; references/_index.md :16, :44; references/data-hooks.md :484; rules/lifecycle.md :188; rules/field-types.md :13, :53. None speaks of a seed's object or of a record's key value. Inside seeds.md, one sentence contradicted the new note: the object row's "never write manually". It now reads "hand-written only in a runtime save (below)". The examples in the file all carry their key field (code, slug, number, email, name).

Tests

No runtime code changes; nothing to unit-test. Two eval cases:

  • id 34: an upsert seed keyed on code where two records have none. Expected: the answer gives each record a value or keys on a field every record carries, and says the record is refused at load.
  • id 35: a draft seed saved with object: 'lead' when the object is crm_lead. Expected: the 422 at object with the reason, the full name as the fix, and that the draft object is enough for a draft seed.

Placed directly after the existing seed cases (ids 4, 30, 31), away from the end of the array. node scripts/pm/overlap-check.mjs at 20c06ad50: VERDICT clean exit 0 (merges cleanly with origin/main and the three open pulls sharing a file).

Acceptance notes

  • Local gates are a declared subset: the skills, changeset and script families the diff derives. The build-reading families (check:dts-closure, check:dual-build-cjs-loads, check:lean-entry-closure, check:published-files, check:sourcemap-no-sources-content), check:pm-dispatch-gates and the rest of the derived list are left to CI.
  • check:skill-examples answered PREREQUISITE NOT MET locally (exit 3, the client SDK is not built in this worktree): NOT MEASURED, not red.
  • The card names three anchors for the first rule. The 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".
  • This pull touches skills/**, a governed surface: it stays a draft, with no reviewer request and no auto-merge from this side.

Verification

Read first: skills/objectstack-data/references/seeds.md (the two added paragraphs and the three cuts), then the seeds.md row comment in scripts/check-skills-token-ratchet.mjs.

Two-minute check: node scripts/check-skills-token-ratchet.mjs and look for the line skills/objectstack-data/references/seeds.md 1898 / 1898 (+0) and the closing line "59 authored bundle file(s) within their ceilings".

Local gate readings at 20c06ad
0  node scripts/check-skills-token-ratchet.mjs
0  node scripts/check-skills-token-ratchet.mjs --self-test      (104 cases pass)
0  node scripts/check-adr-0087-registration.mjs --base origin/main
0  node scripts/check-changeset-no-major.mjs --base origin/main
0  node scripts/check-empty-changeset.mjs --base origin/main
0  node scripts/check-closing-keyword-parity.mjs
0  node scripts/check-comment-mask-corpus.mjs
0  node scripts/check-declaration-mirrors.mjs
0  node scripts/check-self-test-wired.mjs
0  node scripts/check-self-test-workflow-commands.mjs
0  node scripts/check-doc-route-spelling.mjs --advisory
0  pnpm --filter @objectstack/spec run check:skill-refs         (10 generated files in sync)
0  pnpm --filter @objectstack/spec run check:skill-served-sections
0  pnpm --filter @objectstack/spec run check:skill-docs         (Skill docs in sync)
3  pnpm --filter @objectstack/spec run check:skill-examples     (PREREQUISITE NOT MET: NOT MEASURED)
0  pnpm check:skill-compatibility
0  pnpm check:skill-frame-sync
0  pnpm check:skill-identifier-liveness
0  pnpm check:skill-links
0  pnpm check:doc-authoring
0  pnpm check:nul-bytes
0  pnpm check:pm-skill-id-lint
0  pnpm check:role-word
0  pnpm check:ratchet-remedy-authority
0  pnpm check:scripts-symbol-anchors
0  pnpm check:corpus-claim-drift
0  pnpm check:closed-ceremony-text

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgTRf6qBRCqPh4JZaZL

… (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 <noreply@anthropic.com>
`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 <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTRf6qBRCqPh4JZaZL

Superseded by #35757, which folds this pull with the three other area b1-D skills-text pulls (#35743, #35746, #35750, #35751) onto current main at the seat request: one approval and one merge on the governed skills/** surface instead of four rounds on the shared token-ratchet budget. The commits of this branch are carried into #35757 unchanged by merge. Closing this one; the branch is left in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants