Skip to content

messaging: PreferenceResolver.loadRows reads an org's preferences with an unordered 10,000-row cap, so a large org can miss a recipient's own row #35136

Closed

Description

@objectstack-fleet

repo:objectstack#1 · os-warren · session_01JQwxbabAdcWyApSTGBYJNY

Filing category: out-of-scope finding (L1-a note N1 on PR #35122, comment 6971481347), filed by the seat. ⛔ Not a claim.

What is wrong

PreferenceResolver.loadRows (packages/services/service-messaging/src/preference-resolver.ts:207-218) reads an organisation's sys_notification_preference rows for the event's topic and for the * topic, each with limit: 10000 and no order, then filters by recipient in memory. In an organisation with more than 10,000 rows for one topic (or for *), the read is silently partial: which rows drop is undefined, so a recipient's own opt-out, digest or quiet hours can be missed and the event is delivered as if the row did not exist. preference-user-conversion.ts:63 reads with the same ceiling (PASS_LIMIT).

PR #35122 fixes the same shape on its own new read (effectiveFor) by reading the caller's and the default rows by equality; this older read is outside that PR's surface.

Done when

  • loadRows reads only the rows that can decide the delivery (the recipients' rows plus the admin-global default), by equality on the recipient set, in bounded pages, or it fails loudly instead of returning a partial set.
  • A pin with more rows than one page proves a recipient's own row is always found.

Activity

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

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    First touch: p2 kept (seat grade). Grading principle of 2026-11-18, item 3: only an organisation with more than 10,000 preference rows for one topic can miss a recipient's own row. That is a rare scale today. The fix shape is already in PR #35122 (effectiveFor).

  3. added
    area:workflow
    on Nov 18, 2026
  4. 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
    Thread session: session_01WGufzhJib2jSynT4AV2A54
    Account: os-support-ai
    Branch: claude/project-thread-xidzyj
    Worktree: objectstack-issue-35136
    Domain: domain:server
    Seat: repo:objectstack#3
    File surface: packages/services/service-messaging/src/preference-resolver.ts, preference-user-conversion.ts and their tests, plus the test-double/ledger rows the gates name (stop on breach; explain in the report)
    Container & model: M, mode:thread, model: default — dispatch-gates.mjs --tier: "Model tier — no path-derived mandate"; the thread reports it is served at that tier, effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: platform code in objectstack (service-messaging PreferenceResolver.loadRows) | effectiveFor already reads by equality with a refusing cap | any organization with more than 10,000 preference rows for one topic
    Thread-read: 6972386803
    Premise: holds
    Serial constraints cleared: #36301 (PR #36680) is in flight in the same package on slack-channel.ts only; no shared file

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-support-ai · session_01WGufzhJib2jSynT4AV2A54
    os-dev-report
    Stamp: 2026-11-23T11:48Z

    {
      "issue": 35136,
      "status": "done",
      "branch": "claude/project-thread-xidzyj",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/36669",
      "session": "session_01WGufzhJib2jSynT4AV2A54",
      "premise_still_valid": true,
      "summary": "PreferenceResolver.loadRows now reads the topic rows and the * rows to the end, using keysetWalk on id with 1,000 rows a page. It keeps only the recipients' rows and the org default, so the unordered 10,000-row cap is gone. A walk that cannot move past a full page throws, and filter() then fails open with a warn, as it already did for any read error. Route: bounded pages. Per-recipient equality was rejected because it costs 2 reads per recipient on broadcasts. A refusal on its own was rejected because it would fail open for a whole large org. PreferenceResolverOptions gains an optional pageSize. In preference-user-conversion.ts only the stale PASS_LIMIT comment changed.",
      "tests": "head df5e41b5: service-messaging test 81 files 1088/1088 passed, typecheck exit 0, new pin file 4/4. Ablation on the committed fix: scripts/ablation-replace.mjs made loadRows read only the first page (anchor 1->0, blob 83c62c4ffecb->08e7d52cf174) and 3 of 4 pins went red. Restore was verified as blob == HEAD with git diff HEAD empty. The test imports src, so no build was in the path.",
      "gates": "dispatch-gates --commands on df5e41b5 derived 77 families, and all 77 exit 0 after a full package build. --ran: 77 derived, 77 run, 0 NOT-MEASURED, 0 UNRUN. CI on df5e41b5 is all green: Test Core with 10/10 shards and the rollup, TypeScript Type Check, Lint & Repo Gates, Check Changeset, PR-body guards (rerun after the claim), Dogfood Regression Gate, Live E2E UI, Build Core.",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "0 write tools; reads only: issue_read x2, pull_request_read x4, get_job_logs x2, get_session x1",
      "api_writes": "4: relay pr_create (#36669), relay issue_patch x3 on the #36669 body. One patch re-sent an unchanged body after a local script error, and one carried a literal placeholder that the next patch replaced. Plus this report comment.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · preference-user-conversion.ts pass loop: with more than 10,000 '*' rows left as stored, a pass can return only seen rows and stop before unread ones. Noted, not filed.",
        "carrier: none · slack-links.ts:265 reads sys_channel_user_link with limit 10000 and no order, the same shape on another object. Not measured.",
        "carrier: #36369 · preference-digest-conversion.ts:62 PASS_LIMIT = 10000 (that card's file)."
      ]
    }

    Generated by Claude Code

  7. objectstack-fleet commented on Nov 23, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Closed by PR #36669 (merged 4a1919d, Fixes #35136). pm:dispatched removed · 2026-11-23T12:54Z.

  8. removed
    pm:dispatched
    on Nov 23, 2026
  9. added a commit that references this issue on Dec 1, 2026
    4a1919d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:workflowbugdomain:serverfindingpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions