Skip to content

objectql: a server read scopes a pointer column by a caller-run read of its target object #39080

Description

@os-support-ai

立卡门类别:③ 维护者直派(专题 #39077 的子卡)。Source: topic #39077
thread · os-support-ai · session_01WGufzirjTJ1sVFGR5sBPSL

Parent: #39077 · M1 打底 · card S1 of the epic's milestone table
定级:area:data · Feature · priority:p1 set by the maintainer (see the Ruling-ref comment) · reach: n/a (new capability, maintainer direct) · evidence: read (isolated analysis on #39077, Served-tier: CONTRACT_REVIEW_TIER, tier verified)

维护者速读

  • 让服务端能按「评论所指的记录满足某个条件」去读评论,全程按看的人的权限、一条查询完成;对外接口不变。

业务理由:维护者原话「设计列表页本身整个对象的评论入口」「用fable 分析,并立专题卡, p1」「按推荐」——在列表页上直接看当前视图里各条记录的评论串、回复和解决,不用一条条点进记录。已定的九条规则和七条待定的结论在 #39077 正文与其评论里,本卡不复述。

动手的读者:席位为本专题开的专区(维护者「这个专题直接派发吧,并发5」「开一个专区派发」),os-dev 按本卡施工。

Dedupe: 评论 列表 in:title, comments panel list view, view comments feed, list page comments, comments across records, Attio comments (objectstack, incl. closed) → no open card covers this; related #36062 (closed, origin topic), #35947 (open, paused sibling topic), #34157 (open p3, semi-join id cap — this card meets it).

Scope and acceptance

§N below points at the English analysis inside #39077.

  • Layer: backend (engine) · area:data · Feature · size M · p1
  • Scope:
    • One in-process engine entry that plans find(target, { where }) under a given execution context and returns
      the leaf to place as a $in comparand on another object's column — the mechanism the nested-relation
      lowering already uses, offered to in-process callers. No wire spelling, no filter operator, no new leaf.
    • Same outcomes as a relation condition: one subquery where provable; the id read under the existing cap
      otherwise; the existing up-front refusal on a driver without the leaf bit; refusal past the cap.
    • ADR-0139 consumer note: NOT in this card's file surface. Maintainer ruled (Q6, 「按推荐」) that no hand-approved amendment is needed first; the add-only note is the landing seat's ADR bookkeeping line (weekly "ADR revisions" card), per pm-dispatch execution duties.
  • Acceptance:
    • Integration test on SQLite and PostgreSQL: a find on sys_comment whose record_id is scoped by a planned
      read of a business object reaches the driver as one statement and returns exactly the rows the two-step
      route (read ids as the caller, then $in) returns — for an unrestricted member, a row-scoped member, and a
      member with no read on the target (zero rows).
    • A filter naming a field the caller cannot read is refused PERMISSION_DENIED, not answered empty.
    • On a driver without the bit the call is refused INVALID_FILTER / 400 before any read; past the cap likewise.
    • A JSON copy of the returned value placed in a request where is refused as today (no forgery path).
    • No public HTTP behaviour changes (observed: the REST suites untouched and green).
  • Order: no upstream card.
  • Clause-②: yes (widening) — a new public member on a published package's engine; in-process only.
  • Metadata-protocol: none
  • Likely files: packages/objectql/src/relation-semi-join.ts (planRelationSemiJoinLeaf,
    relationSemiJoinServes), packages/objectql/src/engine-query-lowering.ts (lowerRelationConditions),
    the engine class that binds them, their test files.

Generated by Claude Code

Activity

  1. added
    priority:p1
    pm:queue
    on Dec 2, 2026
  2. os-support-ai commented on Dec 2, 2026

    @os-support-ai
    CollaboratorAuthor

    Ruling-ref: priority:p1 — maintainer, project thread, 2026-12-02: 「用fable 分析,并立专题卡, p1」 (07:13Z) and 「按推荐」 (07:36Z); recorded on #39077.

    thread · os-support-ai · session_01WGufzirjTJ1sVFGR5sBPSL


    Generated by Claude Code

  3. os-support-ai commented on Dec 2, 2026

    @os-support-ai
    CollaboratorAuthor

    Card thread: yes — per pm-dispatch dispatch-runbook.md 卡线程 (big card = L/XL or contract change): Clause-②: yes (a new public member on a published engine package). Not a zone mode:subagent card.

    thread · os-support-ai · session_01WGufzirjTJ1sVFGR5sBPSL


    Generated by Claude Code

  4. objectstack-fleet commented on Dec 2, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS

    Claim: card thread of seat repo:objectstack@os-support-ai, epic #39077 (list-page comments, the maintainer's 「这个专题直接派发吧,并发5」), M1 card S1
    Session: session_01WGufzhPdWmTd47Fi2bKYZS
    Thread session: session_01WGufziSQiNb9xKWTy1uFgY
    Account: os-support-ai
    Branch: claude/project-thread-7aatw7
    Domain: domain:server
    Seat: repo:objectstack@os-support-ai
    File surface: packages/objectql/src/relation-semi-join.ts, packages/objectql/src/engine-query-lowering.ts, packages/objectql/src/engine.ts, packages/objectql/src/engine-read-scope-leaf.test.ts (new), packages/plugins/plugin-security/src/comment-read-scope-semi-join.integration.test.ts (new: a real sys_comment with the audit plugin's gate and the security plugin over the SQL driver; SQLite always, Postgres when OS_TEST_POSTGRES_URL is set; no package.json or lockfile change), a changeset. Not packages/objectql/src/index.ts (it meets #39053's surface): the new member goes on the already-exported ObjectQL class. No packages/spec, no docs/adr/**. Stop on breach; explain in the report.
    Container & model: M, mode:card-thread, model: TIER_DEFAULT (dispatch-gates --tier prints no MANDATORY line), effort: high; contract-tier L2 at CONTRACT_REVIEW_TIER (seat's call: a new public read-scoping member on the engine, whose result the comment read path trusts).
    Clause-②: yes (widening): one new public async method on the published ObjectQL class
    Metadata-protocol: none
    Responsibility: n/a — feature card
    Premise: holds on main 7814822. planRelationSemiJoinLeaf, relationSemiJoinServes, the capped id read and the driver refusal exist but are private, and assertListComparandShapes admits a branded leaf as $in on read verbs. The shape: one public async method (outer object, target, where, context) that returns the $in comparand, either the planned leaf or, on fallback, the capped id list. It refuses with INVALID_FILTER up front on a driver without readableIdsLeaf, and past the cap. The PR carries a Postgres 16 run.
    ADR bookkeeping: per epic ruling 7338398195 item 6, the ADR-0139 note for the engine's second internal use of the sub-query mechanism is recorded by the landing seat under the pm-dispatch ADR bookkeeping rule. It is not on this card's surface.
    Serial constraints cleared: check-handover.mjs --inflight reads no overlap once index.ts is left out; the one unread surface is #38415, a cross-repo watch of this seat with no file.

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 2, 2026
  6. objectstack-fleet commented on Dec 2, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-support-ai · os-support-ai · session_01WGufziSQiNb9xKWTy1uFgY
    os-dev-report

    {
      "issue": 39080,
      "status": "needs_decision",
      "branch": "claude/project-thread-7aatw7",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39100",
      "session": "session_01WGufziSQiNb9xKWTy1uFgY",
      "premise_still_valid": true,
      "summary": "ObjectQL#planReadScope(object, target, { where, context }) answers the $in comparand that scopes a column of object to the ids of the target records the caller reads and where matches. It enters the planned semi-join the single-valued nested-relation condition already runs (planRelationSemiJoinLeaf / relationSemiJoinServes), so a non-relation column such as sys_comment.record_id is served as one statement; otherwise it answers the id list under the 1,000 cap (INVALID_FILTER past it), and it refuses INVALID_FILTER before any read on a driver without readableIdsLeaf. Layout per check:facade-delegation-only: one forwarder line in engine.ts (getRecordLock shape, deleteAndAggregateHost), body and contract in engine-query-lowering.ts, refusal texts in relation-semi-join.ts. needs_decision is ONLY the engine.ts line ceiling (6861 vs 6860, maintainer-only, with the seat on a decision card); the code is complete. Head 7eed02b3 (code identical to c7fc3531; later commits: changeset grade, typed test options), 6 files.",
      "tests": "packages/objectql: vitest run src/engine-read-scope-leaf.test.ts -> 14 passed (head c7fc3531). packages/plugins/plugin-security: OS_TEST_POSTGRES_URL=<local PG 16> vitest run src/comment-read-scope-semi-join.integration.test.ts -> Test Files 1 passed, Tests 14 passed (7 SQLite + 7 PostgreSQL, 0 skipped; head c7fc3531). Ablation (planned branch disabled on disk, falls back to the id read): unit 7/14 red, integration 8/14 red; restored from the commit, git status clean. objectql tsc --noEmit exit 0.",
      "gates": "Local, derived set (dispatch-gates.mjs --commands, 76 commands, exit codes captured before any pipe): 70 exit 0 on the first pass; then on the current tree: check:type-check-debt 0, check:query-options-erasure 0 after 7eed02b3 typed the eight new test call sites (it had read test surface 236 -> 244; now 236, at the ceiling), plugin-security typecheck 0 (incl. check:test-typecheck), objectql typecheck 0. RED: check:facade-delegation-only, on the engine.ts ceiling alone (6861 vs 6860, see open_questions). NOT MEASURED (prerequisite missing here, CI runs each): check:i18n (needs the CLI build closure), check:dual-build-cjs-loads (needs pnpm build), check-plugin-teardown-shape --self-test (shallow clone). CI: Check Changeset failed at c7fc3531 (objectql graded minor under Metadata-protocol none); fixed in b53d0ed7 (patch). The c7fc3531 TypeScript Type Check and Lint & Repo Gates lanes concluded cancelled, superseded by the b53d0ed7 push. At b53d0ed7, Lint · repo & tooling gates is red on the facade gate step alone (the ceiling, as above). Head now 7eed02b3; CI running.",
      "mcp_calls": "0",
      "api_writes": "2 — fleet-write relay (objectstack-fleet[bot]): pr_create POST /repos/objectstack-ai/objectstack/pulls (draft #39100, assignee os-support-ai, run 46841929640, read-back 8172/8172 identical); POST /repos/objectstack-ai/objectstack/issues/39080/comments (this report, post-stamped)",
      "classifier_refusals": [],
      "open_questions": [
        { "question": "engine.ts is 6861 lines against its facade ceiling of 6860 (row ruling 7314474264); the one added line is the planReadScope forwarder. Raise the ceiling?", "options": ["A raise the engine.ts row to 6861 with a new ruling, baseLines/baseCommit re-measured", "B make planReadScope a barrel free function instead of a class member (touches packages/objectql/src/index.ts, on #39053's claim)", "C wait for an engine.ts split card to free lines"], "recommendation": "A, because the member is the card's named surface, the body already lives in the facet, and one forwarding line is the smallest growth the facade rule allows; with the seat's decision card to the maintainer" }
      ],
      "security_findings": "none",
      "out_of_scope_findings": ["carrier: #39084 (S3) · noted, not filed: the comment read gate issues its own `object_name IS NULL` probe statement (limit 2000) on every comment read, on the planned and the two-step route alike; S3 will see it in its query log", "carrier: none · noted, not filed: the PostgreSQL integration cell keys on OS_TEST_POSTGRES_URL, which no CI job provisions for plugin-security, so it runs locally only"]
    }
  7. objectstack-fleet commented on Dec 2, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS

    2026-12-02T09:11Z · Maintainer ruling recorded (decision card in the seat thread): the packages/objectql/src/engine.ts facade ceiling goes from 6860 to 6861.

    • Answered 2026-12-02T09:09Z, 「A 提到 6861」. The question: may the data engine's main file ceiling rise from 6860 to 6861 lines?
    • Scope: one forwarder line for planReadScope on the ObjectQL class, the same shape as ruling 7314474264 (getRecordLock / getRecordLocks). The body and docblock live in engine-query-lowering.ts. Not chosen: B (a free function exported from the barrel) and C (split engine.ts first).
    • The PR edits the engine.ts row in scripts/facade-delegation-registry.json: maxLines 6861, the base re-measured, and ruling set to this comment's id.

    Claim amendment (claim 7338665819): File surface (added): scripts/facade-delegation-registry.json, the engine.ts row only. Serial constraints: no other in-flight claim names that file.

  8. objectstack-fleet commented on Dec 2, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS

    Claim amendment · 2026-12-02T09:49Z · claim 7338665819, a second PR for the landing seat's ADR bookkeeping (epic ruling 7338398195 item 6).
    PR 2 file surface: docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md only. It adds a dated note recording the engine's second internal use of the semi-join leaf mechanism: ObjectQL.planReadScope (#39100), which the comment read path (#39084) consumes. What a request can write does not change. Branch: a new branch from main after #39100 merges, named in the PR. Part of #39080 (the card closes with PR 1). Tier H (docs/adr/**): handed to the maintainer, landed by the seat after approval.
    Serial constraints cleared: check-handover.mjs --inflight over the ADR reads no other in-flight surface on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:datapm:dispatchedpriority:p1

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions