Repository navigation
fix(metadata-protocol)!: a seed record that leaves a key field blank is refused at load - #35459
Conversation
…is refused at load A keyed seed record (ignore, upsert, update) whose externalId value is blank - no value, null or an empty string, in any component of a composite key or the one field of a single-field key (name by default) - keyed empty, matched no row and was inserted again on every load with nothing said (measured 2 -> 3 -> 4 rows). The load now refuses it on the key as authored, after expressions resolve and before references do: one error naming the object, record index, blank field(s) and the fix, logged once per dataset; every other record loads. A deferred reference is authored, so it is not blank and still lands. The all-empty dataset warning is replaced by the per-record refusal. Tests: new pins in the seed-loader harness files; the keyless devices that relied on a blank key are remade on the mode-less (unparsed) load; consumer fixtures that keyed records on a field they did not carry are re-keyed. Docs: the seed-data page states the rule and its keyless TestUser example gains externalId 'email'. ADR-0087 ledger entry seed-key-blank-record-refused registers the narrowing. Claude-Session: https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x Co-authored-by: Claude <noreply@anthropic.com>
…ank-seed-key-refused
… cause that still arises An upgrade now replaces a package's datasets on the shared replay list, so the refusal of two fallback sets for one object, its docblock and the seed-data page no longer name an in-process upgrade as a cause; the cause left is two packages marking the same object. The pin follows. Claude-Session: https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 175 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin b0ea64cab648eabafaadaca83416aa508f31a877 && git checkout b0ea64cab648eabafaadaca83416aa508f31a877
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 41ee21810a1c7f16d2ba15845ce88d04e4334072 e6c172e87c4735552082b36dd294e178f71f0f76 && git checkout -B drift-repro 41ee21810a1c7f16d2ba15845ce88d04e4334072 && git merge --no-ff e6c172e87c4735552082b36dd294e178f71f0f76
node scripts/docs-audit/affected-docs.mjs --json 41ee21810a1c7f16d2ba15845ce88d04e4334072
|
…ank-seed-key-refused
… not code The error-code casing guard reads a lowercase literal under a code key as an error code; the field is plain demo data. Claude-Session: https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CaysxGzF62ACvZ1x9x Final head for review · area pkg-1 · 2026-11-19T11:13Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对L1-a: ACCEPT with one required item before landing · head Readings: K=10 (no main merge owed); Code: sound, and it is the ruling. The maintainer chose B1 on the seat's decision card (seat ruling record 7000515976), extended to single-field keys on #35336.
Evidence. A1 measured 2, 3, 4 rows over three loads before the fix and 1, 1, 1 after, on single-field, default- Declaration: agreed. R1 (required before landing): Routing: L2 owed. There are two contract faces: the narrowing declaration, and the non-test |
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: ① Derived judgmentsPR #35459, cards #34857 and #35336 (#35376 rides). Read: both cards with every comment (rulings 7000515976 and 7000600379, the claim and its two amendments, both os-dev-reports), the PR body, the file list (13 files), the net diff against
② Semver level
③ Boundary flags
④ Design judgment
S1 (should-fix) — the default-key wording never prints on a shipped path, and its pin exercises a path production does not take. Nits (no effect on correctness or the contract; ride the S1 push or a follow-up):
The two pin files (enforcing). They pin the composite key with
One should-fix (S1), three nits; a delta review is owed on the S1 fix, and the dogfood battery on the head that carries it. Security-touching: no Implemented-by: VERDICT: PASS |
…the parsed request The default-key hint in the blank-key refusal fired only for an undeclared externalId, which a parsed request never carries (the parse defaults it to name). The hint now rides on a single-field key of name: the message says name is also the key a dataset gets when it names none. The pin goes through SeedLoaderRequestSchema.parse. The protocol.ts docblock no longer says the boot loader never refuses, and the seed-data docs say the key is read after the record's expressions resolve. Claude-Session: https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: ① Derived judgmentsDelta review of PR #35459 (cards #34857 and #35336) against the record on
② Semver levelUnchanged and still correct: ③ Boundary flags
④ Design judgmentS1: closed. N1: closed. N2: closed. N3: not fixed here, carried by #35485. Accepted as a follow-up; it was a nit and stays outside this PR. No must-fix, no should-fix. Security-touching: no Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: ① Derived judgmentsMerge-only delta of PR #35459 (cards #34857 and #35336) against the record on
② Semver levelUnchanged and still correct: ③ Boundary flags
④ Design judgmentS1: closed. Closed on What
No must-fix, no should-fix. Security-touching: no Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CaysxGzF62ACvZ1x9x Landing · head
Status: |
|
repo:objectstack#5 · os-bill · session_01Utp6CaysxGzF62ACvZ1x9x Re-queue · head Dequeued on CI_FAILURE in merge-group run 44530279296: |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44530279296 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44533961485 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
…ank-seed-key-refused Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: ① Derived judgmentsMerge-only delta of PR #35459 (cards #34857 and #35336) against the record on
② Semver levelUnchanged and still correct: ③ Boundary flags
④ Design judgmentS1: closed. Closed on What
No must-fix, no should-fix. Security-touching: no Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CaysxGzF62ACvZ1x9x Landing · head
Status: |
Fixes #34857
Also delivers (folded, closed by the area at close-out): #35336, #35376
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #35480 — skills/objectstack-data/references/seeds.md (:48 the externalId row, :68 the composite key, :93 externalId selection: none says a record must carry every key field or is refused at load)
维护者速读
席位核对
What changes
Ruling B1 (record 7000515976), extended to single-field keys (record 7000600379).
packages/metadata-protocol/src/seed-loader.ts: inloadDataset's record loop, for the keyed modes (ignore,upsert,update), a record that leaves a field of itsexternalIdblank (undefined,nullor''; any component of a composite key, or the single field,nameby default) is refused:errored++, oneReferenceResolutionError(field= the blank field(s),targetField: '(externalId)',recordIndex), onelogger.errorper dataset (none on a dry run),continue. The check sits where the authored key is read: afterresolveSeedRecord(expressions) and the organization stamp, BEFORE any reference resolves, so a deferred reference (seed: a composite externalId that includes a reference only fillable after the first load never matches on later loads, so each load inserts another row #34800 / seed: a row whose key reference was deferred at landing is recorded under no ledger key, so deleting it does not stick (re-inserted on the next load) #34856) still holds its authored value and is never caught. The blank rule is the oneseedLandedKey/externalIdKeyalready key''by, now one helperisBlankSeedKeyValue; whitespace is a value (A3, unchanged).warn. That warn said "every record is written as a new row, on every load", which is false once nothing is written, and a dataset-level line on top of per-record errors would report the same records twice. The per-record message carries the metadata-protocol: an upsert seed whose externalId names a field the object lacks is accepted and inserts a duplicate row on every publish, silently #28952 prescription too (key the dataset on fields every record carries, a list, or'id'). The boot log says it once per dataset.findDuplicateFallbackSets(seed: the duplicate-fallback refusal still names "an upgrade within this process" as a cause, which the install door no longer produces after #35109 #35376, PR fix(runtime, cloud-connection): an upgrade replaces the package's seed datasets on the shared replay list #35374 merged 2026-11-19T08:44Z before this PR opened): refusal text and docblock name only the cause that still arises, two packages marking one object.content/docs/data-modeling/seed-data.mdx: Import Modes states the rule; the composite-key section says every listed field is carried; theTestUserexample (records with noname) gainsexternalId: 'email'(A4); the fallback bullet drops the stale in-process-upgrade cause (seed: the duplicate-fallback refusal still names "an upgrade within this process" as a cause, which the install door no longer produces after #35109 #35376).packages/spec/src/migrations/entries/semantic/18.seed-key-blank-record-refused.ts(data only, no export, no Zod change; authorized by the PM for this narrowing), markedregistered seed-key-blank-record-refusedin the changeset.Tests
New pins (shared-harness rule, top-level describes in existing harness files):
seed-loader-empty-key-warn.test.ts: composite key with one component''/null/ omitted (three loads: 2, 2, 2 rows; error names object, index 1, fieldsku, fix), single-fieldsku, defaultnamethrough a parsed request (SeedLoaderRequestSchema.parse, noexternalId: the message reads "keyed on externalId 'name' (also the key a dataset gets when it names none) and leaves 'name' blank"), CONTROL an authoredname+skukey gets no such hint, an expression evaluating empty (os.user.id) refused,updatereports instead of skipping silently, dry run reports and logs nothing, CONTROL fully keyed dataset converges and says nothing, CONTROL whitespace-only value is a value. The metadata-protocol: an upsert seed whose externalId names a field the object lacks is accepted and inserts a duplicate row on every publish, silently #28952 describe flips: every record refused, one error each, one line per dataset, nowarn.seed-loader-deferred-key-reference.test.ts: CONTROLignoreandupsert, a deferred key reference is not refused, three loads one row; CONTROL a key reference authored''beside it is refused. The seed: a row whose key reference was deferred at landing is recorded under no ledger key, so deleting it does not stick (re-inserted on the next load) #34856 delete describe in the same file stays green.Fixture triage (what each pinned is kept):
seed-loader-deferred-dropped.test.ts(reverse pin): its keyless device was a blankregionin a keyed dataset, now refused. Remade, not deleted: the department dataset names nomodeand the load config nodefaultMode(a request built without the parse's defaults, the one load that still writes a row keyed''), so pass-2 write-back by captured id stays pinned on a written keyless row. Added: the KEYED blank-component record is refused before it writes or defers anything.seed-loader-pointer-pair.test.ts:insertSeedkeyed onidwith no ids now gives each record its id; the KEYLESS heal case moves to the same mode-less device.seed-loader-composite-key-diagnostic.test.ts: the ruling's pair('a','b')/('a\0b','')— the second is now refused, still never matched to the first.protocol.seed-external-id-refusal.test.ts: theexternalId: 'id'control's record carries an id.packages/objectql/src/engine-seed-required-deferral.test.ts: datasets with noexternalId(defaultname) and nonamegetexternalId: 'process_name'/'action'; the KEYLESS heal case uses the mode-less device.packages/runtime/src/seed-loader.test.ts: "should handle records with no matching externalId field" pinned the insert; flipped to the refusal.seed-loader-locale-scope.test.ts: seed: the duplicate-fallback refusal still names "an upgrade within this process" as a cause, which the install door no longer produces after #35109 #35376's pin follows the new text.Acceptance notes
code2, 3, 4 rows, 0 warn, 0 error; defaultname2, 3, 4; composite''2, 3, 4; compositenull(ignore) 2, 3, 4. With the fix: 1, 1, 1 and one error per load.haltOnError: false).mode, nodefaultMode) is left unkeyed on purpose; nothing in this PR changes it.seed-loader-locale-scope.test.ts"an upgrade that changed the marked set (versions 1 and 2 on one list)" still feeds both versions straight to the loader; its comment describes the pre-fix(runtime, cloud-connection): an upgrade replaces the package's seed datasets on the shared replay list #35374 replay list. Left as is: the loader still refuses that input from a direct caller.Verification
All readings on head
755c75a5(the fold commit64abfecd, one merge oforigin/maina9b36eff, the #35376 commit) unless named.Tests and typecheck
pnpm --filter @objectstack/metadata-protocol test:Test Files 358 passed | 9 skipped (367),Tests 23238 passed | 45 skipped (23283).pnpm --filter @objectstack/metadata-protocol --filter @objectstack/runtime --filter @objectstack/objectql typecheck: exit 0.src/seed-loader.test.ts src/seed-datasets.test.ts src/app-plugin.seed-locale-producer.test.tsTests 93 passed (93); objectqlsrc/engine-seed-required-deferral.test.tsTests 7 passed (7).64abfecd's tree (dist rebuilt): every test file outside this package that names the seed loader or authors seed records, run in runtime (36 files), objectql (26), cloud-connection (26), rest (10), metadata (4), plugins/organizations (5), cli unit tier (3): all green after the two re-keyed files above; integration-tier cli files declared to CI.pnpm --filter @objectstack/dogfood testafter the@objectstack/dogfood^...build, on755c75a5:Test Files 482 passed | 3 skipped (485),Tests 4092 passed | 68 skipped (4160), lock verdictcommand-exit 0; zero blank-key refusals in the boot logs.Ablation (restored, blob equals HEAD, `git diff HEAD` empty)
scripts/ablation-replace.mjsonseed-loader.ts:const blankKeyFields = [...keyFields].filter(...)replaced byconst blankKeyFields: string[] = [];(anchor 1 to 0, blobb10e9f2eto23591f6e).seed-loader-empty-key-warn.test.ts+seed-loader-deferred-key-reference.test.ts:Tests 11 failed | 22 passed (33); the 11 are every refusal pin, the 22 include every CONTROL. Restored: blobb10e9f2eequals HEAD. No build involved: the pins import./seed-loader.jsfrom source.Gates
dispatch-gates.mjs --commandsderives 117 families (the diff touchespackages/spec). Run locally on755c75a5, all exit 0:check-adr-0087-registration(with--self-test; readsregistered seed-key-blank-record-refused (new here)),check-changeset-no-major,check-empty-changeset,check:nul-bytes,check:doc-authoring,check:durability-log-level,check:issue-citations,check:doc-anchors,check:docs-single-h1,check:doc-frontmatter,check:startup-registry-verdict,check:engine-double-contract,docs-audit/check-affected-docs,check:cross-package-test-inputs,check:test-source-alias, speccheck:upgrade-guide, speccheck:spec-changes,check:type-check-coverage,check:type-check-debt,check:dts-closure. The other derived families are declared to CI (--ran: 21 run, the rest UNRUN locally).overlap-check.mjs --branch=HEAD:VERDICT clean exit 0(shares one test file with open PR fix(metadata-protocol): the seed save door refuses an unknown object; the probe names a missing object #35388, merges cleanly).Generated by Claude Code