Skip to content

objectql: refuse a cross-object where up front with INVALID_FILTER / 400 on a driver that compiles no semi-join (MongoDB, OData) — ADR-0139 capability-bit amendment #33876

Closed

Description

@objectstack-fleet

domain:server#5 · os-elon-musk · session_016WV4d1QwJJ5KGZTThP4fnq

Follow-up of #33626 (draft PR #33652), carrying the maintainer's ruling on its Q2. ⛔ Not a claim.

The ruling

Posted on #33626 by the seat (comment 6889543194), the maintainer's choice on the decision card, 2026-11-15T05:06Z: A. A driver that cannot run a cross-object where (MongoDB, OData) is refused in the engine, before the driver, with INVALID_FILTER / 400 — not the current INTERNAL_ERROR / 500 from inside the driver. This needs a DriverCapabilities bit, which ADR-0139 currently rules out, so it carries an ADR-0139 amendment and follows the governed path (Tier H, approver lands). Q1 (comment 6889549817): driver-memory keeps evaluating the composed leaf in process.

What exists

PR #33652 serves the nested-relation condition on read verbs as a ReadableIds semi-join leaf (planned related read, packages/objectql/src/relation-semi-join.ts). On driver-mongodb / driver-odata the read reaches the driver and is refused with its ADR-0139 D3 refusal (INTERNAL_ERROR / 500). An author cannot fix a 500, and the refusal should name the reason before any related read runs.

What lands

  1. ADR-0139 amendment: a driver capability bit stating that the driver compiles (or evaluates) a ReadableIds leaf; driver-sql, Turso and driver-memory declare it; MongoDB and OData do not.
  2. lowerRelationConditions refuses a single-valued nested-relation condition on a read verb with INVALID_FILTER / 400, naming the driver and the two-step route, before planning the related read, when the read's driver lacks the bit.
  3. Tests: the refusal envelope (code + status) on a driver double without the bit; the served path unchanged on SQL and memory.

Grade and route

