Skip to content

driver-sql: a plain $in compiles to one unbounded whereIn, so a read binding more than 1,000 ids fails on Oracle (ORA-01795) and past 2,100 parameters on SQL Server #39312

Todo

Description

@objectstack-fleet

repo:objectstack@os-bill · os-bill · session_01Utp6Ca2yTZZiHWkyVgD2oK

立卡门类别:① 评审发现的缺陷(PR #39309 的 L1 评审;os-dev 报告 7376678770 范围外第 1 条)。Source: #39297
Related: #39297 (the record-page reaction read chunks for itself) · not part of topic #39077 (a driver-wide defect)
定级:area:data · Bug · priority:p3 · size M · reach: Oracle or SQL Server deployments, any read that binds a long id list without chunking · evidence: read (code), not measured on those drivers

维护者速读

  • SQL 驱动把一个 $in 条件原样变成一个 IN 列表,不分批。
  • Oracle 超过 1000 个、SQL Server 超过约 2100 个参数就会报错;有些调用方自己分了批,有些没有(评论表情权限、共享规则等)。
  • 修法由开发定:驱动里统一分批,或规定调用方必须分批并加门禁。

Scope and acceptance

packages/drivers/driver-sql/src/sql-driver-filter-helpers.ts (the case '$in' / '$nin' arms) hands a literal list straight to knex whereIn. Nothing in driver-sql/src splits it, although the package declares oracledb and tedious peers. Oracle refuses an IN list of more than 1,000 expressions, and SQL Server a request of more than 2,100 parameters. Several callers chunk for themselves: RECORD_SCOPED_DELETE_CHUNK = 200, SharingRuleService 200, closed-state-lock IN_CHUNK = 500, SUMMARY_GROUPED_AGGREGATE_CHUNK = 500, and the record-page reactions after #39309. Callers that do not chunk meet the ceiling, for example:

  • the comment reaction read gate (computeReactionVisibilityFilter, comment-access-hooks.ts), whose comment_id $in kept can carry up to READ_SCAN_LIMIT = 2,000 ids on a broad reaction read;
  • sharing's owner_id $in ownerIds under unit / unit_and_below scopes;
  • the sys_comment thread gate, one ReadableIds branch per registered parent object, whose total parameter count G is unmeasured.

Direction is the builder's call. One option is driver-side splitting into OR-ed groups below 1,000 for Oracle, with a parameter ceiling (or a typed refusal) for MSSQL. The other is a documented per-caller contract plus a gate. Either way, measure G on MSSQL.

  • Acceptance: a driver-sql (or gate) test shows a $in of more than 1,000 ids answered correctly (or refused with a typed error naming the ceiling) and goes red without the fix; the thread gate's parameter count on SQL Server is measured and recorded.
  • Clause-②: no (expected) · Metadata-protocol: none.

Dedupe: driver-sql whereIn IN list limit, ORA-01795, bind parameters 2100, $in chunking driver (open issues) → only #39297.

Activity

  1. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:data · domain:data · Bug · p3 · pm:queue · size M, touched 2026-12-03T12:12Z. Rationale: the filer's grade stands. A driver-wide unbounded whereIn fails reads binding long id lists, but only on Oracle and SQL Server. It is related to #39297 but not folded with it: #39297 chunks its own read, and this card is the driver-level rule. The developer chooses between chunking in the driver and a caller gate.
    Grade: area:data · Bug · p3 · Oracle and SQL Server deployments, unchunked long-$in callers · read (code).

  2. added
    pm:queue
    on Dec 3, 2026
  3. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-bill · os-bill · session_01Utp6CaJjkQx5fPE4Fbmoeq

    Claim: PM loop round 2 · 2026-12-03T14:24Z
    Session: session_01Utp6CaJjkQx5fPE4Fbmoeq
    Account: os-bill
    Branch: claude/issue-39312-driver-sql-in-chunk
    Worktree: objectstack-issue-39312
    Domain: domain:data
    Seat: repo:objectstack@os-bill
    Area: data-1203
    File surface: packages/drivers/driver-sql/src/sql-driver-filter-helpers.ts, a pin test in packages/drivers/driver-sql/src/ (reason: a $in / $nin of more than 1,000 ids answered correctly or refused with a typed error naming the ceiling), a patch changeset. A gate or caller-side change is named in the report before widening; stop on any other breach.
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier at 850d240b: no path-derived mandate), effort: high (reason: the dev chooses driver-side splitting vs a caller contract and measures the parameter count)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: sql-driver-filter-helpers.ts $in / $nin arms in objectstack driver-sql; callers chunk for themselves in places, no platform path covers the rest; Oracle and SQL Server deployments on any unchunked long id list, today.
    Thread-read: 7377817332
    Premise: holds — the card's reading of the $in arm handing a literal list to knex whereIn is the dev's first re-read on origin/main 850d240.
    Pre-claim lane: domain:data (driver-sql); the seat keeps it.
    Pre-claim deps: none open (#39297 is related, not blocking).
    Prior rulings read: thread 0 rulings; the card leaves the direction to the builder.
    Serial constraints cleared: check-handover.mjs --inflight --card=39312 → no overlap read (#38415, #35238 name no path; neither on driver-sql).

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 3, 2026
  5. objectstack-fleet commented on Dec 5, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

    Release: 2026-12-05T00:34Z · session session_01Utp6CaQsbKBMQtm6Tpsamd releases claim 7381406615 · because the maintainer hands this half-done card to the seat repo:objectstack@os-elon-musk (mailbox #39411) · into pm:queue, assignee cleared, for that seat to re-claim.
    Resume-from: claude/issue-39312-driver-sql-in-chunk@ca39fab3
    Source: the maintainer (Bill), project chat of seat repo:objectstack@os-bill, 2026-12-05T00:26Z: 「你开发了一半的卡和 pr都交接给 elon,没处理的放回对立额,然后你就可以下班了」 (对立额 = 队列).

    • Done: one commit, "fix(driver-sql): split a long $in/$nin list on Oracle, refuse one past SQL Server's parameter limit".
    • Left: the readings, the draft PR with Fixes #39312, L1.
  6. added
    pm:queue
    and removed
    pm:dispatched
    on Dec 5, 2026
  7. objectstack-fleet commented on Dec 5, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj

    Claim: PM loop round 3 (zone em-bill takeover) · 2026-12-05T00:58Z · re-claims after os-bill's Release 7428398914; source: the maintainer (Elon), on the seat's card, 2026-12-05T00:48Z: 「接手,由 em-bill 专区做完」; os-bill's split knock 7428503319 on #39411 leaves this card.
    Session: session_016WV4cwiNRyb9B38wT2fjYj
    Account: os-elon-musk
    Branch: claude/issue-39312-wip
    Worktree: objectstack-issue-39312
    Domain: domain:data
    Seat: repo:objectstack@os-elon-musk
    Area: em-bill
    File surface: packages/drivers/driver-sql/src/sql-driver-filter-helpers.ts, a pin test in packages/drivers/driver-sql/src/ (reason: a $in / $nin of more than 1,000 ids answered correctly or refused with a typed error naming the ceiling), a patch changeset. A gate or caller-side change is named in the report before widening; stop on any other breach.
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier at 56bed066: no path-derived mandate), effort: high (reason: the dev measures the parameter ceiling per dialect; one commit pushed)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: sql-driver-filter-helpers.ts $in / $nin arms in objectstack driver-sql; callers chunk for themselves in places, no platform path covers the rest; Oracle and SQL Server deployments on any unchunked long id list, today.
    Thread-read: 7428398914
    Premise: holds — the card's reading of the $in arm handing a literal list to knex whereIn is the dev's first re-read on origin/main 850d240. Re-read by the dev at origin/main 56bed06 after merging main into the resumed branch.
    Pre-claim lane: domain:data (driver-sql); the seat keeps it.
    Pre-claim deps: none open (#39297 is related, not blocking).
    Prior rulings read: thread 0 rulings; the card leaves the direction to the builder.
    Serial constraints cleared: check-handover.mjs --inflight --card=39312 at 56bed06 → NO OVERLAP READ; the one unread surface is #38710 (os-tesla, knowledge segmenter in knowledge-turso/pgvector), read by hand: none of these files. The dev runs overlap-check.mjs before each push.
    Resume-from: claude/issue-39312-driver-sql-in-chunk@ca39fab3

  8. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:datadomain:datapm:dispatchedpriority:p3

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions