Repository navigation
fix(cli): os diff says a replay inserts an insert seed dataset again, as it does for replace - #31192
Conversation
… on replay seedModeNote explained the replace arm and the upsert/update arm but said nothing for insert, whose loader arm (SeedLoaderService.writeRecord and decideWriteAction) inserts every record with no match, exactly like replace. The plan now says so, and the diff test pins the note on an insert dataset added and changed, with an ignore dataset as the silent control. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2bzGzPEiCJX3i1fYRj
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 35 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 28ae5a96cbb1fefd42a760f108c42ec390f61946 && git checkout 28ae5a96cbb1fefd42a760f108c42ec390f61946
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8acbfab9b4d9c0f6df84d4f350b364fe5eb8d4fc 1f5316d18a534870666a2709c58ee5d7e6876cd2 && git checkout -B drift-repro 8acbfab9b4d9c0f6df84d4f350b364fe5eb8d4fc && git merge --no-ff 1f5316d18a534870666a2709c58ee5d7e6876cd2
node scripts/docs-audit/affected-docs.mjs --json 8acbfab9b4d9c0f6df84d4f350b364fe5eb8d4fc
|
|
domain:server#4 · marchtian · session_017ihL2dLQEXWGsE2SZ3Qn5F 席位核对 — ACCEPT · domain:server#4 · Head-sha:
|
Requested by 田騏 · project thread
Fixes #31139
Clause-②: no
Metadata-protocol: none
维护者速读
os diff的升级计划对mode: 'insert'的种子数据集,现在和replace一样说明重放会怎样:"a replay inserts these again, and a row the database refuses is that row's error"。insert和replace走的是同一条路:不查匹配,每次重放都把记录再插一遍。上一个 PR 只给replace加了提示,insert数据集在计划里看起来像无害,同一种行为被说成两样。packages/cli/src/commands/diff.ts的seedModeNote(新增的insert一行);packages/cli/test/diff-upgrade-plan.test.ts新增的用例。pnpm --filter @objectstack/cli exec vitest run --project unit test/diff-upgrade-plan.test.ts,预期 8 个测试全过,新用例里insert数据集新增和修改两行都带这句提示,ignore那行不带。What changes
Text only; no behaviour change.
packages/cli/src/commands/diff.tsseedModeNote: a dataset in modeinsertnow reads "; a replay inserts these again, and a row the database refuses is that row's error". Thereplaceandupsert/updatelines are unchanged.main, not from the card:SeedLoaderService.writeRecordcase'insert'callsengine.insertwithout looking at the existing-row match, anddecideWriteActionanswersinsertforinsert,replaceand the default alike (packages/metadata-protocol/src/seed-loader.ts). A refused row goes to the load's errors while the rest land, the same fact theSeedModecomment inseed.zod.tsstates since docs(spec,cli): seed replace deletes nothing, and the AppPlugin loads skip a landed row a person deleted #31135.packages/cli/test/diff-upgrade-plan.test.ts: one new case. Aninsertdataset added and aninsertdataset changed both carry the note; anignoredataset changed in the same plan stays silent (the control; an absent mode defaults toignore, which the existing case already pins silent)..changeset/cli-diff-insert-seed-note.md:@objectstack/clipatch.Tests
pnpm --filter @objectstack/cli exec vitest run --project unit test/diff-upgrade-plan.test.ts: 1 file, 8 tests passed.src, so no build leg):scripts/ablation-replace.mjsdeleted the newinsertline (anchor 1 → 0, blob b02482c0 → 5a8ab9b9); the new case went red ("Tests 1 failed | 7 passed (8)"), the other seven stayed green. Restored: blob == HEAD andgit diff HEADempty.packages/cliunit layer, whole (vitest run --project unit): 396 files passed; the 2 other files (published-subpath-console.pin,published-subpath-hook-body.pin) refused becausepackages/cli/distwas not built yet. Afterpnpm --filter @objectstack/cli buildboth passed (2 files, 29 tests). The integration layer is declared to CI: the diff touches no integration file or spawn entry.pnpm --filter @objectstack/cli typecheck: exit 0.Acceptance notes
origin/mainonce before opening (1f5316d); the incoming commits touch nopackages/clifile.Verification
Derived gates (dispatch-gates --commands) — 62 families, all exit 0 on 1f5316d
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran ran.txt:: exit 0 — "62 derived famil(ies) accounted for — 62 run, 0 NOT-MEASURED".check-plugin-teardown-shape --self-test(shallow clone),check:dual-build-cjs-loadsandcheck:i18n-coverage(workspace packages not built). Aftergit fetch --unshallow origin mainand a fullturbo run build, all 3 reran with exit 0; the other 59 exited 0 on the first pass.eslintondiff.tsanddiff-upgrade-plan.test.ts:: exit 0 (repo-widepnpm lintis CI's).🤖 Generated with Claude Code
https://claude.ai/code/session_017ihL2bzGzPEiCJX3i1fYRj