Skip to content

driver-sql (Oracle): a read scoped by a parent with a RAW(16) uuid key misses every row until something has read the parent #35960

Closed

Description

@objectstack-fleet

repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu

Filing gate: ① a product defect, measured live · Source: fleet (os-dev report on #35952, out_of_scope_findings[0]; seat 7's word to file, 2026-11-20 23:47 UTC)

维护者速读

  • 问题:在 Oracle 上,如果父对象的主键是十六字节二进制(RAW(16))存的 uuid,那么按父记录可见性限定的子记录读取(controlled_by_parent)会静默返回空,取反时反而返回全部行。只有在同一个驱动上先读过一次父对象后才恢复正常。
  • 影响:用 Oracle 外部表、主键是 RAW(16) uuid 的部署,用户看不到本该能看到的子记录,没有任何报错。
  • 这一步做什么:Oracle 的 RAW 列预读也要覆盖组合可见性范围里的父对象,像 PostgreSQL 那边 [Decision] ADR-0155 O2: the share-grant subquery on PostgreSQL for an object whose id is not text (integer, uuid) #35906 做的一样。
  • 要你做的:无。

What happens (measured)

Measured live on Oracle Free 23ai (testkit ORACLE_CELL, gvenzl/oracle-free) with a fresh SqlDriver, reading the child object first:

  • A child read whose composed ReadableIds scope compares a RAW(16) parent's id answers []. The expected rows are [c1, c2]. This happens with today's LIST form, { id: { $in: [U1 upper-case, U2] } }, not only with the share-grant leaf.
  • Its negation answers every row.
  • Once anything has read the parent object on that driver, the same read answers [c1, c2].

Why

The Oracle doors prime primeOracleRawUuidColumns (packages/drivers/driver-sql/src/sql-driver-field-mapping.ts) for the door's own object, and for aggregate's joined parents, but never for the parent named inside a composed ReadableIds scope. So the parent's comparands bind as plain text instead of through HEXTORAW (sql-driver-oracle-dialect.ts#oracleUuidRawBinding). Oracle then compares the RAW column as upper-case hex text, and nothing matches. The PostgreSQL prime that #35906 adds does walk composed scopes for the parent; the Oracle prime does not.

reach: a named producer. plugin-security's controlled_by_parent read derivation answers { masterFK: { $in: ReadableIds.of(master) } }, and the engine composes it with the master's getReadFilter (ADR-0139 D6). Measured at the driver door; not yet driven through HTTP.

Fix direction

Prime the RAW(16) columns of every object a composed scope names, at the same doors that prime the door object, mirroring #35906's PG walk. Pin it live on the Oracle cell: a fresh driver, child read first, both the list and the leaf forms, and the negation.

Order

Independent of #35952 (that card converts the leaf's grants and does not touch the prime). Its live nested pin primes the parent explicitly, and says so in a comment.

Grading: area:data · Bug · a silent wrong answer on a supported dialect, measured live.
Suggested grade: p2 (silent loss of visible child rows on Oracle deployments with RAW(16) uuid keys; no error, so no one notices).

Dedupe: repo:objectstack-ai/objectstack is:issue oracle RAW(16) ReadableIds, primeOracleRawUuidColumns, controlled_by_parent oracle uuid → only #33787, #35872 and QA run records; none about the Oracle prime.

Activity

  1. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server (driver-sql, Oracle) · pm:queue; rationale: area:data · Bug · on Oracle, a read whose composed ReadableIds scope names a parent with a RAW(16) uuid key binds the parent comparands as text, so it silently returns no rows (and its negation returns every row) until something has read the parent on that driver; measured live on Oracle Free 23ai; producer: plugin-security controlled_by_parent; reach: Oracle deployments with RAW(16) uuid parents → p2 (silent wrong result, narrow reach) · size S (prime the parent inside composed scopes, as the PostgreSQL prime of #35906 does). security#2 is asked to judge the negated form.

  2. added
    bug
    domain:server
    pm:queue
    priority:p2
    on Nov 20, 2026
  3. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

    Claim: PM loop · 2026-11-21T11:37Z
    Session: session_01L9qibwJEh7hMPPvagWM1g7
    Account: os-tesla
    Branch: claude/issue-35960-oracle-raw-prime-composed-scope
    Worktree: objectstack-issue-35960
    Domain: domain:server
    Seat: repo:objectstack#7
    Area: d7-B (driver-sql)
    File surface:

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7
    os-dev-report

    {
     "issue": 35960,
     "status": "done",
     "branch": "claude/issue-35960-oracle-raw-prime-composed-scope",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/36084",
     "session": "session_01L9qibwJEh7hMPPvagWM1g7",
     "premise_still_valid": true,
     "summary": "Premise re-measured live on Oracle Free 23ai (gvenzl/oracle-free:23-slim-faststart, started in this container via dockerd) at main 8145424b53: with a fresh SqlDriver and the child read first, a composed ReadableIds scope over the RAW(16) parent answered [] for the list form {id:{$in:[U1 upper-case, U2]}} and for the share-grant leaf, and the negation answered [c1, c2, c4] (every row); 20 of 20 new pin cases red. Fix: FieldMappingFacet.primeOracleRawUuidColumns(object, where?) now primes the door's object plus every object a composed ReadableIds leaf in where names, reusing the existing collectTextMatchObjects walk (the MSSQL GUID prime's), so there is still one walk; every Oracle door that primes with a filter in hand passes it (findRows for find/findOne, count, distinct, updateMany, deleteMany, aggregate with where plus measure filters folded once into primedWhere and each joined parent's scope, findWithWindowFunctions, analyzeQuery). findWithWindowFunctions is not in the claim's parenthetical door list but is a door that primes with a filter in hand, as the claim's clause and the dispatch's step 2 describe. No line added to packages/objectql/src/engine.ts; diff stays in packages/drivers/driver-sql/src/** plus one patch changeset.",
     "tests": "LIVE ORACLE (OS_TEST_ORACLE_URL set, OS_EXPECT_LIVE_ORACLE=1). Before fix, main 8145424b53, -t 'fresh driver, the child read first': Tests 20 failed | 80 skipped (100); e.g. 'expected [] to deeply equal [c1, c2]', 'expected [c1, c2, c4] to deeply equal [c4]', 'expected 3 to be 1', analyzeQuery sql lacked HEXTORAW(. After fix at final head 19243893f3: both Oracle live files (fixed-read-leaf-conformance + oracle-federation-conformance) Test Files 2 passed (2), Tests 365 passed | 2 skipped (367), VERDICT command-exit 0; pin 20/20 pass (verbose). Ablation at 0c200dd0cf via scripts/ablation-replace.mjs: line 'collectTextMatchObjects(where, objects);' in the Oracle prime replaced by a marker (anchor 1->0, blob bb3b7d936b29 -> 73e309341315), pin Tests 20 failed | 80 skipped; restored, blob == HEAD bb3b7d936b29, git diff HEAD empty. Subject is imported from src/ (relative './sql-driver.js'), no dist in the path, so no rebuild leg. A first ablation attempt was refused by ablation-replace before any test ran (replacement text was a substring of the anchor, count did not rise): a no-op, measured nothing. Package: pnpm --filter @objectstack/driver-sql test (Oracle on) at 0c200dd0cf: Test Files 268 passed | 13 skipped (281), Tests 4686 passed | 258 skipped (4944), VERDICT 0; 19243893f3 differs only by removing two 'as any' casts in the pin. typecheck: exit 0 at 0c200dd0cf and tsc --noEmit exit 0 at 19243893f3; --listFiles counts the conformance test file (1).",
     "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack (tree 0c200dd0cf): 72 families. Ran with exit codes recorded; --ran reconciliation: '72 derived famil(ies) accounted for, 70 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)'. NOT MEASURED: check:dual-build-cjs-loads, check:lean-entry-closure, reason PREREQUISITE NOT MET (exit 3; need whole-repo dist, only driver-sql's closure was built); CI runs them. check:query-options-erasure was red at 0c200dd0cf (test surface 236 -> 237 from two casts in the new pin); the casts were removed and it is exit 0 at 19243893f3 ('ratchet holds'). Re-run at 19243893f3, 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. overlap-check before each push: VERDICT clean exit 0 (merges cleanly onto origin/main 8145424b53). PR #36084 check-runs at 19243893f3 when read: Check Changeset, Lint (ESLint, PM dispatch-gates, repo & tooling, CI/release/engine, docs & code guards, scoped), Type Check (workspace, source gates, consumer gates, debt ledger), Governed Surface Queue Guard, PR-body guards, Check PR Size: in_progress; query-options erasure lane queued; no conclusion yet. Test Core / Build Core not yet listed. The changed package's live Oracle cell is not run by CI (no CI job provisions Oracle), so the live readings above are the only Oracle evidence.",
     "dogfood_battery": "n/a — no ! in the PR title and Clause-②: no has no (narrowing) arm",
     "mcp_calls": "0",
     "api_writes": "2 — fleet-write relay pr_create (POST /repos/objectstack-ai/objectstack/pulls draft + POST /issues/36084/assignees os-tesla), post-stamped comment on #35960 (POST /repos/objectstack-ai/objectstack/issues/35960/comments); plus git push x4 (not REST)",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "class: none (zero-pull, noted not filed) · reach: no producer outside the driver packages (git grep findWithWindowFunctions outside packages/drivers hits CHANGELOG files only; the request surface tombstones windowFunctions) · evidence: live on Oracle Free 23ai, findWithWindowFunctions on a federated object with columnMap ID->id: orderBy field 'id' compiles ORDER BY \"id\" -> ORA-00904 invalid identifier (window spec fields are not mapped through external.columnMap); ROW_NUMBER() OVER () without ORDER BY -> ORA-30485 · in PR Acceptance notes · dedupe words: findWithWindowFunctions columnMap, window orderBy external column, ORA-00904 window",
      "carrier: none · aggregate's joined parent now primes the objects its own scope composes (same walk), not pinned live (fixture has no grandparent); noted in PR Acceptance notes"
     ]
    }
  6. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

    Claim amendment · 2026-11-21T12:49Z · L1 nit N2 on PR #36084 (7062827204)

    The claim 7062025264's file surface also names:

    • packages/drivers/driver-sql/src/sql-driver.ts. The primeOracleRawUuidColumns stub takes the optional where and its docblock says so (+5/−3, line count steady).
    • findWithWindowFunctions, among the Oracle doors that prime with a filter in hand. It is inside the claim's clause, though not in its parenthetical list.

    Both stay inside packages/drivers/driver-sql/src/**.

    On the out-of-scope finding, a window orderBy that is not mapped through external.columnMap (ORA-00904): it is not filed, because it fails the filing gate's business test. No producer outside the driver packages calls findWithWindowFunctions; git grep outside packages/drivers hits CHANGELOGs only, and the request surface tombstones windowFunctions. It stays in the PR's Acceptance notes.

  7. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

    Close-out · 2026-11-21T14:19Z · #35960 done by PR #36084

    PR #36084 merged through the queue at 2026-11-21T14:18Z as 521b4f65c5cedf40fcac6b5072deb0af75936b30. The merge group's Dogfood Regression Gate passed (3/3).

    What landed. On Oracle, primeOracleRawUuidColumns(object, where?) now primes the door's object and every object a composed ReadableIds leaf names, at any depth. It reuses collectTextMatchObjects, the SQL Server GUID prime's walk, so there is still one walk. Every Oracle door that primes with a filter in hand passes it: find and findOne, count, distinct, updateMany, deleteMany, aggregate (with measure filters folded in, and each joined parent's scope), findWithWindowFunctions and analyzeQuery. A parent with a RAW(16) uuid key now binds through HEXTORAW on a fresh driver. The list form and the share-grant leaf both answer the visible rows, and the negation no longer answers every row.

    Review trail

    • Claim 7062025264, amendment 7062832809 (L1 N2).
    • os-dev report 7062798455.
    • L1 ACCEPT 7062827204. No L2 was owed.
    • Landing 7063210966.

    Carries

    • No CI job provisions Oracle. The live record is the dev's run on Oracle Free 23ai: 20 pins red on main, green on the fix, and the ablation turns the same 20 red.
    • Nit N1: the aggregate joined-parent prime is right by reading but has no live pin. feat(driver-sql): compare the share-grant subquery by the key's type on PostgreSQL (ADR-0155 O2, ruling A) #35967's RelationGroupJoin pin is the template for an Oracle twin.
    • Not filed: a window orderBy is not mapped through external.columnMap (ORA-00904). It has no producer outside the driver packages, so it fails the filing gate's business test. It is recorded in the PR's Acceptance notes.

    pm:dispatched removed. The card was closed by the merge.

  8. removed
    pm:dispatched
    on Nov 21, 2026
  9. added 2 commits that reference this issue on Nov 22, 2026
    521b4f6
    52a2398
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:databugdomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions