Repository navigation
fix(cloud-connection): an install-local reseed over an intact baseline answers success with the skipped count - #21832
Conversation
…e answers success with the skipped count A reseed whose every declared seed record is already present wrote nothing because there was nothing to write, and answered 422 RESEED_NO_ROWS "The package declares no seedable records for this runtime" over a package that declares them. It now answers 200 with inserted, updated, skipped and errors; RESEED_NO_ROWS stays for a run whose records errored, and, with its text, for a run in which the loader processed no record for this runtime. Claude-Session: https://claude.ai/code/session_01RWZbGvPFcRKvUqASZtunCU Co-authored-by: Claude <noreply@anthropic.com>
…after a purge, and with no record for this runtime Claude-Session: https://claude.ai/code/session_01RWZbGvPFcRKvUqASZtunCU Co-authored-by: Claude <noreply@anthropic.com>
… away from bootStack's own environment Claude-Session: https://claude.ai/code/session_01RWZbGvPFcRKvUqASZtunCU Co-authored-by: Claude <noreply@anthropic.com>
…t baseline Claude-Session: https://claude.ai/code/session_01RWZbGvPFcRKvUqASZtunCU Co-authored-by: Claude <noreply@anthropic.com>
…seed-intact-baseline
📓 Docs Drift CheckThis PR changes 1 package(s): 1 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 — 3 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 565ca17573ff650bd2ccff95ca646e3b0049cbca && git checkout 565ca17573ff650bd2ccff95ca646e3b0049cbca
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6fb71152ca5cc7c71723f15eaf33bb3f8f7138e8 44436429616458bcccf3d2c9eabdb69328083a56 && git checkout -B drift-repro 6fb71152ca5cc7c71723f15eaf33bb3f8f7138e8 && git merge --no-ff 44436429616458bcccf3d2c9eabdb69328083a56
node scripts/docs-audit/affected-docs.mjs --json 6fb71152ca5cc7c71723f15eaf33bb3f8f7138e8
|
Contract reviewServed-tier: Inputs read, nothing else: card #21776 (body, comments ① Derived judgmentsAccept-set at
Public surface of Test changes, read against the diff: the unit file's 7 cases name the six accept-set rows above plus partial success; the two pre-existing assertions tightened from ② Semver levelChangeset The arm. Each changeset sentence against the diff:
Clause-②: yes (widening) — confirmed as the single arm; ③ Boundary flags
Implemented-by: Independence: INDEPENDENT AGENT VERDICT: PASS |
Fixes #21776
Clause-②: yes (widening)
An install-local reseed over sample rows that are all still in place now answers success with the loader's
skippedcount. Before, it answered422 RESEED_NO_ROWS"The package declares no seedable records for this runtime." over a package that declares 28 records. The fix implements triage5984295768. Dispatched by thedomain:cliseat (session_01RWZbGvPFcRKvUqASZtunCU), claim5989435782.What changed
handleReseedinpackages/cloud-connection/src/marketplace-install-local-plugin.ts(now at:1860) is the only runtime change.skippedfrom the seed summary besideinserted,updatedanderrors. A run with nothing written, no errors andskippedabove 0 is the intact baseline, and it answers200. The install's ledger record is set as it is when rows land (withSampleData: true,sampleDataPurged: false): the rows are present.422 RESEED_NO_ROWSwith the error count and first error. A run in which the loader processed no record still answers422 RESEED_NO_ROWSwith the existing text. Both keepdetails: { inserted, updated, errors }.No change to the purge, the listing, the rehydrate or the install route. No
packages/specpath. No new error code.Response shape, before and after (for the Clause-② declaration)
Measured on a real boot (showcase with the CRM example installed, 28 seed rows):
origin/main)422 {"success":false,"error":{"code":"RESEED_NO_ROWS","message":"Reseed wrote no rows. The package declares no seedable records for this runtime.","details":{"inserted":0,"updated":0,"errors":0}}}200 {"success":true,"data":{"manifestId":"com.example.crm","inserted":0,"updated":0,"skipped":28,"errors":0,"withSampleData":true}}200,data: { manifestId, inserted: 28, updated: 0, errors: 0, withSampleData: true }200,data: { manifestId, inserted: 28, updated: 0, skipped: 0, errors: 0, withSampleData: true }422 RESEED_NO_ROWS, existing text422 RESEED_NO_ROWSwith the error countThe before row for the intact baseline is the real-boot body that the ablation's mutated leg printed (below). The before success shape is read from
origin/mainsource. The door now accepts a request it refused, and the success body gainsskipped: widening,minorfor@objectstack/cloud-connection.Mechanism readings (the dispatch's assumptions, measured)
07bf21ff,handleReseedstarted at:1852and computedwrote = inserted + updated > 0. With zero errors it answered the "declares no seedable records" text, withdetails: { inserted, updated, errors }. It did not readskipped.skipped.runInlineSeedreturnsskipped: result.summary.totalSkipped, andapplySideEffectsspreads it intoseeded. No new source was needed. The install handler in the same file already countedskippedas "rows already in the database".inserted + updated + skipped + erroredagainst the records it processes for this runtime (SeedLoadResultin@objectstack/spec/data). Witherrorsat 0 andskippedat 0, it processed no record. Real cases: every dataset is scoped bySeed.envto another environment (pinned on a real boot), or every dataset declaresrecords: []. A package with NO seed dataset never reaches the loader. It answers400 RESEED_SKIPPED(no-datasets) before this branch, and that answer is unchanged (pinned at unit level).errorsabove 0 with nothing written keeps its answer, even when other records were skipped. Pinned withdetailsunchanged.Tests
All at head
44436429(after mergingorigin/main08adfead), unless noted.packages/cloud-connection/src/marketplace-install-local-reseed.test.ts, 7 cases. They cover the intact baseline (200, the whole payload, ledger flips), rows landing (skipped: 0), no record processed (422, code, status and the existing text), errors (422,detailsunchanged), errors beside skipped records (422, unchanged), no dataset (400 RESEED_SKIPPED) and partial success.pnpm --filter @objectstack/cloud-connection test: 39 files, 488 tests passed.typecheck(bothtscprograms) exit 0, and--listFilesshows the test file.packages/qa/dogfood/test/install-local-reseed-intact-baseline.dogfood.test.ts, 5 cases on two boots. (1) Intact baseline:200with{ inserted: 0, updated: 0, skipped: 28, errors: 0 }, and no row'supdated_atmoved. (2) After a purge:200withinserted: 28. (3) Every dataset scoped to another environment:422 RESEED_NO_ROWSwith the existing text, and no rows. Run together with the other three reseed-touching dogfood files (purge, listing, no-active-organization): 4 files, 25 tests passed. The dogfoodtsc --noEmitexit 0 lists the new file.dbf5e037. It usesscripts/ablation-replace.mjsin wrap mode with a trap restore. The mutation setintactBaselineto never true: the anchorskipped > 0;becameskipped less-than 0;. On disk the anchor went 1 to 0 and the blob changed. Thenpnpm --filter @objectstack/cloud-connection buildran, andablation-dist-preflightfound the marker indist/(2 built files). Results: unit 1 failed and 6 passed (the intact-baseline case:expected 422 to be 200). Dogfood 1 failed and 4 passed (the intact-baseline case, printing the before body above). Restore: blob equals HEAD andgit diff HEADis empty. After a rebuild, preflight--absentwas clean and the whole tree was clean. Unit 7 out of 7 and dogfood 5 out of 5 passed again. Direction: red, as predicted.Gates
At
44436429:node scripts/pm/dispatch-gates.mjs --commandsderived 67 families. All 67 ran, each exit 0, and--ranreconciles them as "67 derived, 67 run, 0 NOT-MEASURED (a DERIVED zero)". The dispatch named 49 of them, and the derivation added 18:check-adr-0087-registration(both),check-empty-changeset(both),release-rehearsal-clone --self-test,release-pending-publish --self-test, speccheck:empty-state/check:liveness/check:strictness-ledger/check:variant-docs,check:engine-double-contract,check:objectql-double-limit,check:objectui-changeset,check:pm-changeset-deadline-census,check:query-options-erasure,check:type-check-coverage,check:type-check-debtandcheck:where-matcher.check:dual-build-cjs-loadsfirst answered PREREQUISITE NOT MET (exit 3: 8 packages had nodist/). It is not counted as a run. After those 8 were built, it passed with exit 0. The fullpnpm lint(eslint . --no-inline-config) passed with exit 0 in 116 s.Acceptance notes
skippedis also the loader's answer for a record whose dataset declaresmode: 'update'when no row exists yet. A reseed of only such datasets over an empty table would now answer200withskippedabove 0 and recordwithSampleData: true. No example declaresmode: 'update'(git grepoverexamples/: 0 hits), so this is unexercised. Noted, not filed.RESEED_NO_ROWS(packages/spec/src/api/error-code-ledger.zod.ts:1038, "reseed ran but wrote nothing") is still true. The code is still emitted only for a run that wrote nothing. Untouched (domain:spec).handleList) had no PR when this branch last mergedorigin/main. This PR touches onlyhandleReseed.Out of scope, measured and not addressed here
A ledger entry whose
engines.protocol(^16) excludes this runtime (protocol 17) was booted on the showcase. The rehydrate refused it withOS_PROTOCOL_INCOMPATIBLE, and none of its objects were registered. Then:POST …/install-local/com.example.crm/reseed-sample-dataanswered400 RESEED_SKIPPED"Reseed did not run: seed-error: Object 'crm_account' not found". Before that refusal it loaded the package's translation bundle into the i18n service (2 locale loads). It also merged its 5 seed datasets into the kernel's sharedseed-datasetslist (0 to 5). There were 0 engine writes and no rows.POST …/purge-sample-dataanswered200 { deleted: 0, skipped: 0, errors: 28, withSampleData: false }and set the ledger'swithSampleDatafrom true to false. There were 0 engine writes.This is reported to the seat for filing.
Generated by Claude Code