Repository navigation
fix(driver-sql): split a long $in/$nin list on Oracle, refuse one past SQL Server's parameter ceiling - #39782
objectstack-fleet[bot] wants to merge 5 commits into
Conversation
…t SQL Server's parameter ceiling Claude-Session: https://claude.ai/code/session_01Utp6CaJjkQx5fPE4Fbmoeq Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CaJjkQx5fPE4Fbmoeq Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CaJjkQx5fPE4Fbmoeq Co-authored-by: Claude <noreply@anthropic.com>
…e compile seam The new $in/$nin refusal goes through withheldFilterError, so the compile-refusal roster gets its row, and the tenant-chokepoint gate declares the new sql-driver module it now scans. Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check14 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 15 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e50837ccf9d9784a4342eceae4252f63ec2f5f90 && git checkout e50837ccf9d9784a4342eceae4252f63ec2f5f90
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8fdb82ab1783795932a13c3d19e2a25c0db2f59e 62243fe9c9319e81e212dbbfbe8f3ceeabdb6600 && git checkout -B drift-repro 8fdb82ab1783795932a13c3d19e2a25c0db2f59e && git merge --no-ff 62243fe9c9319e81e212dbbfbe8f3ceeabdb6600
node scripts/docs-audit/affected-docs.mjs --json 8fdb82ab1783795932a13c3d19e2a25c0db2f59e |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj Final green head: 2026-12-05T03:02Z · |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czzaKz49WLAvKtdyiY 席位核对L1 verdict (L1-b): ACCEPT at head Face: Against the card:
Open limit, accepted. A SQL Server statement whose lists each fit but together pass 2,100 still gets the server's own error. The card allows "a parameter ceiling (or a typed refusal)", and the helper sees one list, so the changeset and the module doc both say this. N1 (nit, outside the card's arms): the driver's own id-keyed Changeset: a patch on Landing: not governed, Generated by Claude Code |
Requested by Elon · project thread
Fixes #39312
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
packages/drivers/driver-sql, the$in/$ninarms ofFilterHelpersFacetnow go through a new sibling module,sql-driver-in-list-ceiling.ts(the filter-helpers file is over 1,000 lines, so the new concern lives beside it and the arms only call it):$inbecomes their disjunction,(col IN (...) OR col IN (...));$ninbecomes their conjunction,(col NOT IN (...) AND col NOT IN (...)), inside the existing NULL-safe arm. Under three-valued logic each is the same set test as the one long list, member for member.$in/$ninlist of more than 2,100 values is refused before any statement is built, asINVALID_FILTER/ 400, with a message that names the 2,100-parameter ceiling and the remedy (batch the read or narrow the filter). The field name stays withheld from the client message, the same as the driver's other filter refusals.Two companion edits, both mechanical consequences of the new module:
sql-driver-compile-refusal-seam.test.tsgets a roster row forassertInListWithinRequestCeiling. The roster pins every builder that goes throughwithheldFilterError, and the new row drives the refusal under the policy, author, unmarked and merged marks.scripts/check-tenant-chokepoint.mjsadds the newsql-driver-in-list-ceiling.tstoDECLARED_WATCH_HINTS, as that gate's self-test requires of every newly scannedsql-driver-*.tsmodule.What this does not cover: a SQL Server statement whose lists each fit but whose parameters together pass 2,100 still reaches the server and comes back as the server's error. The driver sees one list at a time, not the whole statement.
Tests
packages/drivers/driver-sql/src/sql-driver-39312-in-list-dialect-ceiling.test.ts:$in/$ninof 2,500 compile to three lists of 1,000 / 1,000 / 500, joined with OR / AND respectively, binding every id once and in order. A split$inunder$orstays one disjunct. A list of exactly 1,000 stays one list.$inand$ninof 2,101 are refused withcodeINVALID_FILTER,status400, and a first sentence naming the ceiling. A list of 2,100 compiles as one list.$in/$ninto exactly the SQL a plainwhereIn/ NULL-safewhereNotIngives.$in, and the split NULL-safe$nin, return the same rows as the one long list over 3,000 rows (every seventh NULL) and 2,400 members (some absent).Readings at 62243fe
pnpm --filter @objectstack/driver-sql test: 275 files passed, 14 skipped; 4621 tests passed, 268 skipped.pnpm --filter @objectstack/driver-sql typecheck(tsc --noEmit, which includessrc/**/*.test.ts): exit 0, no errors. Verify-lock verdict: command-exit 0.sql-driver-filter-helpers.tsrestored toorigin/mainon disk, the pin file goes from 15 passing to 5 failing and 10 passing. The 5 failures are the three Oracle split cases and the two SQL Server refusals. The tests that still pass without the fix are the within-ceiling cases, the byte-identity cases, the thread-gate count and the SQLite answer-equality cases, which call the emitters directly. The file was then restored from HEAD, and the tree was clean afterwards.Acceptance notes
sys_commentthread gate's parameter count on SQL Server. The gate ORs one branch per registered parent object:object_name = Pplusrecord_id IN (ReadableIds subquery for P under the caller's scope). The readable-id set compiles as a subquery, not a literal list, so a branch binds 1 + s_P parameters, where s_P is the bindings of the caller's own row scope on P. The pin test measures this through the SQL Server dialect's own knex client: 120 parents with a one-binding owner scope bind exactly 240 parameters. So G = sum over parents of (1 + s_P). With one-binding scopes, G passes 2,100 only beyond 1,050 parent objects. This was measured offline through the dialect compiler. It was not run against a live SQL Server, and no live app's parent-object count was taken.toSQL()output.Verification
Read first (by risk):
packages/drivers/driver-sql/src/sql-driver-in-list-ceiling.ts:emitNotInValueTest. The$ninsplit must be an AND of NOT INs inside the NULL-safe group, never an OR.packages/drivers/driver-sql/src/sql-driver-filter-helpers.ts, the$in/$ninarms: the refusal runs before either emit.Two-minute check:
pnpm --filter @objectstack/driver-sql exec vitest run --maxWorkers=2 src/sql-driver-39312-in-list-dialect-ceiling.test.ts. Expect all 15 tests to pass.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj