Repository navigation
fix(messaging): the one-time digest conversion rewrites only rows that held none before its claim - #36694
Conversation
…shot it read before its claim The pass now reads the ids of every row holding digest 'none' in pages by id cursor before claiming its sys_migration row, then rewrites exactly that snapshot. It no longer re-reads where digest = 'none' after each batch, so a 'none' written during the boot pass is a member's real choice and survives. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi4PechTRCTBrfxV8W
… survives it Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi4PechTRCTBrfxV8W
…napshot Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi4PechTRCTBrfxV8W
📓 Docs Drift CheckThis PR changes 1 package(s): 22 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 6 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 43080ba718e315f55dca44f592bd88cb92558dd3 && git checkout 43080ba718e315f55dca44f592bd88cb92558dd3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c1e6cf75a757a7e9102bae608ddb020135619882 6bd074ceffaca9a695f39b7934767e5fd51263e3 && git checkout -B drift-repro c1e6cf75a757a7e9102bae608ddb020135619882 && git merge --no-ff 6bd074ceffaca9a695f39b7934767e5fd51263e3
node scripts/docs-audit/affected-docs.mjs --json c1e6cf75a757a7e9102bae608ddb020135619882
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W 席位核对 — ACCEPT · repo:objectstack#3 · head 6bd074c · 2026-11-23T12:42Z
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W Landing · 2026-11-23T12:44Z · ACCEPT 7101525096 at head 6bd074c
State: ready + auto-merge (Tier S). On MERGED, #36369 closes by |
Requested by Yibo Wang · project thread
Fixes #36369
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
packages/services/service-messaging/src/preference-digest-conversion.ts(the one-time conversion of the legacy digestnoneto empty, ruling 7073270426 on #35123, item 4):digest = 'none'first, in pages by id cursor (id > last,orderBy id asc, page size 10000), then claims itssys_migrationrow, then rewrites exactly that snapshot with the same compare-and-set as before (where: { id, digest: 'none' }, the row's own organization threaded).where: { digest: 'none' }after each batch (and theseenset that ended it) is gone, and so is its "re-reading failed after the claim" branch: a failure on any page of the snapshot now happens before the claim and answersread-failed, so the next boot retries with nothing recorded.{ pageSize }(module-internal; the function is not exported from the package entry) lets the pin exercise more than one page.Ruling text relied on (item 4):
The deployment serves while the boot hook runs, so a
nonewritten during the pass is written under the fixed release.Read first (by risk)
preference-digest-conversion.ts—readSnapshot(cursor paging; the missing-table answer applies to the first page only) and the rewrite loop that now iterates the snapshot once.preference-digest-three-states.integration.test.ts—interceptOnceand the "a none written during the pass" pin..changeset/36369-digest-conversion-snapshot.md.Tests
New pins in
preference-digest-three-states.integration.test.ts(realObjectQL+SqlDriverbetter-sqlite3 file database that an earlier release created):nonewritten during the pass (a new row with an explicitnone, and adailyrow switched tonone) survives it; only the pre-claim row is rewritten (converted: 1);pageSize: 2are all converted;claim-failed, logs one error, rewrites nothing and leaves no ledger row;already-runand this pass rewrites nothing.All readings at head
6bd074ce, afterpnpm --filter '@objectstack/service-messaging^...' build(lock VERDICT command-exit 0).Package test and typecheck
pnpm --filter @objectstack/service-messaging test: Test Files 80 passed (80), Tests 1088 passed (1088).pnpm --filter @objectstack/service-messaging typecheck(tsc --noEmit && tsc --noEmit -p tsconfig.scripts.json): exit 0.os-verify-lock.sh: VERDICT command-exit 0.test:reponot run locally (diff does not touch that project); CITest Coreruns it.Ablations (one-shot, through scripts/ablation-replace.mjs; the test imports the module from source, so no dist leg)
digest = 'none'after the snapshot and yields ids not yet seen (the pre-fix shape). Mutation landed (anchor 1 to 0, blob 7ad5cf7fdbdf to cfc30aecaf87). Result: "a none written during the pass is not rewritten" FAILED,convertedexpected 1, received 3; Tests 1 failed, 8 passed. Restored: blob == HEAD,git diff HEADempty.return snapshot;deleted, so the read stops after the first page. Result: "reads the snapshot in pages by id" FAILED,convertedexpected 5, received 2; Tests 1 failed, 8 passed. Restored: blob == HEAD,git diff HEADempty.Acceptance notes
QUIET_HOURS_OFFis spelled in bothpreference-resolver.tsand the UImyPreferences.tswith no pin tying them together (optional item 2 of the card).nonewritten between those two boots is converted with the rest. The card reads the snapshot as covering this case; it covers the claim-fails-after-the-read case only within one boot (pinned above). The failure is logged aterrornaming the fix. A row that held the legacynonein the snapshot and is re-set tononeby its member before its own rewrite is indistinguishable from the legacy value and is converted; that window is the time between the snapshot and that row's update.Verification
Two-minute check:
pnpm --filter @objectstack/service-messaging exec vitest run src/preference-digest-three-states.integration.test.ts— expect 9 passed, including "a none written during the pass is not rewritten: only the rows read before the claim are".Local gates (dispatch-gates --commands, derived at 6bd074c)
Lint & Repo Gatesruns them on a full build):node scripts/check-plugin-teardown-shape.mjs --self-test(needs an unshallow clone);pnpm check:dual-build-cjs-loadsandpnpm check:published-readme-exports(need every package's dist);pnpm check:i18n(needs the built CLI).dispatch-gates --ranwith exit codes recorded: "67 derived famil(ies) accounted for — 63 run, 4 NOT-MEASURED", exit 0.origin/main; neither touchesservice-messagingor.changeset/36369*, so no merge before opening.Generated by Claude Code