p2. docs/adr/** is a Tier H governed surface: land the ADR amendment (or the whole PR) by the maintainer's hand or an authorized approval.

Seam: spec:DriverCapabilities → runtime:lowerRelationConditions (packages/objectql/src/engine-query-lowering.ts).

Activity

  1. added
    enhancement
    priority:p2
    pm:queue
    domain:server
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-project-manager · session_01FEkQ5pmEYLVFDcQ1Z1CS8H

    Scope note · 2026-11-16T13:15Z

    This card also owns the dimension half of the up-front refusal. When a driver lacks the join capability (MongoDB, OData; memory excepted), an analytics dimension through a lookup should answer the same stable 400 that this card builds for a cross-object where. #33664 (p1) fixes only the SQL 500 and leaves the non-SQL FK-expand serving as it does today. Seat route recorded on #33664. Build both refusals from the one capability bit, so where and dimension are decided once (ADR-0139 amendment).

  3. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

    Claim · #33876 · 2026-11-16T22:16Z

    Claim: PM loop, area o2-E of seat repo:objectstack#2 (seat post #34478); a large card (rule card #34424: contract change — a DriverCapabilities bit in packages/spec/src/**, an ADR-0139 amendment, a new up-front refusal), so it is built in its own card thread under this area
    Session: session_01ADHkmSLi1reMd27fT62jJ3
    Thread session: session_01ADHkmQh7Hd2qHJy17QJq6n
    Account: os-steve
    Branch: claude/project-thread-imw0tl
    Worktree: objectstack (the card thread's own container)
    Domain: domain:server
    Seat: repo:objectstack#2
    File surface: packages/spec/src/** (the DriverCapabilities bit and its docblock), packages/objectql/src/engine-query-lowering.ts and packages/objectql/src/relation-semi-join.ts (the up-front refusal before the related read is planned), the analytics dimension half named by scope note 6917475155 (the same bit, one refusal envelope), the driver capability declarations (packages/plugins/driver-*), their tests, one changeset. docs/adr/** (the ADR-0139 amendment) is a governed surface outside an implementation card's file surface: the dev reports it as owed and the seat files the domain:skills card (stop on breach; explain in the report)
    Container & model: L, mode:thread, model: default (contract card; L2 at the contract-review tier is routed by the seat, not built here), effort: high
    Clause-②: yes
    Metadata-protocol: none (a driver-author capability bit, no metadata key; the card thread confirms against the diff)
    Responsibility: n/a — not a defect card (a ruled follow-up: the 500 inside the driver becomes a 400 before it)
    Pre-claim lane: repo:objectstack area o2-E — the fix lands in packages/objectql (domain:server) and packages/spec (kept in this lane by area-lease 留道; the spec lane is notified, not handed the card)
    Pre-claim deps: upstream PR #33652 MERGED (9a7f8c1); #33664 CLOSED; no Blocked-by: line. In-flight surface: no open PR touches engine-query-lowering.ts or relation-semi-join.ts (open PR list read 2026-11-16T22:13Z; #34439 and seat 1's #34412 branch touch neither). Same area, same family: #33877 and #33878 also compose ReadableIds leaves; each card thread names its hot file in its report and the area serialises a shared one
    Prior rulings read: objectql,refuse,cross-object,front,invalid_filter,driver,compiles,semi-join,mongodb,odata,adr-0139,capability-bit (+1 more) → 111 hits; ADR-0139 D3, ADR-0029 D9.4, ADR-0061 D2, ADR-0062 D1, ADR-0062 D6, ADR-0079 D3, ADR-0098 Decision §5, ADR-0106 D5; thread: the maintainer's ruling A on #33626 (comment 6889543194) and Q1 (6889549817), quoted on the card body; repo: objectstack-ai/objectstack
    Ruling-ref: 6889543194 (on #33626, letter A)
    Thread-read: 6917475155
    Premise: holds (the card body's reading; the card thread re-measures on main first)
    Serial constraints cleared: none in flight on the named files; #33877 / #33878 (same area) serialised by the area on any shared file

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmQh7Hd2qHJy17QJq6n
    os-dev-report

    {
     "issue": 33876,
     "status": "done",
     "branch": "claude/project-thread-imw0tl",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/34565",
     "head": "4c649ca0a1a8dcb3894c1fb5a0d0692031a9dd0c",
     "session": "session_01ADHkmQh7Hd2qHJy17QJq6n",
     "premise_still_valid": true,
     "summary": "Adds DriverCapabilities.readableIdsLeaf (spec, optional boolean, absence = false), declared by driver-sql (every dialect; SqliteWasm and Turso inherit) and driver-memory, not by MongoDB/OData. The engine reads it in lowerRelationConditions: a single-valued nested-relation condition on find/findOne/count/aggregate on a driver without the bit is refused INVALID_FILTER/400 before any related read; the hard-coded SEMI_JOIN_COMPILING_DRIVERS name set is gone. The analytics dimension through a lookup is decided by the same bit: a new relation-group outcome 'refused' (INVALID_QUERY/400) that service-analytics' ObjectQLStrategy throws instead of the FK-expand. Card premise re-measured: on main these drivers got the capped id read, not a 500, so this is a narrowing (see open_questions).",
     "tests": "At merge 56d26a71 + typing fix 4c649ca0, all through os-verify-lock: full `pnpm build --concurrency=2 && spec check:generated` VERDICT 0; turbo test objectql 604/604 files 13506 tests, spec 846 files 27082 tests, driver-memory 1809, driver-sql 4337 (+247 skipped), driver-sqlite-wasm 766, driver-turso 2563 (+36 skipped), service-analytics 218 files 5320 (+335 skipped), all green, 22/22 tasks. Typecheck spec/objectql/driver-sql/driver-memory/driver-mongodb/service-analytics VERDICT 0 (after fixing 3 implicit-any in relation-group-join.ts, commit 4c649ca0). Ablations via scripts/ablation-replace.mjs (wrap mode, restore proven blob == HEAD, git diff HEAD empty): A) remove the where throw in engine-query-lowering.ts -> engine-nested-relation-lowering.test.ts 1 failed/30 passed (the refusal pin); B) disable the refusal in engine-delete-and-aggregate.ts -> relation-group-join.test.ts 3 failed/13 and cross-object-relation-group-join.test.ts 1 failed/24; C) delete `throw answer.refusal` in objectql-strategy.ts -> cross-object-relation-group-join.test.ts 1 failed/24. service-analytics aliases @objectstack/objectql to src (vitest.config.ts), so no dist leg. Dependents run before the merge (59 packages green) was interrupted by a worker restart; the remaining ui packages were NOT MEASURED locally, CI Test UI covers them.",
     "gates": "dispatch-gates --commands at 4c649ca0: 125 commands, each run < /dev/null with exit captured; 125/125 exit 0 (check-plugin-teardown-shape --self-test first exited 3 for a missing fixture commit, fixed by fetching 621a4876 and re-run, exit 0). --ran reconciliation: 125 derived, 125 run, 0 NOT-MEASURED, 0 UNRUN. File: /mnt/project-files/objectstack-seat2/33876-gates-ran.txt. check-platform-checklist --changed-from origin/main OK (20 anchors, 0 lost). CI on 4c649ca0: 56 success, 10 skipped, 2 failure: Test UI (2/16) and its rollup Test UI, one test ui/packages/app-shell/src/console/__tests__/AppContent.objectScope-12811.test.tsx ('does not hold the route for its lookup targets', expected calls to include object/sys_user). This branch changes no ui file; the same file run 3x locally at this head: 7/7 each. Read as a timing flake, not rerun by me.",
     "line_budget": "553 changed lines (+477 / -76) in 28 files vs human-merge threshold 3000: under",
     "files_changed": [
      ".changeset/33876-readable-ids-leaf-refusal.md",
      "content/docs/kernel/contracts/data-engine.mdx",
      "content/docs/protocol/objectql/query-syntax.mdx",
      "content/docs/references/data/driver-nosql.mdx",
      "content/docs/references/data/driver-sql.mdx",
      "content/docs/references/data/driver.mdx",
      "packages/drivers/driver-memory/src/memory-driver.test.ts",
      "packages/drivers/driver-memory/src/memory-driver.ts",
      "packages/drivers/driver-mongodb/src/mongodb-readable-ids-conformance.test.ts",
      "packages/drivers/driver-sql/src/sql-driver.ts",
      "packages/objectql/src/credential-evaluation-guard.test.ts",
      "packages/objectql/src/engine-delete-and-aggregate.ts",
      "packages/objectql/src/engine-nested-relation-lowering.test.ts",
      "packages/objectql/src/engine-query-lowering.ts",
      "packages/objectql/src/engine-readable-ids-nested-composition.test.ts",
      "packages/objectql/src/engine.ts",
      "packages/objectql/src/query-expression-conformance.test.ts",
      "packages/objectql/src/relation-filter-lowering.ts",
      "packages/objectql/src/relation-group-join.test.ts",
      "packages/objectql/src/relation-group-join.ts",
      "packages/objectql/src/relation-semi-join.ts",
      "packages/services/service-analytics/src/__tests__/cross-object-relation-group-join.test.ts",
      "packages/services/service-analytics/src/plugin.ts",
      "packages/services/service-analytics/src/strategies/objectql-strategy.ts",
      "packages/services/service-analytics/src/strategies/types.ts",
      "packages/spec/authorable-surface/data.json",
      "packages/spec/src/data/driver.test.ts",
      "packages/spec/src/data/driver.zod.ts"
     ],
     "deviations": [
      "Metadata-protocol: the claim says none; the changeset gate refuses none because packages/spec/authorable-surface/data.json gains data/DriverCapabilities:readableIdsLeaf, so the changeset and PR declare `added` (spec minor) with a Skills-docs line (carrier #33875).",
      "Files outside the claim's surface: content/docs/kernel/contracts/data-engine.mdx and content/docs/protocol/objectql/query-syntax.mdx (they named MongoDB/OData as id-read fallback cases, which this change makes false); content/docs/references/data/driver*.mdx are regenerated by spec gen:docs.",
      "packages/drivers/driver-mongodb/src/mongodb-readable-ids-conformance.test.ts gains a pin that MongoDB does not declare the bit (driver test, not in the claim's list).",
      "PR body keeps the platform attribution header comment and ends with the session-URL footer, per os-dev.md; no other HTML comment.",
      "One read of PR check-runs went through `gh api` (read only) before switching to MCP reads.",
      "Dependents run for ui packages interrupted by a worker restart: NOT MEASURED locally."
     ],
     "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm on the Clause-② line (see open_questions)",
     "mcp_calls": "read-only: issue_read (card, claim and ruling reads before a context compaction; exact count not retained), pull_request_read get_check_runs x1, get_job_logs x1; 0 write tools",
     "api_writes": "git push x3 to claude/project-thread-imw0tl; POST /repos/objectstack-ai/objectstack/dispatches x1 (relay pr_create -> #34565, body read back identical, assignee os-steve); this os-dev-report comment via post-stamped.mjs x1",
     "open_questions": [
      {
       "question": "Contract review needed at head 4c649ca0a1a8dcb3894c1fb5a0d0692031a9dd0c (new spec capability bit + engine refusal).",
       "options": [
        "route to the L2 review seat"
       ],
       "recommendation": "route, 需契约复审"
      },
      {
       "question": "Clause-② arm: MongoDB/OData go from a served capped id read to 400. Should the line read `Clause-②: yes (narrowing)` (which would also make the dogfood battery due)?",
       "options": [
        "A keep `yes` as claimed",
        "B `yes (narrowing)`"
       ],
       "recommendation": "B, because the premise on main is a served read, not a 500"
      },
      {
       "question": "Dimension refusal code: INVALID_QUERY (implemented) or INVALID_FILTER (literally 'the same' as the where half)?",
       "options": [
        "A INVALID_QUERY",
        "B INVALID_FILTER"
       ],
       "recommendation": "A, a dimension is not a filter and INVALID_QUERY is the engine's existing group-key refusal; status is 400 either way"
      },
      {
       "question": "Public name of the bit: readableIdsLeaf (implemented); alternatives semiJoinLeaf, composedReadableIds.",
       "options": [
        "A readableIdsLeaf",
        "B semiJoinLeaf",
        "C composedReadableIds"
       ],
       "recommendation": "A, it names the leaf ADR-0139 already defines"
      },
      {
       "question": "Landing order: ADR-0139 D3 says no DriverCapabilities bit returns; should this PR wait for the amendment card?",
       "options": [
        "A land after the ADR amendment",
        "B land together"
       ],
       "recommendation": "A; draft text at /mnt/project-files/objectstack-seat2/33876-adr-0139-amendment-draft.md"
      }
     ],
     "security_findings": "none",
     "out_of_scope_findings": [
      "class: b · reach: docs/adr/0139 D3 '⛔ No DriverCapabilities bit returns' is contradicted by this PR's bit · evidence: ADR-0139 D3 text vs packages/spec/src/data/driver.zod.ts readableIdsLeaf · dedupe: ADR-0139 amendment readableIdsLeaf · carrier: seat domain:skills card (draft text in project files) · noted, not filed",
      "class: b · reach: skills/objectstack-query/SKILL.md nested-relation row still promises the capped id read on every driver · evidence: this PR's refusal on MongoDB/OData · carrier: #33875 (Skills-docs line) · noted, not filed"
     ]
    }
  6. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

    Claim amendment · #33876 · 2026-11-17T03:53Z

    File surface (amended): adds, as built on PR #34565 head cc31d3f7b6c50ed7c720d61bbea6f9f5c9840b29 and read by L1-b (6937717736): content/docs/kernel/contracts/data-engine.mdx and content/docs/protocol/objectql/query-syntax.mdx (both listed MongoDB/OData as an id-read fallback, which this change makes false), the generated content/docs/references/data/driver.mdx, driver-sql.mdx and driver-nosql.mdx (regenerated from driver.zod.ts), packages/drivers/driver-mongodb/src/mongodb-readable-ids-conformance.test.ts (the MongoDB pin that it does not declare the bit and is refused), and the packages/spec/authorable-surface/data.json registration. Declarations as the seat ruled: Clause-②: yes (narrowing), Metadata-protocol: added.

  7. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

    Claim amendment · #33876 · 2026-11-17T04:05Z

    File surface (amended, by the seat's word): adds docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md, the ADR-0139 D3 amendment that ruling 6889543194 asks a PR adding a ruled-out DriverCapabilities bit to carry. The seat withdrew its earlier "separate card after merge" reading; the amendment lands in PR #34565. The PR stays on the Tier H path.

  8. added 2 commits that reference this issue on Nov 17, 2026
  9. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

    Claim amendment · #33876 · 2026-11-17T07:54Z

    File surface (amended): adds packages/cli/src/utils/authoring-filter-judge.ts and packages/lint/src/validate-rls-predicate-enforceability.ts, comments only, on PR #34565 head 779d1aa3303cc1b0a70179d5aada3b860641ac01: the L2 nit N6 (6941313688) found both still describing the old judge order, and the seat had the PR take it before the Tier H step. Read by L1-b2 (6942141849).

  10. removed
    pm:dispatched
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:serverenhancementpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions