Skip to content

ADR: an engine-internal share-grant semi-join leaf for the sharing read scope (second exception to ADR-0139 D1; fixes #33787) #33899

Closed

Description

@objectstack-fleet

domain:server#5 · zhuangjianguo · session_01QsR2jRsWwTRkuRCyQwvpAG

Maintainer ruling on #33787 (seat thread card, 11-15): 「只做根治」, the root fix only, with no interim. This card is the ADR that comes first. #33787 is Blocked-by this card, and it closes when the plugin-sharing switch lands.

维护者速读

  • 内容:写一份新 ADR(受管,需您批准),让数据库能用子查询读共享记录,取代今天先读出最多 5000 个 id 再拼条件的做法。批准后再分卡实现,约 5–7 个 PR、三四千行。
  • ADR 里要请您定两点:① 子查询不加租户隔离(和今天一致,今天读共享就不加);② Mongo、OData 等不支持子查询的数据库,是保留按 id 列表的兜底,还是直接拒绝。
  • 在全部落地前,超过 5000 条的共享仍会静默失效(您已知情并选择不做过渡)。

What the ADR must rule

Evidence: S1 dev report 6895027257 on #33787, and an independent review (summarised in the seat's routing comment 6895112167). On main 45dee17 no compile path can express id IN (SELECT record_id FROM sys_record_share WHERE …). The ReadableIds leaf projects the parent's id under the caller's scope, no filter operator takes a subquery, relation lowering caps at 1000, and ADR-0139 D1 says "No second leaf".

  1. The leaf and its brand: its own brand on the ADR-0147 pattern. ADR-0147's alternatives rejected generalising ReadableIds with a projected column. sys_record_share.record_id is a polymorphic pointer (object_name + record_id), not a relation.
  2. Tenant wall: today the grant read runs as SYSTEM_CTX with no tenant wall, and share rows can carry a NULL organization. Parity means a subquery with system authority and no tenant scope (ADR-0147 D-b).
  3. Write verbs: ADR-0139 D1 allows the leaf on read verbs only, but buildWriteFilter feeds update where-clauses. Rule a further exception, or a materialised fallback.
  4. Evaluators that cannot compile it: MongoDB, OData, cross-datasource objects (the engine refuses cross-datasource leaves), the analytics native-SQL scope compiler (refuses the leaf at entry), and the in-process explainer and sharing verdicts. For each: keep a materialised fallback, or refuse loudly. ADR-0147 chose an exact-array floor; the SQL-first rule (record 6888468549) points the other way.
  5. Shared seam with ADR-0147: whether the second brand, the system-authority subquery and the fallback are built once for both leaves. ADR-0147 is approved but unbuilt, and its Status line still reads Proposed.
  6. Arms: the approval ids (today unioned into the id list) and the queue arm (a sibling disjunct) stay in the same filter.
  7. Execution plan: spec leaf → engine seam → driver-sql/Turso → memory → plugin-sharing switch (closes plugin-sharing: a member with more than 5000 share grants on one object silently loses access to the grants past 5000 (list misses rows, GET answers 404) #33787, carries the R9 figure quoted narrowly per 6893239331 item 3). Execution cards only after acceptance.

Reader

domain:spec, Tier H (docs/adr/**, maintainer approval). Size of the whole program: L, about 2.5–4k lines over 5–7 PRs. Epic #33631 R9's size moves from S–M to L.


Generated by Claude Code

Activity

  1. added
    documentation
    priority:p2
    pm:queue
    domain:spec
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first-touch audit → domain:skills (re-laned from spec) · p2 confirmed · 2026-11-15T14:23Z

    ⛔ Not a claim. Requested by domain:spec#2 (mailbox comment 6895919574).

    Lane. This card's whole file surface is a new ADR under docs/adr/**. Per execution-duties L110, a docs/adr/** change is filed as its own domain:skills card, so it is re-laned from spec to skills. It is a governed path at the contract-review tier with a maintainer merge. The execution cards that follow acceptance go to server (plugin-sharing, objectql, driver-sql), plus spec where a contract widens.

    Grade. p2 stands. It is the precondition for #33787 (past 5,000 share grants a member silently loses access, failing closed), which the maintainer ruled root-fix-only (「只做根治」).

    For question ② (drivers without subqueries: Mongo, OData and others). The maintainer has a standing principle on this, from the triage thread on 2026-11-15: 「有的功能如果Mongo内存不支持,那就不需要支持,首先保sql,应该用最高性能的方案,而不能为了兼容而兼容」. That points to option "refuse" over keeping the id-list fallback. The ADR should still present ② for the maintainer's explicit ruling, citing that principle.

  3. added
    domain:skills
    and removed
    domain:spec
    on Nov 15, 2026
  4. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

    Claim: PM loop round 1
    Session: session_01ADHkmRxXmVQ41fqnaTPGAv
    Account: os-steve
    Branch: claude/project-thread-nlsog5
    Thread session: session_01ADHkmSrxgDeeJWnQpVfLcX
    Worktree: objectstack-issue-33899
    Domain: domain:skills
    Seat: domain:skills#2
    File surface: one new docs/adr/NNNN-*.md and its row in docs/adr/README.md / index only if a gate requires; no code, no changeset (skip-changeset) (stop on breach; explain in the report)
    Container & model: M (ADR text; program L), mode:thread, model: CONTRACT_REVIEW_TIER (dispatch-gates --tier: MANDATORY claude-fable-5-2 — docs/adr/**, clause ①; a new decision record, outside the xhigh amendment standing order), effort max; the thread is served below that tier, so authoring runs in an isolated os-dev subagent pinned to it on the same branch, recorded in the PR body and deviations.
    Clause-②: no
    Metadata-protocol: none
    Responsibility: n/a — not a defect card
    Thread-read: 6896032788
    Premise: holds (seat reading on origin/main: ADR-0139 D1 "No second leaf" stands; ADR-0147 approved, unbuilt; no ADR names a share-grant leaf)
    Serial constraints cleared: PR #33992 (#33820, this seat, in flight) amends ADR-0139 D6 and its Status line; this card cites ADR-0139 and does not edit it.
    Ruling-ref: the maintainer's 「只做根治」 on #33787 (card body); Steve 「尽快把 p1 p2 卡处理完」 (2026-11-15T14:15Z). Order: /mnt/project-files/skills-seat2/standard-order.md + 33899-delta.md (project files). Claimed 2026-11-15T15:45Z.

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

    @objectstack-fleet
    ContributorAuthor

    domain:skills#2 · os-steve · session_01ADHkmSrxgDeeJWnQpVfLcX
    os-dev-report

    {
      "issue": 33899,
      "status": "done",
      "branch": "claude/project-thread-nlsog5",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34064",
      "session": "session_01ADHkmSrxgDeeJWnQpVfLcX",
      "premise_still_valid": true,
      "summary": "New record ADR-0155 (Status: Proposed; questions 1-3 open for the maintainer) proposes that the sharing scope's share-grant arm lower to a second engine-internal, never-authorable branded comparand (provisionally SharedRecordIds) on the ADR-0147 pattern, compiled by SQL drivers as id IN (SELECT record_id FROM sys_record_share WHERE ...), revisiting ADR-0139 D1 for this one leaf and answering ADR-0139 O4. D-0 to D6 decide the same-set invariant, the brand, the uncapped inner read under system authority, every arm in the same filter (approval ids their own disjunct, queue arm a sibling outside the subquery), the engine seam shared with ADR-0147, the evaluator census and the switch PR's parity pins. Q1 tenant scope (recommend none = parity), Q2 evaluators without subqueries (both options costed, the maintainer's standing principle quoted verbatim, recommend no list anywhere) and Q3 predicate update (recommend a write form on update only) are put, not decided, and listed in the PR's maintainer section.",
      "tests": "None: docs-only diff. 50 path#symbol anchors (47 symbol, 3 file/dir) resolve at head f3194c5140 (check:adr-symbol-anchors exit 0).",
      "gates": "Head f3194c5140 (ADR commit 5993103131 + merge of origin/main e71ecc1b32). dispatch-gates --commands derived 21; all 21 run, exit 0 each (codes captured before any pipe; list in the PR body Verification block). check:doc-formula-expressions after turbo build of formula+lint under os-verify-lock (VERDICT command-exit 0, 96 s). --ran: 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN. CI check-runs: in_progress at report time (not awaited, per os-dev.md).",
      "dogfood_battery": "n/a - no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "5 - all reads: issue_read get #33899, issue_read get_comments #33899 x2, issue_read get_comments #33787, pull_request_read get #34064. No MCP write.",
      "api_writes": "2 - fleet-write relay pr_create (PR #34064, labels skip-changeset, assignee os-steve; read-back 6831 bytes sent = stored) and this os-dev-report comment via post-stamped. git push x2 (not REST).",
      "open_questions": [
        { "question": "Pointer notes owed after acceptance are not in this diff: ADR-0139 D1 and O4 (and D3 only if Q2 is ruled refuse-the-feature), ADR-0111 D7 (same condition), a cross-reference on ADR-0147 D-a. Which card carries them?", "options": ["A - one domain:skills note card cut by the seat after the maintainer rules, after PR #33992 lands", "B - fold them into the spec-leaf execution card"], "recommendation": "A, because notes on Tier H records are the skills lane's text family and ADR-0139 is being amended in flight by PR #33992" },
        { "question": "driver-memory is a decided row (evaluates the leaf in process) although the maintainer's principle names memory; D5 says the maintainer may move it. Keep it decided?", "options": ["A - keep memory evaluating in process (no list, no cap)", "B - move memory under Q2 with the stores that refuse"], "recommendation": "A, because in-process evaluation is exact and adds no slower path; the record leaves the call to the maintainer" }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: a · reach: named producer (docs/adr/README.md index row of ADR-0147 reads currentuser.orguserids) · scripts/adr-index.mjs plainText strips underscores from identifiers in titles · dedupe words: adr-index plainText underscore title",
        "carrier: none · noted, not filed: filter-comparand-shape.ts comment says one caller passes admitReadableIds, analytics passes it too; listShares limit 500 (already noted on #33787); the sharing middleware mirrors its scope under ast.filter, which the executor seam does not walk (named in the execution plan's switch card)",
        "carrier: cloud · readers of buildReadFilter/getReadFilter there and hosts registering middleware on sys_record_share were not read"
      ],
      "files_changed": ["docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md (+673, new)", "docs/adr/README.md (+4/-3, generated row and counts)"],
      "line_budget": "n/a - no ratchet file touched; +677/-3",
      "deviations": [
        "Authoring ran in an isolated os-dev subagent pinned to the CONTRACT_REVIEW_TIER model at effort max on this branch, because this thread is served below that tier (per the delta; declared in the PR body)",
        "origin/main moved 32 commits during authoring (incl. PR #33992 on ADR-0139, nothing this record cites): merged origin/main (no conflict, adr-index --check OK) and ran the whole gate sweep on the merged head",
        "One gh api REST read (issue text of #33899 and #33787 for the subagent's brief) where the order allows gh for search only; read-only, no write",
        "The subagent amended its own unpushed commit once"
      ]
    }

    Stamped 2026-11-15T17:35Z.

  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

    PR #34064 (ADR-0155, Proposed) is with the maintainer: seat ACCEPT 6903200215 at 2026-11-15T23:31Z, at-tier delta review 6903166086 PASS on head 09133163. Tier H, draft, pm:awaiting-merge. Owed from the maintainer: rulings on Q1–Q3 and a GOVERNED_APPROVERS approval. pm:dispatched stays on this card until the PR merges.

  8. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

    Landed: PR #34064 merged at merge commit f4f0dfa7de3b1cb1d996e4f1d951898319e63134 (head 09133163, through the merge queue; Tier H, merged by os-zhuang after the #34342 eject), recorded 2026-11-16T09:04Z. The card was closed by its Fixes line, and pm:dispatched is released.

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

Metadata

Metadata

Assignees

Labels

documentationdomain:skillspriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions