Repository navigation
feat(objectql): refuse a nested-relation condition and a lookup dimension up front on a driver without the readableIdsLeaf capability - #34565
Conversation
…ithout the readableIdsLeaf capability Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
…IdsLeaf; doubles declare the bit Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
…regenerate the driver reference pages Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
…bleIdsLeaf is refused up front, no FK-expand Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
…ngeset Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
…ition up front, no longer a fallback case Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
…set declares the added key Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
…citly The readonly relations array narrowed to any[] under Array.isArray, so the attribute callbacks were implicitly any and objectql's typecheck failed. Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 7 package(s): 37 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 183 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 989d199cccb1eddc7a3f96bdcc562b50697a2a4f && git checkout 989d199cccb1eddc7a3f96bdcc562b50697a2a4f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a34eb0716a8e9838ea286677f305e71df74c62f6 779d1aa3303cc1b0a70179d5aada3b860641ac01 && git checkout -B drift-repro a34eb0716a8e9838ea286677f305e71df74c62f6 && git merge --no-ff 779d1aa3303cc1b0a70179d5aada3b860641ac01
node scripts/docs-audit/affected-docs.mjs --json a34eb0716a8e9838ea286677f305e71df74c62f6
|
|
repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3 CI note · PR #34565 · 2026-11-17T01:47Z
|
…-imw0tl # Conflicts: # packages/drivers/driver-sql/src/sql-driver.ts # packages/spec/src/data/driver.test.ts # packages/spec/src/data/driver.zod.ts
…s merge and declare the narrowing Regenerates the authorable surface and driver reference pages from the merged tree. The DriverCapabilities TSDoc now states what a driver without the bit got before (a capped id read: up to 1,000 related matches served, refused past them) and the live-bit list names the analytics dimension reader. The changeset declares the narrowing arm, with the BREAKING migration and its ADR-0087 disposition. Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3 Final head · PR #34565 · 2026-11-17T03:49Z Final head for L1 and L2:
|
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head cc31d3f · 2026-11-17T03:50Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmPZf3MhxKeGaxV4P3W 席位核对L1 first review · ACCEPT · head Checklist (read on GitHub at this head, not from the report)
Before landing
Owed after this
|
…f its declined heading Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n Co-authored-by: Claude <noreply@anthropic.com>
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: ① Derived judgments
② Semver levelClause-②:
③ Boundary flags
④ Design judgment
The narrowing, read against the published contract on Implementing files, sentence by sentence. S1 (should-fix) — a possible access finding was reported to the seat privately. Nits, none affecting correctness:
Implemented-by: VERDICT: PASS |
…tics where leaf in BREAKING The dimension refusal follows the scope note on #33876 under Prime Directive 5, not ruling A. The changeset's BREAKING section now also names an analytics where leaf through a lookup, and a dataset's own filter, which reach the same nested-relation gate on these drivers. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: Delta review. The record this one follows is comment 6937856418 (PASS on head ① Derived judgments
② Semver levelUnchanged and still right. ③ Boundary flags
④ Design judgment
Design. Reading a declaration is not calling a driver, the member stays synchronous, and one function serves both callers, so the two cannot drift. The judge refuses at the point execution refuses. This is the better of the two fixes: it keeps the engine the single judge, where a catch in the analytics service would have been a second reading of the same rule.
S1: closed Carried, none affecting correctness:
New nits, none affecting correctness:
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
… in cli and lint, list the read scope in BREAKING ADR-0139's amendment keeps the 500 envelope for a leaf any consumer composes. The authoring filter judge's two comments now say the engine's judge calls no driver and leaves its one driver-dependent verdict unjudged when no driver is routed. The changeset's BREAKING list names a row-level read scope holding such a condition: on these drivers an analytics query under it answers the withheld 500. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmQh7Hd2qHJy17QJq6n
|
repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3 Final head · PR #34565 · 2026-11-17T07:52Z Final head for the prose deltas: |
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 779d1aa · 2026-11-17T07:53Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmTHGRTjPqZAcBuo9WH 席位核对L1 delta (prose only) · ACCEPT · head Delta read (one commit,
|
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: Delta review. The record this one follows is comment 6941313688 (PASS on head ① Derived judgments
② Semver levelUnchanged and still right. The delta adds no package, no bump and no protocol key. The changeset frontmatter, the ③ Boundary flags
④ Design judgment
The two comments now agree with the contract docblock of The changeset line follows the three entries above it in form (FROM, TO, then the answer and its code) and gives a policy author the thing to change. It names the existing withheld envelope and does not invent a second one. N5: closed Carried, none affecting correctness:
New nits, none affecting correctness:
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA Seat record · 2026-11-17T07:57Z · Head-sha: 779d1aa 维护者速读
席位意见:同意合并。这是兑现你在 #33626 Q2 的裁决 A;能力位名、两个错误码都有先例可循,席位已照准。收窄的方向是把「做得到一部分、超过 1000 条才报错」的不稳定行为,换成一开始就稳定拒收,AI 写元数据时更难写出只在小数据上能跑的查询。 席位核对
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44058185304 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA Queue note · 2026-11-17T10:19Z The merge-group build for this PR (run https://github.com/objectstack-ai/objectstack/actions/runs/44058185304) failed only in @os-zhuang: there is no approving review on record, so the seat does not re-queue it. If it has left the queue, please put it back. The head ( |
Requested by Steve · project thread
Fixes #33876
Clause-②: yes (narrowing) — narrowed: on a driver that does not declare
DriverCapabilities.readableIdsLeaf(MongoDB, OData, a third-party driver), a nested-relation condition beneath a single-valued relation onfind,findOne,countoraggregateis refusedINVALID_FILTER/ 400 before anything is read, where it read the related ids first and answered up to 1,000 related matches (past 1,000 it was already refusedINVALID_FILTER/ 400, never truncated); an analytics dimension through a lookup on such a driver is refusedINVALID_QUERY/ 400 before anything is read, where it was served by reading the related records for the grouped ids. Widened: a driver that declares the bit is served by the planned semi-join whatever its name.Metadata-protocol: added
Skills-docs: follow-up #33875 — skills/objectstack-query/SKILL.md (its nested-relation row still promises the capped id read on every driver; MongoDB and OData now refuse it)
维护者速读
DriverCapabilities.readableIdsLeaf(SQL 各方言、Turso、内存驱动声明,MongoDB/OData 不声明)。引擎在单值关系的嵌套条件(读操作)上看这个位:没有它就在规划/读取任何关联数据之前直接拒收INVALID_FILTER/400,点名驱动并给出两步写法;分析里「经查找字段分组的维度」用同一个位,没有它就INVALID_QUERY/400。引擎的 where 判定(judgeFilter)按驱动声明的能力位给出与执行相同的拒收,先问判定的调用方(分析的读范围合并)拿到同一结论。ADR-0139 D3 在本 PR 内修订。packages/objectql/src/relation-filter-lowering.ts#relationReadDriverRefusal(执行与判定共用的 where 拒收)、packages/objectql/src/relation-group-join.ts(维度拒收与新的 refused 结果)、packages/spec/src/data/driver.zod.ts(新能力位)。pnpm --filter @objectstack/objectql exec vitest run src/engine-nested-relation-lowering.test.ts,预期 32/32 绿,其中「a driver without the readableIdsLeaf bit … is refused up front」一条覆盖 Mongo/OData/未声明驱动在四个读操作上都是 400 且一次读取都没有;「the filter judge answers the same up-front refusal as execution」一条覆盖判定与执行同一结论。docs/adr/,受治理面),请审这段修订:D3「不再回来任何能力位」对readableIdsLeaf及引擎自己的两个读者解除,六个消费方的 500 拒收不变。已合含 fix(spec, objectql, driver-sql): a predicate delete with a cascade locks the rows it walks #34517、feat(objectql,driver-sql): PostgreSQL buckets a non-UTC reference timezone in the database (ADR-0053 D2 as amended) #34530 的 main,能力位钉子为 8(lockRows、zonedDateBucketing、readableIdsLeaf 三位并存),driver*.mdx 已重生成。What changes
@objectstack/spec:DriverCapabilities.readableIdsLeaf(optional boolean, absence =false): the driver's filter compiler compiles (or, in process, evaluates) a composedReadableIdsleaf. TSDoc and the live-bit list in the schema header say who reads it. The driver reference pages are regenerated.driver-sqldeclares it on every dialect (SqliteWasmDriverandTursoDriverinherit it; Turso's remote transport compiles the leaf with its own compiler).driver-memorydeclares it (it evaluates the leaf in process, ruling Q1, comment 6889549817).driver-mongodbanddriver-odataare unchanged and do not declare it.@objectstack/objectql, the where half (engine-query-lowering.ts#lowerRelationConditions): onfind/findOne/count/aggregate, every relation site is judged before any related read is planned or run. If any single-valued site exists and the read's driver lacks the bit, the read is refusedINVALID_FILTER/ 400 (relation-filter-lowering.ts#relationReadDriverRefusal, which buildsrelationSemiJoinDriverRefusal), naming the driver and the two-step route.relation-semi-join.tsdrops the hard-codedSEMI_JOIN_COMPILING_DRIVERSname set;relationSemiJoinServesand the refusal both read the bit throughdriverCompilesReadableIdsLeaf. A multi-valued relation and thewhereofupdate/deletekeep the capped id read on every driver.@objectstack/objectql, the filter judge (engine-top-level.ts#judgeWhereAdmission,IObjectQLEngine.judgeFilter): the judge answers that same refusal, through the samerelationReadDriverRefusal, from the object's driver's DECLARED capabilities. It still calls no driver. An engine that routes the object to no driver (the authoring-time judge) does not judge it. The contract docblock inpackages/spec/src/contracts/objectql-engine.tssays so. A caller that asks the judge before composing a filter (the analytics read-scope merge) therefore refuses what execution would refuse, in its own envelope.@objectstack/objectql, the dimension half (relation-group-join.ts#relationGroupDriverRefusal, called first inengine-delete-and-aggregate.ts#aggregate): a relation group request on a driver without the bit gets a new outcome{ kind: 'refused', error }(INVALID_QUERY/ 400) and nothing is read. A driver with the bit that compiles no join (memory, Turso) is declined as before.@objectstack/service-analytics: the plugin's engine bridge returns the engine's refusal asrefusalon ajoined: falseanswer, andObjectQLStrategy#executeCrossObjectJoinedthrows it instead of falling back to the FK-expand. A host that wires noexecuteRelationGroupAggregatekeeps the FK-expand (it never asks the engine).docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md, added to the declared file surface by the seat): a status-line amendment, an amendment note under D3 and a Consequences sentence. D3's "⛔ NoDriverCapabilitiesbit returns" is lifted forreadableIdsLeafand the engine's own two readers (the nested-relation condition, and the analytics dimension through a lookup), each refusing with a 400 before any read; the six consumers'INTERNAL_ERROR/ 500 refusal stands.packages/cli/src/utils/authoring-filter-judge.ts,packages/lint/src/validate-rls-predicate-enforceability.ts): both said the judge stops before any driver is resolved. They now say it calls no driver and that an engine with no driver routed (the authoring-time judge) leaves its one driver-dependent verdict unjudged. No code changes there.content/docs/kernel/contracts/data-engine.mdxandcontent/docs/protocol/objectql/query-syntax.mdxlisted "a driver that compiles no subquery (MongoDB, OData)" as an id-read fallback case. This change makes that false, so both pages now say the condition is refused there.BREAKING
For a deployment whose data lives on MongoDB, OData or a third-party driver that does not declare
readableIdsLeaf. Measured onmain: such a driver got a capped id read, served up to 1,000 related matches and refusedINVALID_FILTER/ 400 past them (never truncated;relationFilterCapError, pinned byengine-nested-relation-lowering.test.ts"the cap"); a dimension through a lookup was served by the FK-expand. The fix:find('opportunity', { where: { account: { region: 'NA' } } })TO two reads:find('account', { where: { region: 'NA' }, fields: ['id'] }), thenfind('opportunity', { where: { account: { $in: ids } } }). The same forfindOne,countandaggregate.opportunity.stageon a line cube TO a dimension on the lookup field itself (opportunity), then a read ofopportunityforstageby those ids.wherenaming a field through a lookup (opportunity.stage), or a dataset whose ownfilterdoes, TO a filter on the lookup field itself (opportunity$inthe ids read fromopportunitywith that condition): the analytics service hands such a leaf to the engine as the same nested-relation condition, so on these drivers it is refusedINVALID_FILTER/ 400 the same way.account$inthe ids it may read): on these drivers an analytics query under the former is refused before anything is read with the withheldREAD_SCOPE_COMPILE_FAILED/ 500, the answer a read scope the engine cannot run already gets.supports.readableIdsLeaf: trueand keeps serving both.ADR-0087 disposition (changeset marker): not-required (no-migration-prescription): no metadata key, value or type is removed or re-shaped; the moved answer is a runtime refusal.
Tests
packages/objectql/src/engine-nested-relation-lowering.test.ts: the recording driver now declaressupports(default: the bit). The old pin "a driver that compiles no subquery (MongoDB, OData, any unnamed driver) keeps the capped id read" is replaced by the refusal pin: MongoDB, OData, an undeclared name and a SQL name each with{},{ readableIdsLeaf: false }and{ readableIdsLeaf: 'true' }giveINVALID_FILTER/ 400 on all four read verbs and under$or/$not. The message names the driver, the driver sees no read, and a multi-valued relation and anupdatewherekeep the id read. A control: a driver named MongoDB that declares the bit plans the semi-join (the bit decides, not the name).packages/objectql/src/engine-nested-relation-lowering.test.ts, "the filter judge answers the same up-front refusal as execution": on MongoDB and OData without the bit,judgeFilteranswers{ ok: false, INVALID_FILTER, 400 }with execution's own message on all four read verbs and under$or/$not, and reads nothing; a multi-valued relation and anupdatewhereare admitted; controls: a driver with the bit, and an engine with no driver, admit it.packages/services/service-analytics/src/__tests__/objectql-read-scope-engine-admission.test.ts, "a nested-relation condition on a driver that does not declare it can run one": a real engine overSqliteWasmDriverre-declared without the bit; a read scope with a single-valued nested-relation condition is refusedREAD_SCOPE_COMPILE_FAILED/ 500 with no read, on the direct and the cross-object path; controls: the same scope on the driver with the bit is served with exactly its rows, a scope without such a condition is served, and the caller's ownwherewith that condition keepsINVALID_FILTER/ 400.packages/objectql/src/relation-group-join.test.ts: memory and Turso (bit, no join) stay declined. MongoDB, OData and a SQL name without the bit are refused,INVALID_QUERY/ 400 on the outcome, and the driver is never called.packages/services/service-analytics/src/__tests__/cross-object-relation-group-join.test.ts: on a realSqliteWasmDriverre-declared as MongoDB without the bit, astagedimension query answersINVALID_QUERY/ 400 naming the driver, outcomerefused, and zero driver reads (no FK-expand). A control re-declared as Turso with the bit is declined and served by the FK-expand, with the same rows as the reference.packages/spec/src/data/driver.test.ts: the live-bit roster is eight (withlockRowsfrom fix(spec, objectql, driver-sql): a predicate delete with a cascade locks the rows it walks #34517 andzonedDateBucketingfrom feat(objectql,driver-sql): PostgreSQL buckets a non-UTC reference timezone in the database (ADR-0053 D2 as amended) #34530); absence parses to no key; a non-boolean is refused.packages/drivers/driver-memory/src/memory-driver.test.ts:supportsis{ readableIdsLeaf: true }.packages/drivers/driver-mongodb/src/mongodb-readable-ids-conformance.test.ts: MongoDB does not declare the bit.Tests changed because the behaviour changed (each named): in
credential-evaluation-guard.test.ts,query-expression-conformance.test.tsandengine-readable-ids-nested-composition.test.tsthe test drivers stand for drivers that run the nested condition, so each now declares the bit. Their assertions are unchanged.Acceptance notes
origin/maine8cba8f: the card body says MongoDB/OData reach the driver and answerINTERNAL_ERROR/ 500. PR feat(objectql): a nested-relation condition on a read verb is one read-scoped in-database subquery per relationship, up to three, where it is provably the same read as the id read #33652 as merged (9a7f8c1) keeps the capped id read for a driver outside the name set instead (up to 1,000 related matches served, past thatINVALID_FILTER/ 400). So this change is a narrowing, declaredClause-②: yes (narrowing)by the seat's ruling; ruling A (6889543194) chose the shape, the engine refusing up front, not a premise of a 500.INVALID_QUERY/ 400 and the where refusalINVALID_FILTER/ 400, the same envelope shape (seat ruling): a dimension is not a filter, andINVALID_QUERYis the code the engine already uses for a group-key refusal.Metadata-protocol: none. The changeset gate refusesnonehere because the authorable-surface shardpackages/spec/authorable-surface/data.jsongainsdata/DriverCapabilities:readableIdsLeaf, so this PR declaresadded(specminor) and carries theSkills-docs:line.DriverCapabilitiesbit returns". This PR adds one with its readers in the same change, as the ruling orders, and amends D3 in the same PR (the seat's ruling, which addeddocs/adr/**to the declared file surface).docs/adr/is a governed surface, so this PR waits for a governed approver before it leaves draft.Verification
Readings are in the os-dev-report on #33876.
Generated by Claude Code