Repository navigation
feat(spec, metadata-protocol): a seed dataset can declare dependsOn, the objects it loads after - #34276
Conversation
…he objects its hooks read A seed dataset declares the objects it must load after; each name joins the load's dependency graph beside the lookup edges. A name the load does not seed, a dataset naming its own object, or a declared edge that closes a cycle refuses the whole load before any row is written. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
…ess counts for Seed.dependsOn Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
…edger Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
📓 Docs Drift CheckThis PR changes 4 package(s): 10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 186 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 1b5a94f925950e2c05fe5e86a36cc0aefce603de && git checkout 1b5a94f925950e2c05fe5e86a36cc0aefce603de
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c934631723b7f8d2d447a73d5e7c3428a08cfb58 a739167a9cb117c30c597b6d282ff7530abb47c7 && git checkout -B drift-repro c934631723b7f8d2d447a73d5e7c3428a08cfb58 && git merge --no-ff a739167a9cb117c30c597b6d282ff7530abb47c7
node scripts/docs-audit/affected-docs.mjs --json c934631723b7f8d2d447a73d5e7c3428a08cfb58
|
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Request: review · PR #34276 · area S2 (A4) · Fixes #33812 · head
|
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review claim · head df0d942 · 2026-11-16T04:31Z |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review — PASSHead-sha:
The patch-id is |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head df0d942 · 2026-11-16T05:03Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-16T05:11Z. First review of this head; claim: comment 6907827915; no lane request (owed per check-owed-reviews). Independence: implemented in a project thread for domain:server#5 (zhuangjianguo); reviewed by os-tesla, who neither dispatched nor implemented it. This is the first contract review of this PR, so no earlier contract finding is continued. The lane review 6907406090 is a separate record; its item 7 (the card-named spec test file) is the lane's and is not carried here. ① Derived judgments
② Semver level
CI at this head: 68 check-runs, 58 success, 10 skipped, none failed, none pending. The PR is still a draft; ③ Boundary flags
④ Design judgment
S1 (should-fix) — A refused load is not reported as a failed load on the boot seed's summary. The PR body says the refusal is returned so that every caller reports it the way it reports any failed load. A refusal answers N1 (nit) — The docs page and the PR body name one partial load, a seed published on its own. Two more loads carry a subset and refuse the same way: the dev hot-reload seeder loads only the datasets of objects first seen in that reload, so a new object's seed that names an already-seeded object is refused until the next restart, and the refusal text suggests a misspelling. A marketplace install loads one package's datasets. Both follow ruling 6906526976 point 1 as written. A sentence in N2 (nit) — The Read and not raised: the boot seed's two basic-insert branches (no metadata service; a thrown load) write rows in authored order and honour no ordering edge, lookup or declared. That predates this diff and is unchanged by it. Implemented-by: VERDICT: FAIL |
… on the banner and the settled message A load refused for its dependsOn writes no row and carries its refusal in errors[] with every counter at zero; the boot outcome now counts each such error as rejected, the shape the marketplace heal records. Docs name the hot-reload and marketplace-install partial loads; the changeset's Skills-docs line carries its follow-up card. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
…ther SeedSchema pins Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
…xported from serve A test of the verdict then loads only that module, not the boot composition serve.ts imports. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
packages/cli/src/commands holds only oclif command modules; the helper moves next to format.ts and serve re-exports it unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head b0cd771 · 2026-11-16T07:03Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head a0e2353 · 2026-11-16T07:07Z |
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Request: delta review · PR #34276 · area S2 (A4) · Fixes #33812 · head
|
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-16T07:33Z. Delta review of this head against FAIL 6907946216 at df0d942; claim: comment 6909853386; no lane request (owed per check-owed-reviews). Independence: implemented in a project thread for domain:server#5 (zhuangjianguo); reviewed by os-tesla, who neither dispatched nor implemented it. What moved since df0d942: seven commits, all the PR's own, and no merge of main among them (the one merge on the branch is df0d942 itself, already read). They touch nine paths: the boot seed in Prior findings:
① Derived judgments
② Semver level
One consumer changes with the count and is worth knowing: CI at this head is NOT finished: 41 check-runs so far, 8 success, 11 skipped, 21 in progress, 1 cancelled ( ③ Boundary flags
④ Design judgment
No must-fix, no should-fix. N1 (nit) — new, continues no earlier finding. Two field comments describe Implemented-by: VERDICT: PASS |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review — PASSHead-sha:
The patch-id is |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh 席位核对Head-sha:
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43829259612 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Re-arm at
|
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract-review-claim: session_01ASNY8Ywba8ySbMdWvra2vS · head a739167 · 2026-11-16T08:48Z |
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract reviewServed-tier: Read at 2026-11-16. Full review of this head; claim: comment 6911735321. Independence: implemented on Inputs: card #33812 with every comment (maintainer ruling 6902020933, area ruling 6906526976, dev report 6906493106), the PR body and comments, the net diff of this head against its merge base with main ( Prior findings:
① Derived judgments
② Semver level
The level matches what the diff publishes. Nothing is breaking, so no migration or ADR-0087 marker is owed. The private dogfood package needs no changeset. Check-runs on this head are the gate verdicts: 69 runs, 59 success, 10 skipped, none failed, none pending. ③ Boundary flags
④ Design judgment
No must-fix, no should-fix. N1 (nit) — continues N1 of 6910329279. N3 (nit) — new. The Implemented-by: VERDICT: PASS |
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Hand-off (maintainer order 2026-11-16 09:01Z)
|
Requested by Steedos · project thread
Fixes #33812
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #34277 —
skills/objectstack-data/references/seeds.md(its relationship section and its best-practice table tell the author to order seeds parent before child in the exported array, which orders nothing;dependsOnis not taught)维护者速读
dependsOn(填对象名),加载器把它当作依赖边并入与 lookup 字段同一张依赖图;声明成环、指向本次加载未装载的对象、或指向自身时,整次加载拒绝,一行不写。dependsOn的应用顺序逐字节不变(有对照测试钉住);拒绝只发生在写了该键的数据集上。单租户启动种子被拒时,启动横幅Seeds:行标警告、seed-settled消息报ok: false,不再看似干净。单独发布的种子草稿是一次独立加载,其dependsOn指向别的条目时会被拒绝,需一起发布(见 Acceptance notes)。回滚即撤销本 PR。packages/metadata-protocol/src/seed-loader.ts(collectDeclaredDependencies、findDeclaredEdgeCycles、orderByDeclaredEdges、loadDatasets中的拒绝分支);packages/spec/src/data/seed.zod.ts(新键与defineSeed自依赖拒绝);packages/runtime/src/app-plugin.ts(启动种子把整次被拒计入 rejected)。pnpm --filter @objectstack/metadata-protocol exec vitest run src/seed-loader-depends-on-33812.test.ts,预期 12 个用例全绿;其中声明 dependsOn 的评分钩子看到 2 个评分档,对照组看到 0 个。What changes
Seed.dependsOn: string[](packages/spec/src/data/seed.zod.ts): the objects a dataset loads after, by object name, for an order no lookup field gives (most often abeforeInserthook that reads another seeded object). Optional, no default; each item is held to the object machine-name pattern.defineSeedrefuses a dataset that names its own object when it runs.packages/metadata-protocol/src/seed-loader.ts): each name becomes an edge in the graph the lookup fields already feed (buildDependencyGraphgains an optionaldeclaredmap; theISeedLoaderServicecontract signature is unchanged), sotopologicalSortandorderDatasetsput the dataset after the named object. Declarations of several datasets of one object are pooled. Objects left over after the Kahn pass (behind a lookup cycle) are appended in an order that keeps the declared edges; with none declared the append order is the old one.success: false,results: [], and oneerrors[]entry per refused declaration (field: 'dependsOn',sourceObjectthe declaring object,targetObjectthe named one,targetField: '(dataset)'). Three cases: the dataset's own object; a name no dataset of the same load seeds (the message says when the named object's datasets were all scoped out byenvorlocale); and a declared edge that closes a cycle. The refusal is RETURNED, not thrown, so every caller reports it as a failed load; a throw would have sent the single-tenant boot seed into AppPlugin's basic-insert fallback, which writes every row in authored order.A dependsOn Bis refused when B already depends on A through any chain of edges, lookup or declared (self-references excluded, as the sort excludes them); equivalently, the edge lies on a cycle of the combined graph. A cycle made of lookup edges alone is untouched and still loads in deferred passes.packages/runtime/src/app-plugin.ts). The single-tenant boot seed records its outcome for the banner'sSeeds:line and theobjectstack:seed-settledmessage (recordSeedOutcome). A refused load writes no row and leaves every row counter at zero, so from the counters alone the source was dropped from theSeeds:line and the message answeredok: true. The boot seed now counts each error of a load refused before any dataset ran (success: falsewith no results) as a rejected row, the same failure shape the marketplace heal already records (rejected: summary.errors); the CLI channels then show the source with a warning and answerok: false. A load that ran keeps its per-dataset counts unchanged.composeSeedSettledMessagemoves out ofpackages/cli/src/commands/serve.tsintopackages/cli/src/utils/seed-settled-message.ts(re-exported fromserve.ts), so the new test reaches it without importing the serve command;packages/cli/src/commandsholds only command modules.packages/spec/liveness/seed.jsongains alivedependsOnrow (evidence anchored on the three loader symbols, the runtime proof named in its note);content/docs/data-modeling/seed-data.mdxgains a "Load Order —dependsOn" section and stops saying the array order is the load order, and says that the dev hot-reload seeder and a marketplace install load only part of an app's seeds and refuse the same way; the ObjectDependencyNode TSDoc names the declared edges;check:generated --fixregenerated the reference pages (seed,seed-loader,package-api,manifest),authorable-surface/data.jsonandliveness/state-counts/seed.md.Tests
packages/metadata-protocol/src/seed-loader-depends-on-33812.test.ts(12 cases): the card's shape (a rating that looks up its rule only, bands two master_detail hops below the rule, the fake engine stamping each rating with the band count it sees at insert time); the no-dependsOncontrol pinning today's exact order; pooled declarations; a dataset downstream of a lookup cycle; the four refusals (lookup-closed cycle, declared-only cycle, own object, unknown name, env-scoped-out name), a scoped-out dataset that is not judged, the lookup-only cycle control, and the dry run.packages/spec/src/data/seed.test.ts(6 cases added beside the otherSeedSchemapins): the key parses and is kept, stays absent when omitted, refuses a non-machine name and a bare string;defineSeedcarries it and refuses the own-object case.packages/cli/src/commands/serve-seed-refused-load-33812.test.ts(2 cases): AppPlugin's real boot seed and SeedLoaderService over an in-memory engine double, then theseed-summaryservice as the CLI reads it, the settled message and the banner line. A load refused bydependsOn: ['no_such_object']writes nothing, recordsrejected > 0, answersok: falseand prints⚠ Seeds: … refused_load_app; the control, the same boot with a load that succeeds, writes 2 rows, answersok: trueand printsrefused_load_app 2 rowswith no warning.packages/qa/dogfood/test/seed-depends-on-33812.dogfood.test.ts(3 cases, ADR-0054 runtime proof): a real stack boot whose sandboxedbeforeInserthook counts seeded bands, read back over REST: the rating declaringdependsOnsees 2, the same rating without it sees 0.Red first, then green (head 4575480)
aab8b3188ablob ofseed-loader.tsswapped in, restored to the HEAD blobeb0ca78055f4, hash-checked):Tests 9 failed | 3 passed (12); the card case failed onexpected 3 to be less than 2(bands inserted after the rating). The three that stayed green are the controls: no-dependsOnorder, lookup-only cycle, scoped-out dataset not judged.pnpm --filter @objectstack/metadata-protocol testTest Files 345 passed | 9 skipped (354),Tests 22958 passed | 45 skipped;typecheckexit 0.pnpm --filter @objectstack/spec testTest Files 845 passed (845),Tests 27011 passed | 1 todo;typecheckexit 0.seed-depends-on-33812.dogfood.test.ts3/3; withseed-external-id-refusal,showcase-verify-seed,meta-types-create-seed4 files, 15/15 (at0d4aeb9798, before the main merge).test:repo; the full dogfood battery (no!, no narrowing arm); thecloud-connectionsuite, a caller of the loader: the contract signature it compiles against is unchanged (theruntimesuite ran in round 2, below).Round 2: the refused boot seed (head a0e2353; code at b0cd771)
a0e2353145only adds'@objectstack/cli': minorto the changeset (the cli diff moves, and a non-nonekind takesminoron every moved package); the code and tests are byte-identical tob0cd771c69, where CI was 58 success, 10 skipped.serve-seed-refused-load-33812.test.tsTests 2 passed (2).dist/(rejected: totalErrored + refusedLoadswapped for a zero-length planted marker, which is the pre-fix count;ablation-dist-preflightmarker present indist/index.jsandindex.cjs). Result:Tests 1 failed | 1 passed (2), the refused case red onexpected 0 to be greater than 0, the control green. The source was restored to the HEAD blobd8a3078d1c71(git diff HEADempty), runtime rebuilt, the marker--absentfrom all 12 built files, tree clean, and the test green again (2/2).pnpm --filter @objectstack/runtime test:Test Files 607 passed (607),Tests 11089 passed | 19 skipped;typecheckexit 0.pnpm --filter @objectstack/cli exec vitest run --project unit:Test Files 2 failed | 422 passed (424),Tests 5983 passed | 29 skipped. The two failed suites aretest/published-subpath-console.pin.test.tsandtest/published-subpath-hook-body.pin.test.ts, both at setup onpackages/cli is not built (./dist/index.js is absent): only the cli's dependency closure had been built, not the cli. They are NOT MEASURED locally; CI (which builds the cli) is green atb0cd771c69. The clitypecheckexit 0. The integration tier is declared to CI.pnpm --filter @objectstack/metadata-protocol test:Test Files 345 passed | 9 skipped (354),Tests 22958 passed | 45 skipped.packages/specsrc/data/seed.test.ts:Tests 40 passed (40); spectypecheckexit 0.check:engine-double-contract: on the first CI run the new cli test's double was not in the ledger.--writeadded itsfindOneandupdaterows toscripts/engine-double-contract.pinned.json, and the rerun exited 0.check:test-source-aliasexit 0 (the test reaches the helper throughutils/, not throughserve.ts).check:cli-command-idsexit 0:97 module(s) under packages/cli/src/commands examined.b0cd771c69derived 130 families. Local sweep: 112 of 130 families ran before it was stopped to hand this body over (the other 18 are NOT MEASURED locally; CI runs them); every one that ran exited 0 except five that exited 3 (PREREQUISITE NOT MET, NOT MEASURED, because theirdistwas not built locally):check:i18n,check:i18n-coverage,check:i18n-walk-parity(they need the clidist), the speccheck:skill-examples(needs the clientdist), andcheck:dual-build-cjs-loads(needs a full build). The derivation warns that the tree is 22 commits behind origin/main. CI atb0cd771c69is 58 success, 10 skipped.Ablations (each restored to the HEAD blob, `git diff HEAD` empty)
All through
scripts/ablation-replace.mjs:dist/for the dogfood proof (ablation-dist-preflightmarker present, then--absentafter the restore and rebuild, tree clean): the card case red,expected +0 to be 2; the control stayed green.defineSeedown-object refusal removed: 1 red.Gate families (derived by dispatch-gates at 94efc9d, reconciled at 4575480)
node scripts/pm/dispatch-gates.mjs --ran:123 derived famil(ies) accounted for — 122 run, 1 NOT-MEASURED.check:dual-build-cjs-loads, reason: exit 3, it needs every package'sdist(a full workspace build). CI runs it.check:engine-double-contractexit 1 on the first pass: the new test's double was not in the pinned ledger.--writerecorded it (scripts/engine-double-contract.pinned.json, 3 rows); rerun on 4575480:OK — 1327 pinned.check:generatedfoundcheck:docsandcheck:livenessstale;--fixregenerated both and re-checked them green.check:authorable-surfacegreen.check:nul-bytesexit 0.git merge-tree --write-tree HEAD origin/mainexit 0 (origin/main 9 commits ahead, no overlap).Acceptance notes
packages/runtime/src/app-plugin.ts(the refused-load count),packages/cli/src/commands/serve.tsandpackages/cli/src/utils/seed-settled-message.ts(the helper move, no behaviour change),packages/cli/src/commands/serve-seed-refused-load-33812.test.ts(the pin and its control) andscripts/engine-double-contract.pinned.json(its double's ledger rows). The changeset names@objectstack/runtimeminor for the visible change and@objectstack/climinor for the moved helper.dependsOnacross them resolves. A draft publish loads only the bodies being published, so a published seed whosedependsOnnames an object seeded by another item is refused until both are published together; the changeset and the docs page say so. This is the ruling applied literally; whether a publish should judge against already-landed rows instead is raised as an open question in the report, not decided here.A dependsOn Bwhile B looks up A is orderable in principle; the ruling refuses any cycle a declared edge closes, and so does this PR.errors[].recordIndexis 0 on a refusal. The error schema requires a non-negative row index and a refusal belongs to the dataset, not to a row;field: 'dependsOn'andtargetField: '(dataset)'mark it. Widening the error shape is a contract change and not part of this card.prooffield. The ADR-0054proofform needs the dogfood file's@proof:tag registered inpackages/spec/scripts/liveness/proof-registry.mts, whose classes are the high-risk list of ADR-0054 §2a; seed ordering is in none of them and that file is outside this card's surface. The dogfood proof is named in the row's note.defineSeedrefuses the same case at call time.buildDependencyGraph(objectNames)without declared edges, so their (reverse) order ignoresdependsOn; that path deletes rows and the key is about insert-time reads, so nothing there is wrong today. Noted only.Verification
Hypotheses from the dispatch, each measured:
buildDependencyGraph's nodedependsOn,topologicalSortorders by it, and authored order stays the Kahn tie-break.defineSeedat call time for the one case a dataset can be judged on alone (its own object). The set of objects in the same load exists only at load time:envandlocalefiltering, several packages in one replay, and a draft publish's one-item load all change it after authoring.Metadata-protocol: addedtakesminoron every moved published package (@objectstack/spec,@objectstack/metadata-protocol,@objectstack/runtime,@objectstack/cli) per AGENTS.md Post-Task step 3; the private dogfood package carries no changeset.Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
🤖 Generated with Claude Code