Skip to content

Record page discussion: the reaction read binds every comment id in one $in, past Oracle's 1000-item IN list and SQL Server's 2100 parameters #39297

Description

@objectstack-fleet

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

立卡门类别:① 评审发现的同族缺陷(PR #39294 的 L1 评审;os-dev 报告 7373334709 范围外第 2 条)。Source: #39271
Part of #39077 · family of #39253 and #39271
定级:area:data · Bug · priority:p3 · reach: the record page payload on an Oracle or SQL Server deployment, for a record with more than about 1000 (Oracle) / 2100 (SQL Server) comments · evidence: read (code), not measured against those drivers

维护者速读

  • 记录页读表情回应时,把这条记录所有评论的 id 一次性放进一个查询条件里。
  • 评论很多(上千条)时,Oracle / SQL Server 会拒绝这种查询,表情回应就不显示了(评论本身还在)。
  • 修法:分批读,再按时间合并。

Scope and acceptance

  • Today (after fix(rest): serve the record page discussion whole past the data page size #39294): answerDiscussion in packages/rest/src/record-page-routes.ts reads sys_comment_reaction with one comment_id $in [every comment id of the thread], re-sent on each page (find and count). Before fix(rest): serve the record page discussion whole past the data page size #39294 the list was bounded by the deployment's page size on page-size deployments; now it is bounded only by the row budget, or not at all.
  • packages/driver-sql declares oracledb and tedious peers. Oracle caps an IN list at 1000 expressions (ORA-01795); SQL Server caps bind parameters at 2100. No whereIn chunking was found in driver-sql/src.
  • Effect: the reaction read fails; it lands in the reactions refusal arm and the comments are still answered (graceful, not a blocker).
  • Direction: read the reactions in id chunks (bounded below both limits) and merge by created_at, id, so the spec's single oldest-first order holds. Whether chunking belongs in the route or in driver-sql's $in translation is the builder's call; say which in the PR.
  • Acceptance: a REST test with a chunk size forced small shows every reaction answered once, in order, and goes red without the fix.
  • Clause-②: no (expected) · Metadata-protocol: none.

Dedupe: comment_id $in reactions, bind parameter IN list chunk (open issues) → none.

Activity

  1. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:data · domain:rest · Bug · p3 · pm:queue · size S, touched 2026-12-03T10:14Z. Rationale: the filer's grade stands. The reaction read binds every comment id in one $in, so Oracle or SQL Server refuses it past about 1000 or 2100 comments. The failure is graceful: comments still answer, reactions are refused. It lands under epic #39077, and the fix is in answerDiscussion (packages/rest).
    Grade: area:data · Bug · p3 · Oracle and SQL Server deployments, records past about 1000 comments · read (code), not measured on those drivers.

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

    @objectstack-fleet
    ContributorAuthor

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

    Triage: first-touch audit (lane self-triage, case ②: filed by this zone and kept in it; area, type, grade and size touched here, about one hour after filing — the filing stroke set area and grade, this one adds type and the audit) · area:data · Bug · p3 · size S · no domain:* written here (triage's; the fix is packages/rest/src/record-page-routes.ts or packages/driver-sql).
    Ruling-ref: .claude/skills/pm-dispatch/references/triage-duties.md self-triage case ②, verbatim: 「自立且留本车道卡,立卡同轮首触 area、type、级(filing-gate.md)、size 与审计」
    Grade: area:data · Bug · Impeded (reactions missing; comments still answered through the declared refusal arm) · rare configuration (Oracle or SQL Server driver and a thread past about 1000 / 2100 comments) · read (code) ⇒ p3. Stays a sub-issue of topic #39077.
    Review: triage

  4. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim: PM loop, zone comments-39077 of seat repo:objectstack@os-bill (topic #39077; the maintainer's word 2026-12-02 21:55Z 「接手过来的 os-support-ai 的任务和专题不分优先级都要处理」)
    Area: comments-39077
    Session: session_01Utp6Ca2yTZZiHWkyVgD2oK
    Account: os-bill
    Branch: claude/issue-39297-reaction-read-chunks
    Worktree: objectstack-issue-39297
    Domain: domain:server
    Seat: repo:objectstack@os-bill
    File surface: packages/rest/src/record-page-routes.ts; packages/rest/src/record-page-routes.test.ts; a changeset. Chunking in the route (bounded below Oracle's 1000-item IN list and SQL Server's 2100 parameters), merged by created_at, id. Moving the fix into the SQL driver package or any change under the spec package ⇒ stop and report.
    Container & model: S, mode:subagent, model: TIER_DEFAULT (dispatch-gates --tier prints no path-derived mandate), effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: this repo's own code (packages/rest, objectstack): answerDiscussion binds every comment id of the thread in one comment_id $in | no platform path covers it | record page payload on Oracle / SQL Server deployments with long threads; reachable today
    Thread-read: 7375030135
    Premise: holds on main 777da7f by the L1 trace on PR #39294 (ACCEPT 7374043559); the dev re-reads first.
    Serial constraints cleared: check-handover.mjs --inflight → NO OVERLAP READ; PR #39294 (same file) merged 2026-12-03 10:10Z.

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

    @objectstack-fleet
    ContributorAuthor

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

    {
      "issue": 39297,
      "status": "done",
      "branch": "claude/issue-39297-reaction-read-chunks",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39309",
      "session": "session_01Utp6Ca2yTZZiHWkyVgD2oK",
      "premise_still_valid": true,
      "summary": "Premise held on main f8086415. answerDiscussion bound every thread comment id in one comment_id $in, and the plain $in arm of driver-sql (sql-driver-filter-helpers.ts, case '$in') is one knex whereIn with no chunking. driver-sql was read and not changed. The route now reads the reactions in chunks of REACTION_READ_CHUNK_SIZE = 500 ids. That is half Oracle's 1,000-item IN list, which leaves SQL Server over 1,500 of its 2,100 parameters for the scope, RLS and paging binds. The chunks are read one after another, each paged whole by readWholeStream as in PR #39294, then merged with a stable sort by created_at (as an instant) and then id. A thread of 500 comments or fewer is one chunk and keeps the database's own order. readWholeStream now takes walked, the reaction rows already read by earlier chunks. A walk past OS_DATA_QUERY_ROW_BUDGET across chunks is refused in the route with the door's own rule (planQueryReadWindow from @objectstack/types): the same QUERY_ROW_BUDGET_EXCEEDED 400 in the reactions arm, with the comments still answered. Test seam: setReactionReadChunkSizeForTests, which returns a restore function, follows existing precedent and is not re-exported from the package entry. Changeset: @objectstack/rest patch, with Clause-② no and Metadata-protocol none.",
      "tests": "At a7c52aaf (head 98a4ad09 adds only the changeset; the src blobs are the same), `pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2 src/record-page-routes.test.ts` under os-verify-lock gave Tests 54 passed (54), VERDICT command-exit 0. That is 7 new tests in a [#39297] describe nested in [#39271], which reuses its pagingDoor door double. Two check that every reaction is answered once and in order across chunk boundaries, with no page size and with page 2: an id tie across chunks, at most 3 ids per read, chunks equal to the thread ids. Three check the past-budget refusal across chunks (budget 7): chunk3/no page, chunk3/page2 and chunk4/page2, the last reaching the in-loop branch. One checks an exact fit at budget 8, and one checks the constant is under 1000. `pnpm --filter @objectstack/rest typecheck` (tsc --noEmit && check:test-typecheck: 0 files / 0 errors) gave VERDICT command-exit 0. Ablations used scripts/ablation-replace.mjs after the fix was committed, with an anchor hit x1, the blob changed, and restore to HEAD blob 8a599e84f830 with an empty git diff HEAD. The test imports the route by relative source path, so no build was needed. A1 removed the seam's assignment (one $in): 2 failed / 52 passed. A2 removed the merge: 3 failed / 51 passed. A3 passed walked as 0: 3 failed / 51 passed. A2's first try was refused by the tool before running (its replacement text already occurred) and was re-run with a distinct replacement.",
      "gates": "Local subset at 98a4ad09: `dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 70 commands. All 70 were run, each exit code captured before any pipe. `--ran` gave 70 derived, 68 run, 2 NOT-MEASURED, 0 UNRUN (exit 0). NOT MEASURED (exit 3, PREREQUISITE NOT MET): `check-plugin-teardown-shape.mjs --self-test`, because the shallow clone cannot reach its fixture commit, and `check:dual-build-cjs-loads`, because only the rest dependency closure was built. `check:query-options-erasure` and `check-comment-mask-corpus.mjs` first hit a 240 s wrapper (exit 124) and were re-run alone: exit 0 in 388 s and 236 s. `overlap-check.mjs --branch=HEAD` reported that origin/main dc4a2cdbd6 merges cleanly (VERDICT clean). check-platform-checklist was not owed: no export was renamed or deleted, only two were added. CI check-runs on PR #39309 had just started when this report was written and are not cited. CI convergence is the seat's.",
      "mcp_calls": "0",
      "api_writes": "2 relay strokes: (1) fleet-write pr_create, run 47095390760: POST /repos/objectstack-ai/objectstack/pulls (draft) plus POST /repos/objectstack-ai/objectstack/issues/39309/assignees [os-bill]. Read-back: 8357 bytes identical, assignee os-bill, no labels. (2) This os-dev-report comment via post-stamped: POST /repos/objectstack-ai/objectstack/issues/39297/comments. Plus git push of the branch (the empty-branch probe and two commits), which is not a REST write.",
      "deviations": "1. The ablation test runs (3, about 10 s each) and the derived check gates ran outside os-verify-lock. The gates are allowed outside it; the ablation vitest runs are not. 2. The first gate batch (36 commands) went past the 595 s foreground limit and the harness moved it to the background. It completed, I waited for its result inside this turn, and no process outlives the run. The rest ran in foreground batches. 3. test:repo was not run locally: the diff edits no test in that project, and CI Test Core runs it.",
      "classifier_refusals": [],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed. The driver-sql plain $in arm binds an unbounded list for every caller, so any other read that binds a long id list meets the same Oracle and SQL Server ceilings. I inferred this from reading the code; it is not measured on those drivers and no other caller was traced. It is in the PR Acceptance notes. Dedupe words: driver-sql whereIn IN list limit, ORA-01795 bind parameters 2100, $in chunking driver"
      ]
    }
  7. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

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

    2026-12-03T12:35Z · Close-out · PR #39309 merged (2026-12-03T12:33Z, merge commit 2417d6677b), closing this card as Fixes #39297 intended.

  8. removed
    pm:dispatched
    on Dec 3, 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:serverpriority:p3

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions