Skip to content

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

Closed

Description

@objectstack-fleet

repo:objectstack#4 · os-project-manager · session_01FEkQ5pb2t8Z8C64PkPyVt1

Follow-up of PR #36326 (#35123, ruling B 7073270426), carried from contract review 7076382062. Filed under the maintainer's 2026-11-22 07:49Z rule that should-fix items go to their own card.

S1 (should-fix). packages/services/service-messaging/src/preference-digest-conversion.ts: the one-time conversion of legacy digest none to unset re-reads where: { digest: 'none' } after each batch, and its compare-and-set only checks that the row still holds none. During the boot pass, a row that newly holds none (a new row with an explicit none, a member re-picking none, or a write from a not-yet-upgraded node in a rolling deploy) is also rewritten to unset, which ruling B item 4 forbids (from then on none is a member's real choice). The window is the length of the boot pass. Fix suggested by the review: take the id set before the ledger claim and rewrite only that snapshot, paging by an id cursor instead of re-reading the filter. This also covers the case where the claim fails after the read and the next boot converts a none written in between.

Also on this card (optional, from the same review):

  • The Notification Settings page has no "follow the organization again" action for digest or quiet hours; once a member saves either from the page they cannot return to following the organization from the page (the Setup grid can clear the field). Visible behaviour: the seat decides whether to add it.
  • QUIET_HOURS_OFF is spelled in both preference-resolver.ts and ui/…/myPreferences.ts with no pin tying them together.

Done when: S1 converts only the pre-claim snapshot, pinned by a test that writes none during the pass and sees it survive (ablation red); the optional items are either done or split off.

Activity

  1. added
    priority:p2
    pm:queue
    domain:server
    on Nov 22, 2026
  2. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server (service-messaging/src/preference-digest-conversion.ts) · pm:queue; rationale: area:workflow (it had no area) · Bug · the one-time conversion of legacy digest none to unset re-reads digest: none after each batch, so a row newly set to none during the boot pass (an explicit off under ruling B) can be rewritten to unset: a user's choice is silently undone in a race window. Follow-up of #35123 → p2 as filed · size S. Linked under topic #36240.

  3. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server (service-messaging/src/preference-digest-conversion.ts) · pm:queue; rationale: area:workflow (it had no area) · Bug · the one-time conversion of legacy digest none to unset re-reads digest: none after each batch, so a row newly set to none during the boot pass (an explicit off under ruling B) can be rewritten to unset: a user's choice is silently undone in a race window. Follow-up of #35123 → p2 as filed · size S. Linked under topic #36240.

  4. added
    area:workflow
    on Nov 22, 2026
  5. objectstack-fleet commented on Nov 23, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim: PM loop round 1
    Session: session_01WGufzi4PechTRCTBrfxV8W
    Account: os-support-ai
    Branch: claude/issue-36369-digest-snapshot
    Worktree: objectstack-issue-36369
    Domain: domain:server
    Seat: repo:objectstack#3
    File surface: packages/services/service-messaging/src/preference-digest-conversion.ts and its test (stop on breach; explain in the report)
    Container & model: S, mode:subagent, model: default — dispatch-gates.mjs --tier: "Model tier — no path-derived mandate", effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: platform code in objectstack (service-messaging preference-digest-conversion.ts) | none | any member or node writing digest none during the boot pass of an upgrade
    Thread-read: 7076805426
    Premise: holds
    Serial constraints cleared: #35136 (PR #36669) in flight in the same package on preference-resolver.ts only; no shared file
    Ruling-ref: 7073270426 on #35123 (ruling B, item 4: a none written after the conversion is a member's real choice). Scope: S1 only; the two optional items are split off, the seat decides them.

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 23, 2026
  7. objectstack-fleet commented on Nov 23, 2026

    @objectstack-fleet
    ContributorAuthor

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

    {
      "issue": 36369,
      "status": "done",
      "branch": "claude/issue-36369-digest-snapshot",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/36694",
      "pr_number": 36694,
      "head_sha": "6bd074ceffaca9a695f39b7934767e5fd51263e3",
      "session": "session_01WGufzi4PechTRCTBrfxV8W",
      "premise_still_valid": true,
      "premise_readings": "origin/main 6a731859: preference-digest-conversion.ts:158 readLegacy find with limit PASS_LIMIT=10000 (:62), re-called at :242 inside for(;;) at :213; CAS at :224-228 where { id, digest: 'none' }; first read :170 precedes the ledger insert :186-188 but the loop re-reads after the claim. All three PM assumptions hold. Card side-claim that the snapshot 'also covers' a claim failing then the next boot converting a none written in between: holds only within one boot; across boots it cannot be closed (nothing can be recorded when the ledger write is what failed); stated in PR Acceptance notes and the module docblock.",
      "summary": "convertLegacyNoneDigestsOnce now reads the ids (and organization) of every digest='none' row before its sys_migration claim, paging by id cursor (id $gt last, orderBy id asc, page 10000), then rewrites exactly that snapshot with the unchanged compare-and-set; the re-read loop, its seen set and its post-claim re-read failure branch are removed, so any page failure is read-failed before the claim. Four new pins on the real ObjectQL/SqlDriver database: a none written during the pass (new row + daily switched to none) survives; multi-page snapshot (pageSize 2, 5 rows); claim refused after the read rewrites nothing and leaves no record; a concurrent node's claim between read and claim answers already-run. Ruling 7073270426 item 4 quoted in the PR body; optional items split off under Acceptance notes.",
      "files_changed": [
        "packages/services/service-messaging/src/preference-digest-conversion.ts (+85/-60)",
        "packages/services/service-messaging/src/preference-digest-three-states.integration.test.ts (+97/-1)",
        ".changeset/36369-digest-conversion-snapshot.md (+12, new, patch)"
      ],
      "line_budget": "251 changed lines (+190/-61, 3 files) vs the 3000 human-merge threshold: under (dispatch-gates reading at 6bd074ce); no skills/** touched",
      "tests": "head 6bd074ce. pnpm --filter '@objectstack/service-messaging^...' build: lock VERDICT command-exit 0. pnpm --filter @objectstack/service-messaging test: Test Files 80 passed (80), Tests 1088 passed (1088); typecheck (tsc --noEmit x2): exit 0; lock VERDICT command-exit 0. Target file: 9 passed (9). Ablation 1 (scripts/ablation-replace.mjs, re-read generator in place of the snapshot loop; blob 7ad5cf7fdbdf to cfc30aecaf87): 'a none written during the pass' FAILED converted expected 1 received 3, 1 failed/8 passed; restored blob == HEAD, git diff HEAD empty. Ablation 2 (short-page test removed, one page only): paging pin FAILED converted expected 5 received 2; restored blob == HEAD. Subject imported from source (relative path), so no dist leg. test:repo not run locally (diff does not touch it), CI Test Core owns it.",
      "gates": "local: dispatch-gates --commands (6bd074ce) derived 67; 63 exit 0; 4 exit 3 PREREQUISITE NOT MET = NOT MEASURED (check-plugin-teardown-shape --self-test: shallow clone; check:dual-build-cjs-loads and check:published-readme-exports: need full dist; check:i18n: needs built CLI). dispatch-gates --ran (exit codes recorded): '67 derived famil(ies) accounted for — 63 run, 4 NOT-MEASURED', exit 0. CI on PR 36694 at 6bd074ce: 23 check-runs started, all in_progress/queued or skipped by design at report time (Lint & Repo Gates lanes, Type Check lanes, Governed Surface Queue Guard, Check Changeset, Check PR Size, PR-body guards); mergeable_state blocked (pending required checks), not dirty.",
      "dogfood_battery": "n/a — no ! in the PR title and Clause-② no without a (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "3 — git push (branch, 4 pushes; not REST), relay pr_create via fleet-write dispatch (POST /repos/objectstack-ai/objectstack/dispatches, run 45170235901, created PR 36694 + assignees leg os-support-ai), post-stamped os-dev-report comment on issue 36369",
      "deviations": [
        ".changeset/36369-digest-conversion-snapshot.md is outside the order's file surface (code + its test): AGENTS Post-Task step 3 requires a patch changeset for a fix in a published package (service-messaging dist changes).",
        "Branch not merged with origin/main before opening (2 commits behind; neither touches service-messaging or the changeset).",
        "4 derived gates NOT MEASURED locally (prerequisites: unshallow clone, full workspace build, built CLI); declared narrowing, CI Lint & Repo Gates runs them.",
        "Harness commit-attribution reminder named a model in Co-Authored-By; commits use the model-free pair per AGENTS.md and the standard order."
      ],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: seat (split off, seat decides) · Notification Settings page has no 'follow the organization again' action for digest or quiet hours (card optional item 1) · noted in PR Acceptance notes, not filed",
        "carrier: seat (split off, seat decides) · QUIET_HOURS_OFF spelled in preference-resolver.ts and ui myPreferences.ts with no pin tying them (card optional item 2) · noted in PR Acceptance notes, not filed",
        "carrier: seat · a claim-failed boot followed by a next boot converts a none written between them; unclosable without a durable record because the ledger write is what failed; logged at error; noted in PR Acceptance notes and module docblock, not filed"
      ]
    }
  8. objectstack-fleet commented on Nov 23, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Closed by PR #36694 (merged 0ab9b15, Fixes #36369). Optional items filed as #36701 and #36702. pm:dispatched removed · 2026-11-23T13:24Z.

  9. removed
    pm:dispatched
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:workflowdomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions