Repository navigation
fix(driver-sql): on Oracle, a composed ReadableIds scope primes its RAW(16) parent's uuid columns - #36084
Conversation
…ds scope's parent Each Oracle door that compiles a filter now primes the RAW(16) uuid columns of every object a composed ReadableIds leaf in that filter names, through the same walk the SQL Server GUID prime uses, so the parent's comparands bind through HEXTORAW on a driver that has not read the parent yet. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
…s Oracle requires Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
…tions Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
📓 Docs Drift CheckThis PR changes 1 package(s): 20 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. 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 766b7c94ff5f0e3ab630ba54f0686a3b1033b6a2 && git checkout 766b7c94ff5f0e3ab630ba54f0686a3b1033b6a2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin fddb9cbb284830d40d2d663f9d1409f9b3b43c15 19243893f378eaa973cf0a5277915418b75452a0 && git checkout -B drift-repro fddb9cbb284830d40d2d663f9d1409f9b3b43c15 && git merge --no-ff 19243893f378eaa973cf0a5277915418b75452a0
node scripts/docs-audit/affected-docs.mjs --json fddb9cbb284830d40d2d663f9d1409f9b3b43c15
|
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH L1 · PR #36084 · head
|
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Landing: PR #36084 (#35960) at
|
Fixes #35960
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
On Oracle, a door primes a federated table's
RAW(16)uuid columns from the catalog before it binds a comparand (primeOracleRawUuidColumns). It primed only the door's own object, so a composedReadableIdsscope naming aRAW(16)-keyed parent bound the parent's ids as text: the child read answered no row and its negation every row, until something read the parent on that driver.sql-driver-field-mapping.ts:primeOracleRawUuidColumns(object, where?)now primes the door's object and every object a composedReadableIdsleaf inwherenames, at any depth. It reuses the existing walkcollectTextMatchObjects(the SQL Server GUID prime's), ignoring its text-operator answer, so there is still one walk.find/findOne(findRows),count,distinct,updateMany,deleteMany,aggregate(its where plus measure filters, folded once intoprimedWherefor all three primes, and each joined parent's scope),findWithWindowFunctions,analyzeQuery.sql-driver.ts: the stub takes and forwardswhere; its docblock says what it now primes.create,bulkCreate,update,delete,bulkDelete) are unchanged. Every other dialect is unchanged (the body returns on!isOraclefirst).Read first, by risk:
sql-driver-field-mapping.ts(the prime body, the loop over objects),sql-driver-aggregation.ts(theprimedWherehoist feeds the SQL Server and PostgreSQL primes too),sql-driver-fixed-read-leaf-conformance.test.ts(the new describe).Tests
New live pin in
sql-driver-fixed-read-leaf-conformance.test.ts, on the Oracle testkit cell (ORACLE_CELL, gvenzl/oracle-free 23-slim-faststart):a composed scope's RAW(16) parent is primed by the child's own door: a fresh driver, the child read first. Each case builds a freshSqlDriver, and the child read is its first statement. Two forms: the LIST form{ id: { $in: [U1 upper-case, U2] } }inside the composed scope, and the share-grant leaf. Ten cases each: find[c1, c2], the negation[c4], count 2, the negation's count 1, distinct, aggregate (where and measure filter),findWithWindowFunctions,analyzeQuery(statement carriesHEXTORAW(),updateMany,deleteMany.The existing nested pin no longer reads the parent first; its comment said the child's door primes the child alone, which is no longer true.
Measured on main 8145424 before the fix: 20 of 20 red
With the fix, at head 1924389: both Oracle live files green
Ablation: the walk call removed, pin red, restored to HEAD
node scripts/ablation-replace.mjsreplaced the linecollectTextMatchObjects(where, objects);in the Oracle prime with a marker (anchor 1 to 0, blob bb3b7d936b29 to 73e309341315), ran the pin:Tests 20 failed | 80 skipped (100). Restored: blob equals HEAD (bb3b7d936b29),git diff HEADempty. The test imports the driver fromsrc/, so no rebuild is involved. A first attempt was refused by the tool before any test ran (its replacement text already appeared in the anchor, so the count did not rise); it measured nothing.Package suite and typecheck
pnpm --filter @objectstack/driver-sql test(Oracle cell on), at 0c200dd:Test Files 268 passed | 13 skipped (281),Tests 4686 passed | 258 skipped (4944), VERDICT command-exit 0. The later head 1924389 only removes twoas anycasts in the pin.pnpm --filter @objectstack/driver-sql typecheck: exit 0, andtsc --noEmitagain at 1924389: exit 0.--listFilesincludes the conformance test file (1 hit).Acceptance notes
findWithWindowFunctionson a federated Oracle object: a window spec'sorderBy/partitionByfield is not mapped throughexternal.columnMap(ORDER BY "id"gives ORA-00904 on a table whose column isID), and Oracle refusesROW_NUMBER() OVER ()without an ORDER BY (ORA-30485). The pin orders by the stored columnIDand says so. Not filed: the door has no producer outside the driver packages (the request surface tombstoneswindowFunctions;git grep findWithWindowFunctionsoutside the drivers hits only CHANGELOG files).Verification
Two-minute check: with an Oracle Free container running and
OS_TEST_ORACLE_URL=oracle://USER:PASSWORD@127.0.0.1:PORT/FREEPDB1, runpnpm --filter @objectstack/driver-sql exec vitest run src/sql-driver-fixed-read-leaf-conformance.test.ts -t 'fresh driver, the child read first'and expect
Tests 20 passed. On main the same command answers20 failed.Local gates (derived by dispatch-gates --commands)
node scripts/pm/dispatch-gates.mjs --ranon the exit-coded record:72 derived famil(ies) accounted for — 70 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3). The 70 ran at 0c200dd with exit 0 (check:query-options-erasurewent red there, +1 test-surface site from two casts in the pin; the casts were removed and it is green at 1924389). Re-run at 1924389, all exit 0:check:test-source-alias,check:cross-package-test-inputs,check:nul-bytes,check:issue-citations,check:doc-authoring,check:driver-conformance,check-empty-changeset,check-changeset-no-major,check-adr-0087-registration.NOT MEASURED:
check:dual-build-cjs-loadsandcheck:lean-entry-closure, reason: PREREQUISITE NOT MET (exit 3). They read the whole repo's built output and only driver-sql's dependency closure was built. CI runs them.Generated by Claude Code