Skip to content

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

Closed

Description

@objectstack-fleet

repo:objectstack#7 · os-tesla · session_01L9qibyXo4gSy8DJPNz4ANz

domain:server#5 · zhuangjianguo · session_01QsR2jRsWwTRkuRCyQwvpAG

Filing gate: ① a reproducible defect, measured by the area S2 bench agent for epic #33631 R9 (report 6893177082 on #33701). It fails closed: access is lost, never gained.

维护者速读

What happens (measured, SQLite, origin/main around d7e1a5a)

  • A member holds 6000 sys_record_share grants on account (7000 visible in total with ownership): the list returns 6000 instead of 7000, and GET /api/v1/data/account/:id of a granted account past the cut answers 404 RECORD_NOT_FOUND.
  • Control: with exactly 5000 grants every granted record is visible.

Why

SharingService#buildReadFilter (and buildWriteFilter) read the recipient's share rows with limit 5000 and turn them into an id list; rows past the limit are dropped with no error, notice or log.

Expected

Every grant counts, whatever the count. Preferred shape: compile the share leaf as a database semi-join (id IN (SELECT record_id FROM sys_record_share WHERE …)), the R9 item of epic #33631 (addendum 6893156419), instead of a materialised id list. If a cap stays for a driver without semi-joins, it must refuse loudly, never drop silently.

Reader

domain:server area A2 (plugin-sharing). Related: #33683 / PR #33771 (one share row per rule raises row counts per member; its review named this cap). Pins: 5000 and 5001+ grants, list and GET, both gates; ablate.

Dedupe

repo:objectstack-ai/objectstack is:issue sys_record_share 5000 and 5000 sharing buildReadFilter: only #33683, #33701 and #33631, none covering this.


Generated by Claude Code

O8 census (ADR-0155 plan step 6: recorded before the switch PR opens)

Trees read:

  • objectstack-ai/objectstack at 8c8ff0f25d: the in-repo reading below. No site changes a system read of sys_record_share. Part (2) is empty, so there is no D-0 finding.
  • objectstack-ai/hotcrm at e7fe77f0: read by this card thread. (1) Outside reader: none; only docs and comments name buildWriteFilter / sys_record_share. (2) No middleware, hook or record-view opt-in names sys_record_share; hotcrm has no readAudit config. (3) No registerMiddleware / registerHook in non-test code. Its one hook metadata (src/revenue/objects/product.hook.ts) is on crm_product, write events only.
  • objectstack-ai/cloud: not readable from the platform threads. It moved to cloud: the O8 census of objectstack-ai/cloud for ADR-0155 step 6 (the 5,000-grant cap retirement) #36115 (area:cloud) on the maintainer's word, 2026-11-21 14:43 UTC, verbatim: 「需要 cloud 仓库的任务,分配到 area:cloud」. cloud pins objectstack by version, so any adaptation lands on its own bump.

Tree: objectstack-ai/objectstack at 8c8ff0f25d (origin/main, read in worktree objectstack-issue-33787).
Read by: the os-dev worker for #33787, session session_01L9qibyXo4gSy8DJPNz4ANz, 2026-11-21.

The question for every site in part (3): does it CHANGE a system read of sys_record_share? Today's
grant read is engine.find('sys_record_share', { where: { object_name, recipient_type: 'user', recipient_id [, access_level $in] }, fields, limit: 5000, context: SYSTEM_CTX })
(packages/plugins/plugin-sharing/src/sharing-service.ts:818 and :940), where
SYSTEM_CTX = { isSystem: true, positions: [], permissions: [] } (:89): system authority, no
userId, no tenantId, no flowRunId, no app-automation elevation mark. From the switch on, the
SharedRecordIds subquery runs none of the engine's middleware or hooks, so a site that changes that
read today would make the subquery diverge from today's list (D-0, Q1 A).

Verdict: no site in this tree changes a system read of sys_record_share. Part (2) is empty. No D-0
finding, so the work continues.

