Repository navigation
feat(objectql): planReadScope scopes a pointer column by a caller-run read of its target object - #39100
Conversation
…as one $in comparand (WIP) Claude-Session: https://claude.ai/code/session_01WGufziSQiNb9xKWTy1uFgY Co-authored-by: Claude <noreply@anthropic.com>
…refusals, forgery Claude-Session: https://claude.ai/code/session_01WGufziSQiNb9xKWTy1uFgY Co-authored-by: Claude <noreply@anthropic.com>
… security layer, SQLite and PostgreSQL Claude-Session: https://claude.ai/code/session_01WGufziSQiNb9xKWTy1uFgY Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziSQiNb9xKWTy1uFgY Co-authored-by: Claude <noreply@anthropic.com>
…y and contract in the query-lowering facet engine.ts is in facade form (check:facade-delegation-only): its members are one forwarding call and the file does not grow. The method's docblock and body move to engine-query-lowering.ts; engine.ts grows by the one forwarder line, which still needs its ceiling raised by maintainer ruling. Claude-Session: https://claude.ai/code/session_01WGufziSQiNb9xKWTy1uFgY Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 21 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 4dc7a248f7143eb1bd68a990b7596f9597e4b7b7 && git checkout 4dc7a248f7143eb1bd68a990b7596f9597e4b7b7
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4b8a67d8fabe96eac4110a418ae53cb1e0f6f025 fa986c2ec8e27c04bdbd03e125708313c327671f && git checkout -B drift-repro 4b8a67d8fabe96eac4110a418ae53cb1e0f6f025 && git merge --no-ff fa986c2ec8e27c04bdbd03e125708313c327671f
node scripts/docs-audit/affected-docs.mjs --json 4b8a67d8fabe96eac4110a418ae53cb1e0f6f025
|
…col none The level follows the metadata protocol alone (pr-automation.yml, WHICH LEVEL); this diff changes nothing a metadata author can write. Claude-Session: https://claude.ai/code/session_01WGufziSQiNb9xKWTy1uFgY Co-authored-by: Claude <noreply@anthropic.com>
…e integration test Seven find() calls take EngineQueryOptions instead of an any cast, and the JSON-copy refusal call, whose input is off-contract on purpose, names the contract it bypasses (as unknown as EngineQueryOptions). The test surface of check:query-options-erasure stays at its ceiling of 236. Claude-Session: https://claude.ai/code/session_01WGufziSQiNb9xKWTy1uFgY Co-authored-by: Claude <noreply@anthropic.com>
…eadScope forwarder Maintainer ruling 7340529355 (option A): one forwarder line on the ObjectQL class, the shape of ruling 7314474264. baseLines 6861 measured at c7fc353. Claude-Session: https://claude.ai/code/session_01WGufziSQiNb9xKWTy1uFgY Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm Contract-review-claim: session_01WGufzhGA3zoCFquQgku4pm · head fa986c2 · 2026-12-02T09:17Z |
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm Contract reviewServed-tier: PR #39100 for card #39080, net diff against merge-base Check-runs on the head, read twice (09:18Z and 09:23Z, 2026-12-02); not waited for:
① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNo must-fix, no should-fix. packages/objectql/src/engine-query-lowering.ts (
packages/objectql/src/relation-semi-join.ts. The two refusal builders agree with their docblocks and with the relation refusals they mirror (reason, route, "NOT applied", which drivers run it). The driver text claims nothing was read, which holds; the cap text does not claim it, which is right, since the target read ran. The header section naming the second consumer is accurate against the body. packages/objectql/src/engine.ts. One forwarder line in the Tests. The unit suite (14 cases, recording driver) and the integration suite (7 cases per dialect cell, real Nits. None affects correctness or the contract; each is for a prose face, an accepted deviation or a follow-up card, since a fix elsewhere moves the head.
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm L1 review — ACCEPT on
|
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS 席位核对ACCEPT — PR #39100 @
落地
State change: ready for review + auto-merge, by the owning seat; on merge it closes #39080. |
Requested by Yibo Wang · project thread
Fixes #39080
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
ObjectQL#planReadScope(object, target, { where, context })— a new public member on the published engine, for in-process callers. It answers the$incomparand that scopes a column ofobjectto the ids of thetargetrecords the caller reads andwherematches. Placed in a read verb'swhereonobjectunder the same context, the read reaches a SQL driver as one statement:column IN (SELECT id FROM target WHERE target's read scope AND where AND tenant wall).It is the planned read the single-valued nested-relation condition already runs (
relation-semi-join.ts,planRelationSemiJoinLeaf/relationSemiJoinServes), entered by name, so a column that is NOT a declared relation (the platform-stampedsys_comment.record_id) can be scoped. Outcomes are a relation condition's: the planned leaf where it is provably the id read; otherwise the ids the caller reads under the 1,000 cap, refusedINVALID_FILTER/ 400 past it; refusedINVALID_FILTER/ 400 before anything is read when the driver ofobjectlacksreadableIdsLeaf(MongoDB, OData);OBJECT_NOT_FOUNDfor an unregisteredobject. No new error code, no filter operator, no wire key.Layout, per the facade rule on
engine.ts(check:facade-delegation-only): the class gets ONE forwarder line (thegetRecordLockshape, through the delete-and-aggregate host); the body and the contract docblock live inengine-query-lowering.ts(planReadScope,PlanReadScopeOptions,ReadScopeComparand); the two refusal texts live beside the mechanism inrelation-semi-join.ts(readScopeDriverRefusal,readScopeCapError), whose header gains a section naming this second in-process consumer.packages/objectql/src/index.tsis untouched (it is on Setup navigation has ten new group anchors; a contribution to a retired group id still lands in the right group (#39050) #39053's claim): the member rides the already-exported class. Nopackages/specchange;IObjectQLEngineis untouched.ADR-0139 consumer note: not in this PR. Per the epic ruling (专题:列表页右上角的评论入口——看当前视图里各条记录的评论串,可回复、可解决,不能写新评论 #39077 comment 7338398195, item 6), the landing seat records it under the ADR bookkeeping rule.
Facade ceiling:
engine.tsgrows by the one forwarder line, 6860 → 6861. Maintainer ruling 7340529355 (option A, the shape of ruling 7314474264) raises its row inscripts/facade-delegation-registry.json:baseLines6861 measured atc7fc35317b,maxLines6861,ruling7340529355. That row is the only change to the registry.Tests
packages/objectql/src/engine-read-scope-leaf.test.ts(new, 14 cases, recording driver): planned path (target never read, one composed leaf scoped by the target read's finalwhere); the caller's context reaches the target read and the scope a global middleware injects lands in the subquery; target refusals propagate;OBJECT_NOT_FOUND; the up-front driver refusal across names and bit values, nothing read, plus the bit-not-name control;afterFindand object-keyed middleware fallbacks answer the id list (the lowering's exact read: condition,idonly, cap + 1); the cap refusal and its exactly-the-cap control; no cap on the planned path; JSON and spread copies refusedINVALID_FILTER; a hand-writtenReadableIds.ofis not the planned scope; a write verb refuses the leaf with ADR-0139's composition-fault envelope (INTERNAL_ERROR/ 500, as for any leaf).packages/plugins/plugin-security/src/comment-read-scope-semi-join.integration.test.ts(new, 7 cases per dialect cell): the realAuditPlugin(comment object, parent-pair stamp, read gate) and the realSecurityPluginoverSqlDriver, with three permission sets on the parent: full read, read narrowed by a row-level rule with one unreadable field, none.$in) and the rows the filter means; never a comment on another object.PERMISSION_DENIED, nothing read.PERMISSION_DENIED, the same as the two-step route (control: a member who may read it is served).where:INVALID_FILTER.Acceptance notes
object_name IS NULL, limit 2000), on the planned route and the two-step route alike. That probe is the gate's, not this card's; S3 (Comments: one read returns the threads on the records a list filter selects, as the caller #39084) will see it in its query log.PERMISSION_DENIED), and so is the two-step route's first read; the planned route gives exactly that answer. The comment read by that member serves no comment on the parent (the gate's own answer), which is the zero rows a list page would show.OS_TEST_POSTGRES_URL, creates its own database and drops it. No CI job provisions that variable for plugin-security, so it is un-run in CI; its local run is below.Verification
Two-minute check:
cd packages/objectql && pnpm exec vitest run src/engine-read-scope-leaf.test.ts— expect 14 passed.Read first, by risk:
packages/objectql/src/engine-query-lowering.ts—planReadScope: the order of the checks and that the planned and id reads are the relation lowering's exact read.packages/objectql/src/engine.ts— the one forwarder line and the host it borrows.packages/plugins/plugin-security/src/comment-read-scope-semi-join.integration.test.ts— the parity and statement assertions.Local readings (code head c7fc353, on main 7814822 + merge of origin/main; later commits: changeset grade, typed test options, the ceiling row)
pnpm exec vitest run src/engine-read-scope-leaf.test.ts(objectql): 14 passed.OS_TEST_POSTGRES_URL=postgres://…@127.0.0.1:5432/postgres pnpm exec vitest run src/comment-read-scope-semi-join.integration.test.ts(plugin-security, PostgreSQL 16.x local): 14 passed (7 SQLite + 7 PostgreSQL), 0 skipped.planReadScopedisabled on disk (falls back to the id read every time): unit 7 of 14 red, integration 8 of 14 red; restored from the commit,git statusclean.tsc --noEmit -p tsconfig.json(objectql): exit 0.dispatch-gates.mjs --commands, 76 commands): run locally; results and NOT MEASURED lines are in the report on objectql: a server read scopes a pointer column by a caller-run read of its target object #39080.check:facade-delegation-onlygreen after the ceiling row (44 self-test cases, N6 green,ObjectQL0 named exceptions);check:query-options-erasuregreen, test surface at its ceiling of 236.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufziSQiNb9xKWTy1uFgY