Skip to content

fix(messaging): the one-time digest conversion rewrites only rows that held none before its claim - #36694

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36369-digest-snapshot
Nov 23, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36369-digest-snapshot

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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 digest none to empty, ruling 7073270426 on #35123, item 4):

  • Snapshot before the claim. The pass reads the ids (and organization) of every row holding digest = 'none' first, in pages by id cursor (id > last, orderBy id asc, page size 10000), then claims its sys_migration row, then rewrites exactly that snapshot with the same compare-and-set as before (where: { id, digest: 'none' }, the row's own organization threaded).
  • No re-read. The loop that re-read where: { digest: 'none' } after each batch (and the seen set 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 answers read-failed, so the next boot retries with nothing recorded.
  • An optional third parameter { 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 conversion must not run again after the fix is live: from then on none is a member's real choice.

The deployment serves while the boot hook runs, so a none written during the pass is written under the fixed release.

Read first (by risk)

  1. 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.
  2. preference-digest-three-states.integration.test.ts — interceptOnce and the "a none written during the pass" pin.
  3. .changeset/36369-digest-conversion-snapshot.md.

Tests

New pins in preference-digest-three-states.integration.test.ts (real ObjectQL + SqlDriver better-sqlite3 file database that an earlier release created):

  • a none written during the pass (a new row with an explicit none, and a daily row switched to none) survives it; only the pre-claim row is rewritten (converted: 1);
  • the snapshot is read in pages by id: five legacy rows across two organizations with pageSize: 2 are all converted;
  • a claim that fails after the read (ledger insert refused) answers claim-failed, logs one error, rewrites nothing and leaves no ledger row;
  • another node claiming between the read and the claim answers already-run and this pass rewrites nothing.

All readings at head 6bd074ce, after pnpm --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.
  • Both under os-verify-lock.sh: VERDICT command-exit 0.
  • test:repo not run locally (diff does not touch that project); CI Test Core runs it.
Ablations (one-shot, through scripts/ablation-replace.mjs; the test imports the module from source, so no dist leg)
  1. Re-read reintroduced: the snapshot loop replaced by a generator that re-reads 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, converted expected 1, received 3; Tests 1 failed, 8 passed. Restored: blob == HEAD, git diff HEAD empty.
  2. One page only: the short-page test before return snapshot; deleted, so the read stops after the first page. Result: "reads the snapshot in pages by id" FAILED, converted expected 5, received 2; Tests 1 failed, 8 passed. Restored: blob == HEAD, git diff HEAD empty.

Acceptance notes

  • Split off — seat decides: the Notification Settings page has no "follow the organization again" action for digest or quiet hours (optional item 1 of the card).
  • Split off — seat decides: QUIET_HOURS_OFF is spelled in both preference-resolver.ts and the UI myPreferences.ts with no pin tying them together (optional item 2 of the card).
  • What the snapshot does not close (by construction). When the claim fails, nothing is rewritten and nothing can be recorded (the ledger is the thing that failed), so the next boot takes a new snapshot and a none written 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 at error naming the fix. A row that held the legacy none in the snapshot and is re-set to none by 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)
  • 67 derived commands: 63 exit 0; 4 exit 3 (PREREQUISITE NOT MET, read as NOT MEASURED, CI's Lint & Repo Gates runs them on a full build):
    • node scripts/check-plugin-teardown-shape.mjs --self-test (needs an unshallow clone);
    • pnpm check:dual-build-cjs-loads and pnpm check:published-readme-exports (need every package's dist);
    • pnpm check:i18n (needs the built CLI).
  • dispatch-gates --ran with exit codes recorded: "67 derived famil(ies) accounted for — 63 run, 4 NOT-MEASURED", exit 0.
  • Branch is 2 commits behind origin/main; neither touches service-messaging or .changeset/36369*, so no merge before opening.

Generated by Claude Code

…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
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-messaging, touching 8 documentable anchor(s).

22 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json c1e6cf75a757a7e9102bae608ddb020135619882.

⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: organization_id (literal, 41 pages)
  • the SDK route bridge reached 68 of 251 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json c1e6cf75a757a7e9102bae608ddb020135619882 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 43080ba718e315f55dca44f592bd88cb92558dd3 — the merge of head 6bd074ceffaca9a695f39b7934767e5fd51263e3 into base c1e6cf75a757a7e9102bae608ddb020135619882, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs c1e6cf75a757a7e9102bae608ddb020135619882 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

席位核对 — ACCEPT · repo:objectstack#3 · head 6bd074c · 2026-11-23T12:42Z

  • Card fit (fix(messaging): the one-time digest conversion rewrites only rows that held none before its claim (follow-up of #36326) #36369 S1): readSnapshot pages digest = 'none' by id cursor (id > last, orderBy id asc) before the sys_migration claim; the rewrite loop iterates that snapshot once with the same compare-and-set (where: { id, digest: 'none' }, row's own organization). The post-batch re-read and its seen set are gone, so a none written during the pass is never read. A failure on any snapshot page answers read-failed before the claim (nothing recorded, next boot retries). Matches ruling 7073270426 item 4.
  • Pins and ablations: "a none written during the pass is not rewritten" (new explicit none row and a daily row switched to none survive; converted: 1), multi-page snapshot (pageSize: 2, 5 rows, 2 orgs), claim fails after the read, another node claims first. Ablation 1 (re-read restored) turned the first pin red (expected 1, received 3); ablation 2 (one page only) turned the paging pin red (expected 5, received 2); both restored to HEAD.
  • Shape: Fixes #36369, changeset for @objectstack/service-messaging, Clause-②: no · Metadata-protocol: none (l1-face.mjs --pr 36694 CLEAN). The new PreferenceDigestConversionOptions is module-exported only; seat read src/index.ts at this head: no export of preference-digest-conversion, so no holds. Changeset read sentence by sentence; it matches the diff.
  • Gates: 37 success · 16 expected skip · 0 failed · 0 pending at 6bd074c (Test Core 10/10 went green on its one rerun; the failing case on attempt 1 was the plugin-auth forced-reset OAuth test tracked on test(plugin-auth): the forced-reset OAuth test stamps its grant one whole second ahead and turns red when the call takes longer #36361, outside this diff).
  • Accepted deviation, stated in the body: a claim that fails leaves the next boot to take a new snapshot, so a none written between those two boots is converted. Nothing can record the earlier snapshot when the ledger write itself failed; the failure is logged at error naming the fix. The card's "also covers" sentence is read as covering the within-boot case only, which is pinned.
  • Optional items, split off (card's done-when allows it): (1) the Notification Settings page has no "follow the organization again" action for digest or quiet hours; (2) QUIET_HOURS_OFF is spelled in preference-resolver.ts and the UI myPreferences.ts with no pin tying them. Both go to triage as follow-up filings on pm:mailbox — triage#1 · hotlong #32588; neither is done here.
  • Landing: check-governed-merges.mjs --pr 36694: NOT governed, +190/-61. landing-k.mjs: K = 5. Tier S: ready + auto-merge by the seat.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

Landing · 2026-11-23T12:44Z · ACCEPT 7101525096 at head 6bd074c

reading value
check-governed-merges.mjs --pr 36694 NOT governed · +190/-61
landing-k.mjs --pr 36694 K = 5 < 15 · ok
checks at 6bd074c 37 success, 0 failed, 0 pending

State: ready + auto-merge (Tier S). On MERGED, #36369 closes by Fixes; the seat removes pm:dispatched. Optional items filed to triage on #32588.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(messaging): the one-time digest conversion rewrites only rows that held none before its claim (follow-up of #36326)

2 participants