Method: git grep over packages/**/*.ts, examples/**, apps/**, excluding *.test.ts,
*.spec.ts, test/, __tests__/, tests/, for .registerMiddleware(, the indirect spellings
const register = (…).registerMiddleware + register.call(…), registerHook( (literal and
variable event names; each variable-event site read to its event list), the ObjectQL#on alias, and
(before|after)Find anywhere outside the engine's own dispatch. The objectstack-ai/hotcrm tree
(e7fe77f0) was read by the card thread; objectstack-ai/cloud is not readable from here and is owed
by the seat.

(1) Readers of buildReadFilter / buildWriteFilter and of the security service's read filter

Site (path:line) What it reads Context it reads under Verdict
packages/plugins/plugin-sharing/src/sharing-plugin.ts:1490 buildReadFilter(ctx.object, exec) in buildSharingMiddleware (find/findOne/count/aggregate) the operation's own context (user); a system context bypasses (shouldBypass, answers null) the leaf's recipient is the operation's user, so the seam admits it
packages/plugins/plugin-sharing/src/sharing-plugin.ts:1509 buildReadFilter for the delegator leg of an on-behalf-of read delegated: { ...exec, userId: onBehalfOf.userId, onBehalfOf: undefined } the leaf's recipient is the operation's delegator (onBehalfOf.userId), so the seam admits it (D4)
packages/plugins/plugin-sharing/src/sharing-plugin.ts:1674 buildWriteFilter(ctx.object, exec, verb) on a predicate update/delete the operation's own context (user) write form on update; delete stays owner-only, no leaf
packages/plugins/plugin-sharing/src/sharing-plugin.ts:1677 buildWriteFilter for the delegator leg delegated (as :1509) admitted by the delegator rule
packages/plugins/plugin-security/src/security-plugin-sharing-verdicts.ts:161 resolveSharingReadFilter → sharing.buildReadFilter(object, { ...context, __readScope, ...grantPatch }) whatever context its caller hands it (rows below); the spread keeps userId / onBehalfOf pass-through of the shape; no change needed (A1)
packages/plugins/plugin-security/src/security-plugin-read-filter.ts:133 getReadFilter → resolveSharingReadFilter (non-delegated) the caller's context leaf composed for that caller; rides into ReadableIds scopes and analytics
packages/plugins/plugin-security/src/security-plugin-read-filter.ts:241, :242 computeDelegatedReadFilter → resolveSharingReadFilter for the agent leg and the delegator leg delegated: the agent's context and the delegator's rebuilt one one leaf per identity, the pair D3 names; both admitted by the recipient rule
packages/plugins/plugin-security/src/security-plugin-explain-access.ts:409 / :486 the explainer's sharingReadFilter (buildReadFilter for an on-behalf-of explanation, else readFilterWithReadScope) the EXPLAINED principal's context, which may differ from the asker's in process, no seam: step 5 resolves every leaf at the record (resolveFixedReadLeaf, :491, system read); no change needed (A1)
packages/objectql/src/engine-readable-ids-permission-formula.ts:460 svc.getReadFilter(parent, context) composing a ReadableIds scope the reading context of the operation (user or delegated) the leaf sits inside the composed scope; the seam descends into it
packages/services/service-analytics/src/plugin.ts:796 getReadFilter(object, context) for the native compiler and the engine strategy the request's context (callCtx, built per request) the native compiler compiles the leaf after asking fixedReadLeafClassOf (#35954); declines otherwise
packages/plugins/plugin-security/src/security-plugin.ts:2354, security-plugin-security-service.ts:154 the ISecurityService.getReadFilter binding n/a (bindings, not readers) n/a
packages/plugins/plugin-sharing/src/exec-context-annotation.pin.ts:133, :155 a type pin calling buildReadFilter compile-only n/a

(2) Registrations naming sys_record_share by name

Kind Site Verdict
object-scoped middleware (hasObjectMiddleware('sys_record_share')) none in the tree none
beforeFind / afterFind hook for sys_record_share none: the only find hook outside the engine is packages/plugins/plugin-audit/src/read-audit.ts:732 (afterFind, object: [...auditedObjects]) none by default
a default that opts the table into record-view auditing packages/plugins/plugin-audit/src/audit-plugin.ts:679: this.options.readAudit?.objects ?? [], default empty; read-audit.ts:451 filters by AUDIT_EXCLUDED_OBJECTS (audit-writers.ts:288, :410), which does NOT list sys_record_share, so a host CAN opt it in. Every in-repo opt-in names contact / account (README, content/docs/permissions/record-view-auditing.mdx) none by default; a host that opts it in is in the class and its boot is refused from the switch on

(3) Middleware and find hooks registered with NO object (or '*'), and the object-scoped sites the dispatch listed

Site (path:line) Registered for What it does on a system find of sys_record_share Changes the grant read?
packages/plugins/organizations/src/organizations-plugin.ts:353 no object if (opCtx.context?.isSystem) return next() first; otherwise stamps organization_id on an insert only no
packages/plugins/organizations/src/organizations-plugin.ts:455 no object await next() first, then acts only on an insert/create of sys_member / sys_organization no
packages/plugins/organizations/src/organizations-plugin.ts:647 no object await next() first, then isDefaultOrganizationBootstrapTrigger (writes to sys_user / sys_user_permission_set only, plugin-auth/src/ensure-default-organization.ts:250) no
packages/plugins/plugin-approvals/src/payload-predicate-guard.ts:292 { object: APPROVAL_REQUEST_OBJECT } never runs on sys_record_share; also skips isSystem no
packages/plugins/plugin-approvals/src/payload-redaction-middleware.ts:110 { object: APPROVAL_REQUEST_OBJECT } never runs on sys_record_share no
packages/plugins/plugin-approvals/src/reader-locale-labels-middleware.ts:121 { object: APPROVAL_REQUEST_OBJECT } never runs on sys_record_share no
packages/plugins/plugin-approvals/src/request-read-gate.ts:287 { object } (sys_approval_request) never runs on sys_record_share no
packages/plugins/plugin-audit/src/activity-field-redaction.ts:787 { object: ACTIVITY_OBJECT } (:830) never runs on sys_record_share no
packages/plugins/plugin-audit/src/activity-read-visibility.ts:154 { object: ACTIVITY_OBJECT } (:170) never runs on sys_record_share no
packages/plugins/plugin-audit/src/activity-summary-message.ts:403 { object: 'sys_activity' } never runs on sys_record_share no
packages/plugins/plugin-audit/src/audit-log-field-redaction.ts:248 { object: LEDGER_OBJECT } (:268) never runs on sys_record_share no
packages/plugins/plugin-audit/src/audit-log-read-visibility.ts:257 { object: LEDGER_OBJECT } (:277) never runs on sys_record_share no
packages/plugins/plugin-audit/src/comment-access-hooks.ts:1298, :1299 sys_comment, sys_comment_reaction never runs on sys_record_share no
packages/plugins/plugin-auth/src/auth-plugin.ts:1916 no object await next() first, then isDefaultOrganizationBootstrapTrigger (writes only) no
packages/plugins/plugin-auth/src/auth-plugin.ts:2326 no object `if (userId
packages/plugins/plugin-auth/src/auth-manager.ts:3805 (via register.call) no object await next() first, then acts on a sys_member insert only no
packages/plugins/plugin-auth/src/signing-key-read-cache.ts:128 (via register.call) { object: KEYRING_OBJECT } never runs on sys_record_share; reads pass through no
packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts:2974 no object before its isSystem bypass (:733) it only bumps the write epoch on writes, refuses elevated identity / append-only WRITES (flow-system-identity-write-refusal.ts:164, :254; SYSTEM_CTX carries no elevation source) and stamps an action-body INSERT; a system read then returns next() with the AST untouched no
packages/plugins/plugin-security/src/security-plugin-start-hooks.ts:116 { object: POSITION_ASSIGNMENT_OBJECT } never runs on sys_record_share no
packages/plugins/plugin-security/src/security-plugin-start-hooks.ts:532 no object await next() first, then shouldReplayBootstrapFor (sys_user / sys_account writes only, bootstrap-platform-admin.ts:451) no
packages/plugins/plugin-security/src/security-plugin-start-hooks.ts:555 no object await next() first, then acts on a sys_member write only no
packages/plugins/plugin-sharing/src/sharing-plugin.ts:914 { object: '*' } sys_record_share + !isSystem scopes a caller to rows naming them (:1476); a SYSTEM read falls to buildReadFilter('sys_record_share', SYSTEM_CTX), which bypasses (system context, and the table is on bypassObjects, sharing-service.ts:731) and answers null, so the AST is untouched no
packages/plugins/plugin-sharing/src/sharing-plugin.ts:976 no object await next() first, then acts on a sys_organization insert only no
packages/runtime/src/app-plugin.ts:2410 no object await next() first, then acts on a sys_user insert only no
packages/runtime/src/app-plugin.ts:2479 no object await next() first, then acts on a sys_organization insert only no
packages/services/service-mailbox/src/mail-read-visibility.ts:316, :320 MAIL_MESSAGE_OBJECT, MAIL_ASSOCIATION_OBJECT never runs on sys_record_share no
packages/services/service-messaging/src/inbox-reader-locale.ts:139 { object: objectName } (the inbox object) never runs on sys_record_share no
packages/services/service-storage/src/attachment-access-hooks.ts:1145 { object: ATTACHMENT_OBJECT } never runs on sys_record_share no
packages/services/service-settings/src/settings-read-door.ts:120 (via register.call) the four settings objects never runs on sys_record_share no
packages/core/src/security/request-grants-memo.ts:177 (via register.call) no object a read operation returns next() at once (write observer only) no
packages/core/src/security/resolve-authz-context.ts:3301 (via register.call) no object returns next() for an unwatched object or a read (write-generation counter only) no
packages/metadata-protocol/src/meta-overlay-cache.ts:362 (via register.call) no object returns next() for an unwatched object or a read no
packages/objectql/src/engine-hooks-and-functions.ts:186 sys_metadata, sys_metadata_history never runs on sys_record_share no
packages/verify/src/flow-run.ts:318 no object returns next() for every operation outside insert/update/delete/purge/restore no
packages/verify/src/handle.ts:744 no object returns next() unless an observation is open AND the operation is a write no
find hooks with no object none: objectql/src/plugin.ts:2270–2290 builtins are '*' on beforeInsert / beforeUpdate only; objectql/src/hook-binder.ts:350 binds app-authored metadata hooks, and no in-repo metadata hook declares a find event — no

What this census does not cover

  • objectstack-ai/cloud: not readable from this session; owed by the seat before the switch lands (its
    readers of buildReadFilter / getReadFilter and the context each runs under; any registration naming
    sys_record_share; any readAudit opt-in of it; any no-object registration that changes a system read).
  • App-authored hooks bound by hook-binder.ts on a host (object: '*', a find event): outside this tree
    by construction; they are D4's boundary, and the changeset tells the host.

Activity

  1. added
    bug
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jRsWwTRkuRCyQwvpAG

    This card also carries epic #33631 R9 · 2026-11-15T10:51Z

    The R9 addendum (6893156419 on #33631, measured by #33701, bench PR #33783) ranks the sharing scope second and names the same target shape as this defect's fix. No separate R9 card will be filed; the fix here is the R9 work. Three constraints for whoever claims it:

    1. Keep every arm inside the subquery. The share leaf becomes id IN (SELECT record_id FROM sys_record_share WHERE …), read once per statement. The approval, queue (sys_queue queue-sitting match) and tenant-wall arms the read filter applies today stay inside that predicate. None of them may move out to the app or be dropped. buildWriteFilter takes the same shape.
    2. Parity test. Pin that the subquery and today's id list return the same answer below the cap on both SQLite and PostgreSQL, for the list total and GET by id, with each arm exercised. Above the cap, pin the corrected answer: 6000 grants plus 1000 owned gives 7000 visible, and the 6000th granted record answers 200. Ablate.
    3. Quote the speed figure narrowly. The I9 reading "PG 21.6 → 7.0 ms" covers the scope statements alone: account page, total and two grant reads, at 1M rows and 5000 grants. It is not a whole-request figure. On SQLite the same pair measured 18.3 → 12.1 ms, and the line-item chain stayed flat. The PR may claim the defect fix plus that narrow figure, nothing wider.

    Area A2 (plugin-sharing). Serial with PR #33771 (#33683), which changes how many share rows a rule writes.

  3. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:server · lease:A2 · p2 · 2026-11-15T11:48Z

    ⛔ Not a claim.

    Above 5,000 share grants on one object, a member silently loses access to the rest: lists miss rows and GET answers 404. It fails closed, so no leak. Access is silently lost (p1 row), but only past 5,000 grants per member per object (−1), so p2. A2 (sharing). Found by the epic #33631 bench (R9).

  4. added
    domain:server
    pm:queue
    priority:p2
    on Nov 15, 2026
  5. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

    Claim: server area S1 (A1+A2) under #33751 §2 area-lease mode, area A2, seat domain:server#5 · p2 (also epic #33631 R9 per 6893239331) · executed by an os-dev subagent of the area S1 thread · posted at 2026-11-15T13:22Z
    Session: session_01QsR2jVPGBoi3MCGoKbW1Hv
    Account: zhuangjianguo
    Branch: claude/area-A2-33787
    Worktree: objectstack-area-A2-33787
    Domain: domain:server
    Seat: domain:server#5
    File surface: packages/plugins/plugin-sharing/src/sharing-service.ts (buildReadFilter, buildWriteFilter) and the plugin-sharing tests; the filter shape it returns must use a semi-join form the engine already compiles (no new objectql/driver compile path in this card: a missing compile path is a stop-and-report); a changeset (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: default (no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: plugin-sharing buildReadFilter/buildWriteFilter read share rows with limit 5000 and drop the rest silently (objectstack) | none | members holding more than 5000 grants on one object; reached sooner after PR #33771's one row per rule
    Thread-read: 6893852648
    Premise: holds
    Serial constraints cleared: PR #33771 (#33683) merged 1381f08; #33782 (this area, tests only in plugin-sharing/plugin-security, disjoint files); #33696 (objectql engine-readable-ids, not on this surface)

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

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
    os-dev-report

    {
      "issue": 33787,
      "status": "needs_decision",
      "branch": "claude/area-A2-33787",
      "pr": null,
      "session": "session_01QsR2jVPGBoi3MCGoKbW1Hv",
      "premise_still_valid": true,
      "summary": "Stopped before writing code, as the dispatch order says to when its first hypothesis fails. The defect is still there on origin/main 45dee177: buildReadFilter (sharing-service.ts L747-754) and buildWriteFilter (L869-877) read sys_record_share with limit 5000 and bind the result as id IN (list). The hypothesis was that the share leaf could reuse the ADR-0139 ReadableIds semi-join; it cannot. That leaf can only say 'the ids of P this caller may read'. The SQL compiler always projects the parent's id column (sql-driver-internal-helpers.ts readableIdsSubquery: getBuilder(parent).select(remoteColumn(parent, 'id', 'id'))), and the engine always composes its scope from getReadFilter(P, caller). It cannot select record_id from sys_record_share under a fixed system predicate. The filter vocabulary has no subquery operator, and the relation lowering builds a materialised id list capped at 1,000 (RELATION_FILTER_ID_CAP). ADR-0139 D1 forbids a second leaf ('No second leaf'), so the target shape needs a new ADR (Tier H) and objectql/driver work, which is outside this card. Options with four-axis analysis are in open_questions.",
      "tests": "No code written, no tests run. Code readings on origin/main 45dee177: (1) sharing-service.ts L747-754 and L869-877, limit 5000 on both grant reads, no warning or count check, so the defect holds. (2) driver-sql sql-driver-filter-helpers.ts L832-834: the composed ReadableIds leaf compiles via readableIdsSubquery, and sql-driver-internal-helpers.ts L136-141 selects only the parent's id column, with the outer read's tenant scope plus leaf.scope. (3) spec data/readable-ids.ts: ReadableIds.of(object) carries only an object name; compose(leaf, scope) carries only a scope. There is no slot for a projected column. (4) filter.zod.ts VALID_AST_OPERATORS is closed, with no subquery operator. (5) driver-mongodb mongodb-filter.ts L996-1002 refuses the leaf. driver-memory evaluates it in process, also against the parent id (memory-readable-ids-member.ts). (6) driver-sql has no chunking or json_each path for a large whereIn, so an unbounded id list binds one parameter per id. The defect is not reproduced again here: report 6893177082 reproduced it on SQLite and PostgreSQL 16 (6000 grants: 6000 of 7000 visible, GET of the 6000th grant 404).",
      "gates": "None run: the diff is empty, so no derived gate family reads any change. dispatch-gates --commands was not invoked.",
      "dogfood_battery": "n/a — no PR, no `!` in a title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "1 — this os-dev-report comment on #33787 via post-stamped (fleet-write relay). gh api reads only: issue #33787 with comments, comments 6893177082 and 6893156419",
      "open_questions": [
        {
          "question": "Choose the shape that makes every sys_record_share grant count in the read and write scope. No existing compile path can express id IN (SELECT record_id FROM sys_record_share WHERE ...). ADR-0139 D1 says 'No second leaf', and ADR-0147 is the one Proposed precedent for revisiting that rule for one more leaf.",
          "options": [
            "A — A second engine-internal, never-authorable semi-join leaf for the caller's share grants, decided by a new ADR on the ADR-0147 pattern (its own brand, not a mode of ReadableIds). plugin-sharing builds it with the recipient (user id), object name and, for the write filter, access_level IN WRITE_ACCESS_LEVELS. driver-sql compiles it to id IN (SELECT record_id FROM sys_record_share WHERE object_name = ? AND recipient_type = 'user' AND recipient_id = ? [AND access_level IN (...)]); sqlite-wasm and Turso local inherit it, and the Turso remote transport compiles it. driver-memory evaluates it in process with no bound. driver-mongodb refuses it with the ADR-0139 D3 envelope (500 INTERNAL_ERROR, logged once), since mongo is frozen. The approval arm becomes its own id IN (approvalIds) disjunct; today it is merged into the grant list. The queue arm (owner_id IS NULL AND queue IN (...)) stays a sibling disjunct, as today. One parity fork must be ruled: today the grant read runs as SYSTEM_CTX with no tenant wall. If the subquery takes the outer read's tenant scope, as ReadableIds does, a share row whose organization_id is NULL or another organization's stops counting. That narrows below today, so the subquery must carry no tenant scope of its own to keep parity. Four axes: business pull is measured (report 6893177082 reproduces the drop on both dialects; PR #33771's one row per rule raises row counts per member; the scope statements were PG 21.6 to 7.0 ms at 1M rows and 5000 grants). Long-term: SQL first (Prime Directive 5), and it closes ADR-0139's open item O4, which names this exact read. AI error: requests cannot spell the leaf, and every driver either compiles it or refuses loudly, never drops. Not expanding: it adds one internal leaf, no authorable surface. Cost: ADR (Tier H), spec brand plus api-surface, the objectql comparand door and executor seam, driver-sql, Turso remote, memory, mongo refusal, conformance cases, and the plugin-sharing switch with the parity pins of seat comment 6893239331. Roughly 1.5-3k lines over 3-5 PRs across spec, engine and server lanes; size L.",
            "B — Inside this card's surface: read every grant (keyset-paged, no cap) and bind the full id list. That removes the 5000 cut, but the cliff moves to the dialect's bound-parameter ceiling (SQLite 32766, PG 65535; documented, not measured; ADR-0139 O1). Past that ceiling the whole read throws, and inside a controlled_by_parent scope the list binds again within the subquery. It is also slower than the target: the id-list scope measured 21.6 ms against 7.0 ms on PG. Four axes: business pull is met only up to the ceiling. Long-term: it is the 'raised cap / unbounded $in' that ruling 6097072172 refused for the ADR-0139 class, and the 'slower path' Prime Directive 5 forbids. AI error: neutral. Not expanding: no new surface. Size S, about 100 lines plus pins.",
            "C — Inside this card's surface, as an interim: keep the cap but refuse loudly (read limit 5001; a 5001st row throws a located 500 naming the cap and the remedy). It meets 'never drop silently' but not 'every grant counts'. A member with more than 5000 grants on one object then loses every list and every GET on that object, including their own records, which is worse availability than today's short, fail-closed answer. Four axes: business — it trades a silent under-grant for an outage for the same members. Long-term: an interim that has to be removed again; 'transition also tight' (创业阶段不渐进) argues against two shapes. AI error: loud beats silent. Not expanding: none. Size S."
          ],
          "recommendation": "A, with no interim. Long-term fit leads: it is the SQL-first shape that ADR-0139 O4 already points at, and it is the only option that makes every grant count on every SQL driver, with no new ceiling. The defect fails closed and is triaged p2, so no leak forces an interim. C would turn under-grants into outages, and B is the shape the ADR-0139 ruling refused. A needs a Tier H ADR, which is the maintainer's to approve. The ADR should also rule the tenant-wall parity fork above (recommend: no tenant scope inside the share subquery, which matches today's SYSTEM_CTX read)."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: seat (mechanism correction for the R9 constraints, 6893239331 item 1) · noted, not filed. On 45dee177 the approval and queue arms are not inside the share predicate. Approval ids are unioned into the same id list as the grants (L760-764). The queue arm is a sibling disjunct on the target table (L768-770). No tenant wall is applied to the grant read at all: it runs as SYSTEM_CTX, which has no tenantId. 'Keep every arm inside the subquery' can therefore only mean 'keep every arm in the same filter, none moved to the app'. Recorded so that whoever writes option A does not move the queue arm into a share subquery that cannot express it.",
        "carrier: none · noted, not filed. SharingService#listShares (sharing-service.ts L2305-2308) reads a record's share rows with limit 500 and no notice, so the management listing of one record's recipients is silently cut past 500. Read from source only: no public-door measurement and no named producer of more than 500 recipients on one record, so it is not filed. Dedupe words: listShares limit 500, record share list truncated"
      ],
      "deviations": [
        "No draft PR, changeset or gate sweep: the dispatch order's stop condition was met (no existing compile path), so the card is returned as needs_decision under 何时停手不写码",
        "The worktree objectstack-area-A2-33787 was created with no edits and no pnpm install. It is removed after this report"
      ],
      "files_changed": [],
      "line_budget": "0 / 0: no diff",
      "loose_ends": [
        "Once A is ruled: the ADR and its execution cards (spec leaf, engine seam, driver-sql and Turso remote, memory, mongo refusal), then the plugin-sharing switch on this card. The switch carries the seat's parity pins: below the cap on SQLite and PG, list total and GET, each arm exercised; 6000 grants plus 1000 owned gives 7000 visible, and the 6000th grant answers 200; ablated",
        "The I9 speed figure (PG 21.6 to 7.0 ms) stays quoted narrowly per 6893239331 item 3 on whatever PR lands the switch"
      ]
    }
  8. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jRsWwTRkuRCyQwvpAG

    Routing · 2026-11-15T13:34Z: needs-user-decision. Area S1's dev found that the target shape (a share semi-join) has no compile path on main and needs a new Tier H ADR, a further exception to ADR-0139 D1 (report 6895027257). An independent Fable review confirmed the four claims. It also found that A is under-scoped: write verbs, the analytics native-SQL scope, the in-process explainer and verdicts, and cross-datasource objects. It proposes an interim: a completion read up to a bind-safe bound, with an error-level log past it. That interim is also the fallback A needs. The question is with the maintainer.

    Correction to my constraint 1 (6893239331): today approval ids are unioned into the grant id list and the queue arm is a sibling disjunct, so read it as "every arm stays in the same filter", not "inside the subquery". Also noted, unfiled: listShares caps one record's share rows at 500 with no notice.

    State: pm:dispatched → needs-user-decision, assignee cleared (claim 6894965086 released; area S1 re-claims after the ruling).

  9. added
    needs-user-decision
    and removed
    pm:dispatched
    on Nov 15, 2026
  10. 44 remaining items

  11. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu

    Precondition for step 6, from #35952 / PR #36001 (the Oracle RAW(16) arm of ruling A) · 2026-11-21T05:44Z

    When the producer starts writing the share-grant leaf, a grant on an object whose key is an Oracle RAW(16) uuid must store only canonical uuid text in sys_record_share.record_id. Measured on live Oracle Free 23ai: the leaf answers the list's rows for every grant the list admits. A stored record_id the list would refuse behaves differently:

    • Not hex, or braced: the list answers INVALID_FILTER/400, the leaf DATABASE_ERROR/500 with ORA-01465.
    • Hex of another length: the list answers 400; the leaf drops that grant silently and answers its siblings' rows.

    On PostgreSQL both forms fail the whole statement (22P02). Seat 7 accepted the Oracle difference at seat level because both sides fail closed, and L1 (7058114575) asked that step 6 carry this precondition. The alternative is option B: refuse a non-uuid record_id at the grant write door for RAW-keyed objects, which is a new refusal and the maintainer's call.

  12. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu

    Correction to 7058138586 (#35952 / PR #36001) · 2026-11-21T06:27Z

    That note said a stored hex record_id of another length is dropped silently by the leaf on an Oracle RAW(16) key. That is no longer so. After the contract review's M1 (7058145514), PR #36001 head 869573acbd gates the projection on the list's own UUID_TEXT check. Measured on live Oracle Free 23ai, every grant the list refuses now fails the leaf's statement with DATABASE_ERROR/500, ORA-01465: 31 or 33 digits, misplaced dashes, dash-only, blank, not hex, braced. Every form the list admits answers the list's rows. The review ruled the 400-vs-500 envelope no change to D-0. The canonical-uuid precondition for step 6 still stands, now so that a producer never writes a grant that fails every read of that object.

  13. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibyXo4gSy8DJPNz4ANz

    #35960 does not block this card · 2026-11-21T09:19Z

    Seat 7 asked whether #33787 should carry Blocked-by: #35960. The answer is no. #35960 (Oracle: a parent with a RAW(16) uuid key, named inside a composed ReadableIds scope, is never primed) was wrong before this switch, and the switch leaves it exactly as wrong. The reading below is of merged main 907b3783d7, with step 6 built locally on top of it.

    • The leaf's conversion uses the same map as the list. sql-driver-filter-helpers.ts:867-868 passes oracleRawUuid = isOracle && oracleRawUuidFieldsByObject.get(table)?.has(localField) to fixedReadLeafSubquery, which projects HEXTORAW(…) only when that flag is true (sql-driver-internal-helpers.ts:235). The list's HEXTORAW binding reads the same map (coerceFilterValue, sql-driver-filter-helpers.ts:199).
    • That map is primed only at the door's own object and at the aggregate's joined parents. sql-driver-field-mapping.ts:69-84 (primeOracleRawUuidColumns) is called from findRows, the bulk doors, distinct, the window functions, the query plan and the aggregate's join parent. readableIdsSubquery (sql-driver-internal-helpers.ts:160-166) compiles the parent scope with no prime.
    • So an unprimed RAW(16) parent's share arm compiles as text, the same RAW-against-text pairing the list's text binds make today. The merged docblock says so: "an unprimed key compiles as the list's text binds do" (sql-driver-internal-helpers.ts:215). The miss is the same. The switch adds no new refusal and no new dependency on the prime.

    Beside #35960, inherited from #36001 and named here for the switch's record. On a primed RAW(16) key, a grant whose record_id is not uuid text used to be refused by the list before any SQL ran (INVALID_FILTER/400, assertOracleUuidComparand). After the switch, the statement fails with ORA-01465 and answers 500, the ADR-0155 D4 envelope family. Grants the list admits still give the list's rows. The switch PR declares this change in its body.

  14. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibyXo4gSy8DJPNz4ANz

    Claim amendment · 2026-11-21T09:22Z · file surface (seat 7's call 2026-11-21T09:20Z)

    Claim 7057675017's file surface gains four paths that this switch makes due. Each was out of the claim, and the build found it:

    • docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md: a dated, append-only note that repoints the line-160 anchor away from the removed sharing-service.ts#grantedRecordIds. While that anchor stands, check:adr-symbol-anchors stays red. This is governed text (Tier H).
    • packages/spec/src/contracts/sharing-service.ts: the ISharingService prose ("Today … / Until that switch …"), which goes stale at the switch. This is a spec face, so L2 runs at CONTRACT_REVIEW_TIER.
    • skills/objectstack-data/rules/datasources.md: one line saying that share grants count only on objects stored on sys_record_share's datasource by a driver that evaluates the leaf. This is the PR's Skills-docs: updated here.
    • packages/spec/src/data/fixed-read-leaf-conformance.test.ts: a comment that still names grantedRecordIds.

    Still outside the surface, pending the maintainer's typed authorization, which seat 7 has asked for: packages/qa/dogfood/test/authored-row-write-scope.dogfood.test.ts:284-287, whose pin expects the bare owner match. The PR does not open before that authorization and the cloud half of O8's census are both in.

    Also recorded:

  15. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibyXo4gSy8DJPNz4ANz

    Claim amendment · 2026-11-21T11:10Z · file surface (maintainer-authorized)

    Claim 7057675017's file surface (already amended in 7060526112) gains one more path: packages/qa/dogfood/test/authored-row-write-scope.dogfood.test.ts:284-287. Its [integrity] assertion expects the bare owner match, and after the switch the write scope carries a share disjunct, so the assertion becomes toMatchObject({ $or: expect.arrayContaining([{ owner_id: bobId }]) }). Nothing else in that file changes.

    Authorization: the maintainer's reply 「同意」 2026-11-21T11:09Z, in seat 7's thread, to the seat's request for exactly this edit. The edit runs with hooks on. If it is refused again, it stops there.

    The push stays held until the cloud half of O8's census is in.

  16. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibyXo4gSy8DJPNz4ANz

    The cloud half of O8's census moved to #36115 · 2026-11-21T15:04Z

    This records, on the card itself, the word that moved it. L2 7064569198 escalated that it was only in the body.

    The maintainer (Tesla), 2026-11-21T14:43Z, in seat 7's thread, verbatim: 「需要 cloud 仓库的任务,分配到 area:cloud」. Seat 7 relayed it to this card thread at 14:44Z. That relay filed the cloud read as an area:cloud card, wrote the census line, and released the push hold that amendment 2 had set "until the cloud half of O8's census is in".

  17. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibyXo4gSy8DJPNz4ANz

    Claim amendment · 2026-11-21T16:09Z · round 4 on #36116, which answers contract review 7064569198

    No new path joins the file surface of claim 7057675017. The five files round 4 touches were already in the diff that review read.

    Head. 4f11b215c3, pushed fast-forward onto 53f788e776 on claude/project-thread-thptm0. It is one commit.

    • S1. ADR-0155 gains a second dated note, append-only, after D5. The note says driver-memory declares no fixedReadLeaves, so it answers as R2 from the switch on. Its share grants go inert, stop counting and fail closed, and the grant door and the rule door refuse with SHARING_NOT_ENABLED / 422. The note cites ruling 7045701086 and seat 7's call in 7060526112, and says that plan step 4, once it lands, makes those grants count again. Nothing else in the ADR moves.
    • S2. I ran shared-record-ids-switch.test.ts on a private PostgreSQL 16.15 cluster at that head and got 22 passed (22). Each cell gave 11 passed, 0 skipped and 0 failed. The reading is posted as comment 7064863601. The cluster was stopped and removed.
    • N1. The sys_record_share self-scope no longer mirrors into ast.filter. Two unit pins check that the key stays unset.
    • N2. The skill line now splits the refusals: the grant door and the rule-save door answer 422, and a sharingRules reconcile aborts. The file stays at its ceiling of 911 tokens. The PR body says why "Federation is read-only by default." stays cut.
    • N4. Two parity pins at 5,000 grants were added, one nested and one delegated, and they run in both cells. The counts above the cap stay as they were.
    • N3. Left to the seat.

    The PR body was refreshed through --ack-through=7064863601. It also receipts the docs-drift advisory 7064411467. Two hand-written pages list the causes of SHARING_NOT_ENABLED without the one this PR adds. They are named there and left to the seat.

  18. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv

    Hand-over of this card to seat repo:objectstack#4 · 2026-11-21T16:18Z

    Release: claim 7057675017 (amended by 7060526112, 7061720534, 7065426485; session session_01L9qibyXo4gSy8DJPNz4ANz, account os-tesla, seat repo:objectstack#7) is handed over by seat 7's split knock 7065484607 on mailbox #36124 and hand-off note 7065470406 on PR #36116. Provenance: the maintainer's order relayed by seat 7, 2026-11-21T15:26Z, verbatim 「在做的5张,开发完成后,用信箱交接给 4 号座位(座位贴 #34830,新信箱 #36124),让他负责审核落地。」
    Assignee: os-tesla → os-project-manager (same write as this comment).
    Hand-over record: development finished at claude/project-thread-thptm0@4f11b215c37f3e276d901369bd314735f9de627b, PR #36116, CI 61 success / 13 skipped / 0 failed, mergeable clean. Owed: full L1 at this head, contract delta closing S1 and S2 of 7064569198 by id, then the Tier H four pieces (seat record, pm:awaiting-merge, reviewers, final 速读) and the maintainer's approval.

    Claim: PM loop · hand-over re-claim · 2026-11-21T16:18Z
    Session: session_01FEkQ5krBqrrgxCYgjXmfbv
    Account: os-project-manager
    Branch: claude/project-thread-thptm0
    Domain: domain:server
    Seat: repo:objectstack#4
    Area: a4-C
    File surface: as in claim 7057675017 with its three amendments (unchanged by the hand-over)
    Container & model: review-and-land round, no dev dispatch at hand-over; a fix round, if owed, is L, mode:subagent, model: default tier, effort: xhigh
    Clause-②: yes (narrowing)
    Metadata-protocol: none
    Responsibility: as in claim 7057675017 (unchanged by the hand-over)
    Thread-read: 7057675017
    Premise: holds (carried from claim 7057675017 and rulings 6942854600, 6895275749, 7045701086; re-checked by the L1 and contract delta on main)
    Serial constraints cleared: as in claim 7057675017; follow-ups #36034 #36115 #36120 #36121 filed by seat 7
    Resume-from: claude/project-thread-thptm0@4f11b215c37f3e276d901369bd314735f9de627b

  19. removed
    pm:dispatched
    on Nov 21, 2026
  20. added a commit that references this issue on Nov 22, 2026
    52a2398
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:databugdomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions