Skip to content

fix(plugin-sharing)!: a manual share or sharing rule to a user id that names no user is refused instead of stored as an inert grant - #38216

Merged
os-zhuang merged 10 commits into
mainfrom
claude/issue-33912-share-unknown-recipient
Nov 28, 2026
Merged

os-zhuang merged 10 commits into
mainfrom
claude/issue-33912-share-unknown-recipient

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #33912

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — no published skill describes the shares or sharing-rules request body; the declared sharingRules metadata path is not judged by this change

维护者速读

  • 管理员或记录所有者在共享记录、保存共享规则时,若填写的用户不存在(或在多组织部署下不属于该组织),现在会立即收到错误提示,不再假装共享成功。
  • 为什么做:之前这类共享看起来已授权、实际谁也访问不到,属于"看似生效、其实无效"的授权问题,替记录共享的使用者解决。
  • 出错会怎样:填写正确用户的共享与规则不受影响;已存的旧共享不会被改动;如有误拒,撤回本改动即可恢复原行为。
  • 要你做什么:无。

What changes

  • SharingService.grant (non-system path) now asks whether a user recipient names a user the read and write gates could ever match, after authorization, after the record's organization is resolved and after both ADR-0111 D7 halves:
    • walled posture (isolated / group) with the record's organization known: a member of that organization (objectql organizationMemberStanding, the engine's one membership predicate; a banned member still resolves);
    • walled posture with the grant's organization unresolved (the record-organization read failed, or the record carries none and the session has no active one): no recipient is judged, and the engine refuses that insert for every recipient alike (ERR_SYSTEM_WRITE_ORGANIZATION_REQUIRED, 500);
    • otherwise (single, or a walled deployment that registers no membership table): an existing sys_user;
    • a deployment that registers no sys_user has nothing to resolve against and the check stands aside.
  • A recipient that does not resolve is refused VALIDATION_FAILED (400 at the REST door) and nothing is written. A user of another organization gets the same sentence as an id that does not exist (only the echoed id differs), so the door is no cross-tenant existence oracle.
  • SharingRuleService.defineRule applies the same check, in the rule's organization, to a non-system user recipient only when the rule is new or its recipient changes; re-saving a stored rule with its recipient unchanged (for example active: false) is not re-judged. The rule's organization is the caller's or, for a platform operator with no active organization updating a stored rule, the stored rule's own: that write is an update, which the engine's insert-only organization rule does not refuse, so it is judged here with the same code and sentence. A new rule with no organization under a wall is not judged; the engine refuses its insert for every recipient alike.
  • The system context (rule materialisation) is unchanged.
  • Kept from the predecessor's WIP (ee1dabfcd, seat 7), with two corrections: the direct-grant check moved from inside the non-system branch to after assertRecipientNotInert, so the D7 inertness verdict stays one answer per object and recipient population whoever calls (the WIP turned the user-path answer on a public object into VALIDATION_FAILED while the system path answered SHARING_NOT_ENABLED, red in system-caller-inert-grant.test.ts); and the "is this a direct grant" decision is a local flag set in the existing branch rather than a second isSystem read in grant (check:system-context-census register).
  • ADR-0087 semantic ledger entry share-user-recipient-unresolved-refused (step 19), two changesets (plugin-sharing minor, spec patch), and a docs note in content/docs/kernel/runtime-services/sharing-service.mdx.

Files to read first, by risk:

  1. packages/plugins/plugin-sharing/src/sharing-service.ts — the userRecipientRefusal / userRecipientResolves pair and the hunk after assertRecipientNotInert in grant() (ordering is the load-bearing part).
  2. packages/plugins/plugin-sharing/src/sharing-rule-service.ts — the defineRule hunk: which upserts are judged.
  3. packages/plugins/plugin-sharing/src/record-share-unknown-recipient.test.ts — the pins.

Tests

New record-share-unknown-recipient.test.ts, on a real ObjectQL engine over an in-memory SQLite SqlDriver with sys_user and sys_member registered. Refusals assert the code (the CODE: prefix the share and rule routes map to a status, VALIDATION_FAILED to 400, pinned route-side in rest-share-refusal-classification.test.ts), the exact sentence and the table left empty; the status is measured at the live door below.

  • walled: unknown id refused, no row; member CONTROL granted; another-organization user answered identically to an unknown id; system context still writes the grant;
  • single: unknown id refused, no row; existing user CONTROL granted with no membership asked;
  • defineRule: unknown user refused, no rule; another-organization user identical to unknown; member CONTROL stored; an unchanged stored recipient not re-judged (active: false lands); moving a stored rule onto an unknown user refused.
  • walled, grant organization unresolved (group, the record-organization read failed): an unknown id, another-organization user and a member all get the engine's 500 ERR_SYSTEM_WRITE_ORGANIZATION_REQUIRED, equal in code, status and message; no row;
  • defineRule by a platform operator with no active organization (isolated, manage_platform_settings, no tenantId) moving a stored rule: unknown id refused, stored recipient stands; another-organization user identical to unknown; member of the stored rule's organization CONTROL stored.

system-caller-inert-grant.test.ts: the #25549 fixture's members are now also sys_user rows (every member is a user).

Ablation (scripts/ablation-replace.mjs, each leg restored to the HEAD blob, git diff HEAD empty): each mutation reds exactly the pins it should and no control.

Ablation readings
Mutation Red
A1 grant check replaced by null 3 of 11 (walled unknown, walled other-org, single unknown)
A2 defineRule check replaced by null 3 of 11 (rule unknown, rule other-org, rule moved)
A3 membership arm disabled (if (false)) 2 of 11 (both other-org cases)
A4 "recipient unchanged" condition deleted 1 of 11 (unchanged stored rule re-judged)
A5 direct-grant flag forced true 1 of 11 (system context judged)
A6 defineRule judges in the caller's organization only (ruleOrgId = orgId), at head 4e803259a7 2 of 15 (operator unknown, operator other-org); the operator CONTROL green

Acceptance notes

  • Out of scope, not touched: rule-hooks.ts binds no user-recipient guard on sys_sharing_rule, so a rule row saved through the /data door (the Setup form) skips the new defineRule check (the predecessor's finding; source read, not measured live). Reported to the seat.
  • packages/qa/dogfood/test/federated-phantom-share-grant.dogfood.test.ts shares a local note with usr_grantee_8119, a user id that does not exist, and asserts only "not 422 / not SHARING_NOT_ENABLED"; it now passes on a 400 VALIDATION_FAILED instead of a 201. Still green, but no longer for the reason it was written; outside this card's file surface, left as is.
  • POST /api/v1/sharing/rules answers its refusals in the older flat { code, error } body (pre-existing, unchanged here), the shares route in the nested { success, error: { code, message } } envelope.
  • Shares and rules already stored are not rewritten; the ledger entry tells an upgrading operator how to find inert rows.

Verification

Two-minute check: pnpm --filter @objectstack/plugin-sharing exec vitest run --maxWorkers=2 src/record-share-unknown-recipient.test.ts — expect 15 passed.

Live door, showcase, fresh boot, single posture

On current main's behaviour (the grant() recipient check ablated in plugin-sharing's built dist/, marker count 1 in dist/index.js, every other byte the branch at 4a00ebdf59; restored and rebuilt after, ablation-dist-preflight --absent clean):

POST /api/v1/data/showcase_inquiry/okRB8Mj9zyHPbRRm/shares {"recipientType":"user","recipientId":"nobody_xyz","accessLevel":"read"}
HTTP 201 {"id":"shr_c559d44c-…","recipient_type":"user","recipient_id":"nobody_xyz","access_level":"read","source":"manual",…}
GET  …/shares  HTTP 200 {"data":[{… "recipient_id":"nobody_xyz" …}]}

With the fix (branch build at 4a00ebdf59; the later commit 1cba91fa42 only swaps the isSystem read for a local flag and is covered by the suites below):

POST …/gX1tCk--CkpgKV_3/shares {"recipientId":"nobody_xyz",…}            HTTP 400 {"success":false,"error":{"code":"VALIDATION_FAILED","message":"recipientId \"nobody_xyz\" does not name a user this record can be shared with, so no access check would ever match the share. Name an existing user (on a multi-organization deployment, a member of the record's organization)."}}
POST …/shares {"recipientId":"ghost_user_qa","accessLevel":"edit"}           HTTP 400 VALIDATION_FAILED (same sentence)
POST …/shares {"recipientId":""}                                            HTTP 400 VALIDATION_FAILED "recipientId is required" (unchanged)
GET  …/shares                                                               HTTP 200 {"data":[]}
POST …/shares {"recipientId":"usr_showcase_auditor_demo"}  (CONTROL)        HTTP 201, row listed by GET …/shares
POST /api/v1/sharing/rules {… "recipientId":"nobody_xyz"}                   HTTP 400 {"code":"VALIDATION_FAILED","error":"recipientId \"nobody_xyz\" does not name a user this rule can share with, so the rule would grant no one access. …"}
POST /api/v1/sharing/rules {… "recipientId":"usr_showcase_auditor_demo"} (CONTROL)  HTTP 201
Suites and gates

All at head 1cba91fa42 unless noted.

pnpm --filter @objectstack/plugin-sharing build && … typecheck && … vitest run --maxWorkers=2
  TYPECHECK_OK · Test Files 79 passed (79) · Tests 1765 passed | 11 skipped (1776)
  os-verify-lock: VERDICT command-exit 0
pnpm --filter @objectstack/dogfood test   (full battery, no shard, closure built)
  Test Files 490 passed | 3 skipped (493) · Tests 4144 passed | 68 skipped (4212)
  os-verify-lock: VERDICT command-exit 0 · held the lock 3079s
dispatch-gates --commands (8 paths, merge base 7605e0c9c): 120 derived families
  run at 1cba91fa42: 119 exit 0; check:type-check-debt exit 3 (PREREQUISITE NOT MET: the lock was held by this PR's own dogfood run) = NOT MEASURED at this head; exit 0 at 4a00ebdf59
  dispatch-gates --ran: 120 accounted, 119 run, 1 NOT-MEASURED
check:system-context-census: OK, register matches the tree (209 elevation read sites)

S1 round, head 4e803259a7:
  plugin-sharing typecheck TYPECHECK_OK · vitest Test Files 79 passed (79) · Tests 1769 passed | 11 skipped (1780) · VERDICT command-exit 0
  dispatch-gates --commands (8 paths, merge base 7605e0c9c): 120 derived families, 120 exit 0 (6 re-run after a clone deepen and a full build); dispatch-gates --ran: 120 accounted, 120 run, 0 NOT-MEASURED
  pnpm --filter @objectstack/dogfood test (full battery, no shard): Test Files 490 passed | 3 skipped (493) · Tests 4144 passed | 68 skipped (4212) · VERDICT command-exit 0

CI owns the repo-wide scans (pnpm lint) and test:repo; not run locally.


Generated by Claude Code

…oes not resolve (#33912)

Work in progress, released to the queue under the maintainer's 2026-11-21T15:25Z stop. Untested: no build, suite, pins, ablation or changeset yet. A narrowing (Clause-② no) when finished.
… for the unknown-recipient refusal

Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8
Co-authored-by: Claude <noreply@anthropic.com>
…alves

The inertness verdict stays one answer per object and recipient population
whoever calls; the #25549 fixture's members become users.

Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8
Co-authored-by: Claude <noreply@anthropic.com>
…al flag, not a second isSystem read

Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/plugin-sharing, @objectstack/spec, touching 11 documentable anchor(s).

4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/concepts/metadata-lifecycle.mdx (via /api/v1/sharing/rules (route, a path literal in a comment on a changed line; a path literal in acceptanceCriteria; a path literal in surface))
  • content/docs/kernel/runtime-services/sharing-service.mdx (via SharingService (symbol, a top-level class), defineRule (symbol, a method of class SharingRuleService))
  • content/docs/permissions/sharing-rules.mdx (via /api/v1/sharing/rules (route, a path literal in a comment on a changed line; a path literal in acceptanceCriteria; a path literal in surface))
  • content/docs/permissions/system-context.mdx (via defineRule (symbol, a method of class SharingRuleService))

⛔ 4 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via defineRule (symbol, a method of class SharingRuleService), /api/v1/sharing/rules (route, a path literal in a comment on a changed line; a path literal in acceptanceCriteria; a path literal in surface))
  • content/docs/releases/v17/17-3.mdx (via SharingService (symbol, a top-level class))
  • content/docs/releases/v18/18-1.mdx (via SharingService (symbol, a top-level class))
  • content/docs/releases/v18/18-3.mdx (via SharingService (symbol, a top-level class))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: sys_user (literal, 57 pages)
  • 4 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 177 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json e42520c67bcef027552f8db83655ff9b54d32cef → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 30444e1c97bbc4abe5568fe550fbbe88aa4580f9 — the merge of head 4e803259a7933c4d890892f955029cc69cf1efcc into base e42520c67bcef027552f8db83655ff9b54d32cef, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 30444e1c97bbc4abe5568fe550fbbe88aa4580f9 && git checkout 30444e1c97bbc4abe5568fe550fbbe88aa4580f9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e42520c67bcef027552f8db83655ff9b54d32cef 4e803259a7933c4d890892f955029cc69cf1efcc && git checkout -B drift-repro e42520c67bcef027552f8db83655ff9b54d32cef && git merge --no-ff 4e803259a7933c4d890892f955029cc69cf1efcc

node scripts/docs-audit/affected-docs.mjs --json e42520c67bcef027552f8db83655ff9b54d32cef

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs e42520c67bcef027552f8db83655ff9b54d32cef → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract-review-claim: session_017xRBcSAaBEfQpU2yJexSJ8 · head 1cba91f · 2026-11-28T07:48Z

The lane seat runs the owed CONTRACT_REVIEW_TIER review through an isolated at-tier subagent.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1cba91fa428204f5da19aa2b15a7620adaab7010
Local-runs: none
Scope: packages/plugins/plugin-sharing/src/sharing-service.ts, packages/plugins/plugin-sharing/src/sharing-rule-service.ts, packages/spec/src/migrations/entries/semantic/19.share-user-recipient-unresolved-refused.ts, packages/plugins/plugin-sharing/src/record-share-unknown-recipient.test.ts, packages/plugins/plugin-sharing/src/system-caller-inert-grant.test.ts + packages/objectql/src/assignment-rules.ts (organizationMemberStanding), packages/objectql/src/tenancy/system-write-organization.ts, packages/core/src/security/tenant-layer0-verdict.ts, packages/plugins/plugin-sharing/src/rule-hooks.ts, packages/plugins/plugin-sharing/src/record-share-organization-stamp.test.ts, packages/spec/src/migrations/registry.ts.template, packages/spec/src/kernel/protocol-version.ts (all read at the head, none reviewed)

① Derived judgments

  • SharingService.grant, non-system path: a user recipient that does not resolve is refused VALIDATION_FAILED before any write. Right as a narrowing, because the refused row could never be matched by a gate. Wrong in one arm, see M1.
  • SharingRuleService.defineRule, non-system path: the same refusal when the rule is new or its recipient changes; an upsert that keeps the stored recipient is not judged. Right.
  • New public method SharingService.userRecipientRefusal(recipientId, organizationId, subject): an additive surface consumed by defineRule. Right.
  • System context: unchanged (judgeRecipient is set only on the non-system branch of grant; the defineRule check sits inside the non-system block). Pinned, with ablation A5.
  • Ordering: the check runs after assertSharingEnforced, assertCanManageShares, resolveDirectGrantOrganization and assertRecipientNotInert, so ADR-0111 D7 stays one answer per object and recipient population whoever calls. Right.
  • Walled posture with the organization known: an unknown id and an other-organization user take one sys_member read and get the same code and sentence apart from the echoed id. Right, pinned for grant and defineRule.
  • Ledger entry 19.share-user-recipient-unresolved-refused: right major (PROTOCOL_VERSION 19.0.0, a toMajor: 19 step, packages at 19.0.0-next.2).
  • Check-runs on the head: every run that executed concluded success; the rest are skipped opt-in jobs.

② Semver level

Clause-②: no (narrowing)

Metadata-protocol: narrowed asks for at least one moved package at minor: @objectstack/plugin-sharing minor, @objectstack/spec patch for the ledger entry alone; both changesets carry both declaration lines, the BREAKING banner with the caller's fix and the ADR-0087 marker registered share-user-recipient-unresolved-refused. The level matches what the diff publishes.

③ Boundary flags

Security-touching: yes. The hunks change which shares and sharing rules the sharing doors accept.

  • open_questions: empty.
  • Out-of-scope finding 1, the rule-hooks.ts data door: confirmed by reading; the sys_sharing_rule guard judges object_name only, so POST /api/v1/data/sys_sharing_rule (the Setup form) still stores an unresolved user recipient. It does not make this PR's claim false (the changeset lists the door as unchanged; the door accepts every id alike, so no oracle). A legitimate follow-up, owed a card.
  • Out-of-scope finding 2: federated-phantom-share-grant.dogfood.test.ts now passes on a 400 where it was written for a 201 — a follow-up for that test's owner.
  • Out-of-scope finding 3: the flat refusal body of POST /api/v1/sharing/rules is pre-existing.
  • Deviation "status 400 evidenced at the live door, not in the unit file": accepted.
  • SQL push-down: no finding (point lookups with limit: 1).

④ Design judgment

The narrowing makes the spec's own refusal real and takes no declared capability away.

M1 (must-fix) — the no-oracle claim is false when the grant's organization resolves to null under a wall. userRecipientResolves takes the membership arm only when organizationId is set and the posture is walled; with organizationId === null under isolated or group it falls through to the deployment-wide sys_user lookup. An id no user carries is then refused 400 VALIDATION_FAILED, while an id naming a user of any organization passes and reaches the insert, which the engine refuses with ERR_SYSTEM_WRITE_ORGANIZATION_REQUIRED at status 500 (ADR-0131 D9; pinned in record-share-organization-stamp.test.ts). The two answers differ in status and code, so the door tells the caller the id exists in some tenant; before this PR both ids got the engine refusal. resolveDirectGrantOrganization returns null in two shapes its own jsdoc names (the record-organization read failed; the record carries no organization and the session has no active one). Read only, not measured. The published prose (changeset, docs note, ledger reason and acceptanceCriteria, the method jsdoc) states the property without this condition. Fix direction: under a wall with no organization, do not consult sys_user — stand aside so the engine's refusal answers every recipient alike, or refuse every recipient with one sentence; add a pin comparing an unknown id with an other-organization user in that arm, and scope the prose to what the tree does.

N1 (nit) — grant re-judges a recipient whose manual share is already stored, while defineRule exempts an unchanged recipient.

N2 (nit) — under single, a sys_user outside every organization resolves although ADR-0093 D8.1 denies that person every tenant row; the share stays inert.

Implemented-by: claude/issue-33912-share-unknown-recipient
Reviewed-by: session_017xRBcSAaBEfQpU2yJexSJ8

VERDICT: FAIL

…o recipient

The deployment-wide sys_user lookup answered an unknown id 400 while a
real user of any organization reached the engine's 500 organization
refusal: an existence oracle. The engine's refusal now answers every
recipient alike; pinned. Changeset, ledger entry, docs note and jsdoc
scoped to what the tree does.

Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l and removed size/m labels Nov 28, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract-review-claim: session_017xRBcSAaBEfQpU2yJexSJ8 · head 8eb8823 · 2026-11-28T10:01Z

The lane seat runs the owed CONTRACT_REVIEW_TIER review through an isolated at-tier subagent.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 8eb8823d2b9e1b3758ef09cfaeabb7f2f7ccb702
Local-runs: none
Scope: packages/plugins/plugin-sharing/src/sharing-service.ts, packages/plugins/plugin-sharing/src/sharing-rule-service.ts, packages/spec/src/migrations/entries/semantic/19.share-user-recipient-unresolved-refused.ts, packages/plugins/plugin-sharing/src/record-share-unknown-recipient.test.ts, packages/plugins/plugin-sharing/src/system-caller-inert-grant.test.ts + packages/objectql/src/assignment-rules.ts (organizationMemberStanding), packages/objectql/src/tenancy/system-write-organization.ts, packages/core/src/security/system-write-organization.ts, packages/objectql/src/engine-middleware-and-context.ts (resolveSystemInsertOrganization), packages/objectql/src/engine-driver-options.ts (resolveEnginePosture), packages/plugins/plugin-sharing/src/sharing-plugin.ts (the tenancy probe), packages/drivers/driver-sql/src/sql-driver-internal-helpers.ts (auditMissingTenant), packages/spec/src/kernel/protocol-version.ts, packages/spec/src/migrations/registry.ts.template (all read at the head, none reviewed)

① Derived judgments

  • SharingService.grant, non-system path: a user recipient that does not resolve is refused VALIDATION_FAILED before any write. Right in every arm at this head.
  • Walled posture with the grant's organization null: userRecipientResolves returns true before any read, so the new code asks nothing about the recipient. Right; this is the M1 fix.
  • Walled posture with the organization known: one sys_member read; an unknown id and an other-organization user get the same code and sentence apart from the echoed id. Right. unconfirmable comes only from an unregistered sys_member; a failed read throws.
  • single: an existing sys_user; no sys_user registered, the check stands aside. Right.
  • SharingRuleService.defineRule, non-system path: judged when the rule is new or its recipient changes, in the caller's organization. Right for an organization's admin. Wrong in one arm, see S1.
  • System context: unchanged. judgeRecipient is set only on the non-system branch of grant; the defineRule check sits inside the non-system block.
  • Ordering: after assertSharingEnforced, assertCanManageShares, resolveDirectGrantOrganization and assertRecipientNotInert, so ADR-0111 D7 stays one answer per object and recipient population whoever calls. assertRecipientNotInert with a null organization reads nothing about the recipient.
  • New public method SharingService.userRecipientRefusal: additive. Right.
  • Ledger entry under major 19: PROTOCOL_VERSION is 19.0.0 and the registry carries a toMajor: 19 step. Right.
  • Check-runs on the head: 70 runs; every run that executed concluded success, the rest are skipped opt-in jobs.

② Semver level

Clause-②: no (narrowing)

Metadata-protocol: narrowed: @objectstack/plugin-sharing minor with the BREAKING banner and the caller's fix, @objectstack/spec patch for the ledger entry alone. Both changesets carry both declaration lines and the ADR-0087 marker registered share-user-recipient-unresolved-refused. The levels match what the diff publishes.

③ Boundary flags

Security-touching: yes. The hunks change which shares and sharing rules the sharing doors accept.

  • open_questions: empty.
  • Dev deviation "defineRule under a wall with no caller organization also stands aside; the engine refuses the organization-less rule insert; not measured": half right. The insert half is refused; the update half is not. See S1.
  • Dev deviations on N1 and N2 (declined, with reasons): accepted.
  • Out-of-scope findings (the rule-hooks.ts /data door, the federated-phantom-share-grant dogfood test passing for another reason, the flat refusal body of POST /api/v1/sharing/rules): unchanged from the previous record; each still owes a follow-up card and none makes this PR's claim false.
  • SQL push-down: no finding. The new reads are point lookups with limit: 1; no id set is materialised.

④ Design judgment

The narrowing makes the spec's own refusal real and takes no declared capability away at the consumer.

M1: closed. Tried in every arm:

  • Both null shapes of resolveDirectGrantOrganization (the record-organization read failed; the record carries none and the session has no active one) reach the same line, if (!organizationId) return true, before any directory read. The branch does not depend on which shape produced the null.
  • isolated and group: the same branch (organizationScopeRequired). The engine then refuses the insert with ERR_SYSTEM_WRITE_ORGANIZATION_REQUIRED (500) without asking the database anything (resolveSystemWriteOrganization: any posture other than single is walled-posture). The answer carries the object and the posture, never the recipient.
  • single with a null organization: no wall, so the sys_user lookup stands and no tenant boundary exists to leak across.
  • grant: pinned under group with a failed organization read; unknown id, other-organization user and member compare equal on code, status and message, and no row is written.
  • defineRule with a null caller organization under a wall: no oracle (no recipient is asked about, and the only caller who reaches it holds platform authority), but see S1.
  • No new oracle found. The one recipient-dependent difference left in the null arm is the upsert's update half (N4), which reflects only the record's own share list.

S1 (should-fix) — the defineRule update half under a wall with no caller organization stores an unjudged recipient, and the published ledger says that write is refused. A non-system platform operator with no active organization reaches defineRule with orgId === null (assertResolvableAdminScope admits platform authority). The existence lookup is then where: { name }, unscoped. When a stored rule holds that name, the write is engine.update, and the engine's organization rule is insert-only by its own module header ("INSERT only, deliberately"); the driver's tenant audit only logs. So moving a stored rule onto an id no user carries is accepted and the rule grants no one access. At 1cba91fa this arm was judged through sys_user; the M1 fix removed that. Behaviour on this arm now equals main, with no oracle. The ledger surface states "neither is a recipient on a walled deployment where the record or rule organization does not resolve: that write is already refused for every recipient alike", which is false for the update half, and the rule's organization does resolve there: it is the stored row's organization_id. Read only, not measured. Fix direction: judge the update half in the stored row's organization, or scope the ledger sentence, the changeset and the defineRule comment to the insert half; add a pin for the arm.

N1 (nit) — unchanged: grant re-judges a recipient whose manual share is already stored. Accepted deviation.

N2 (nit) — unchanged: under single, a sys_user outside every organization resolves. Accepted deviation.

N3 (nit) — the PR body is stale against the tree: "otherwise (single, a record with no organization, or no membership table): an existing sys_user" no longer holds for a walled record with no resolvable organization, and Tests still says 11 pins without the new one. Prose face, the seat's write.

N4 (nit) — "for every recipient alike … nothing is written" (changeset, docs note, ledger acceptanceCriteria, method jsdoc) is exact for the insert half only. A recipient who already holds a manual share on the record takes the update half, which the engine does not refuse. It shows the caller nothing beyond the record's share list, which they can already read, and it is the same on main.

N5 (nit) — the method jsdoc's "the engine refuses its insert" assumes the engine and the plugin read the same posture. With no tenancy service the plugin fails closed to isolated while the engine reads the environment's posture, so in such a composition an organization-less grant is unjudged and the engine may derive an organization and write it. Every recipient is still answered alike.

N6 (nit) — the new pin covers one null shape under group for grant; the other shape and isolated share its branch and have no pin of their own.

No must-fix. S1 is open on this head and earns a delta review of its fix.

Implemented-by: claude/issue-33912-share-unknown-recipient
Reviewed-by: session_017xRBcSAaBEfQpU2yJexSJ8

VERDICT: PASS

…rm operator in the stored row's organization

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcSy8ctHY8LEkxS86U6
…he stored rule's organization on an org-less operator's update

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcSy8ctHY8LEkxS86U6
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSy8ctHY8LEkxS86U6
os-dev-report

{
  "issue": 33912,
  "delta_of": "contract review 7237682248 (head 8eb8823d2b9e1b3758ef09cfaeabb7f2f7ccb702, PASS, S1 open)",
  "status": "done",
  "branch": "claude/issue-33912-share-unknown-recipient",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/38216",
  "session": "session_017xRBcSy8ctHY8LEkxS86U6",
  "premise_still_valid": true,
  "summary": "S1 fixed by the reviewer's first direction: `defineRule` now judges a `user` recipient in `orgId ?? (stored?.organization_id || null)`, so a non-system platform operator with no active organization who moves a stored rule (the UPDATE half, which the engine's insert-only organization rule does not refuse) is judged in the stored row's organization, with the same `VALIDATION_FAILED` code and sentence as an organization admin, and an unknown id and another organization's user answer alike (no cross-org oracle). Measurement showed the direction is right and possible: the existence lookup already holds the stored row, its `organization_id` resolves, and the membership arm of `userRecipientRefusal` answers it with one `sys_member` read. The insert half is unchanged (a new rule with no organization under a wall still stands aside and the engine refuses its insert for every recipient). Prose scoped to match: the ledger entry's `surface`, `reason` and `acceptanceCriteria`, both changesets, the docs note and the `defineRule` comment. Head moved 8eb8823d -> 4e803259a7 (two commits: f02fb95d fix + pin, 4e803259 prose). Confirmed head 8eb8823d before starting. Residual, stated in the code comment and not changed: a stored rule row carrying no organization under a wall is not judged (the ownership ceremony leaves none on a certified deployment, ADR-0131 D10). Not touched: N1, N2, N4, N5, N6 (no dispatch for them).",
  "tests": "New describe in `record-share-unknown-recipient.test.ts`, posture `isolated`, caller `{ userId: 'u_operator', systemPermissions: ['manage_platform_settings'] }` with no `tenantId`, a stored rule `r_op` of org_a whose recipient is a member of org_a, then `defineRule` with the same name: (1) unknown id -> VALIDATION_FAILED, exact RULE_REFUSAL sentence, stored recipient unchanged; (2) a member of org_b -> same code, same sentence apart from the echoed id, stored recipient unchanged; (3) CONTROL: a real member of org_a (the stored row's org) -> stored. Pin file at 4e803259a7: `vitest run --maxWorkers=2 src/record-share-unknown-recipient.test.ts` Test Files 1 passed (1), Tests 15 passed (15), VERDICT command-exit 0. Ablation via `scripts/ablation-replace.mjs` on sharing-rule-service.ts, anchor `const ruleOrgId = orgId ?? (stored?.organization_id || null);` -> `const ruleOrgId = orgId;` (anchor x1 -> x0, replacement x0 -> x1, blob b52bb7428e92 -> bbaa197904de): Tests 2 failed | 13 passed (15), red exactly the two operator refusal pins (`expected undefined to be 'VALIDATION_FAILED'`), the CONTROL and every other pin green; restore: blob after restore == HEAD (b52bb7428e92), `git diff HEAD` empty. The pin imports the service from `src` by relative path, so no dist rebuild was owed for the ablation. Package: `pnpm --filter @objectstack/spec build && pnpm --filter @objectstack/plugin-sharing typecheck && vitest run --maxWorkers=2` at 4e803259a7: TYPECHECK_OK, Test Files 79 passed (79), Tests 1769 passed | 11 skipped (1780), VERDICT command-exit 0.",
  "gates": "Local, at 4e803259a7: `dispatch-gates --commands` (8 paths, merge base 7605e0c9c): 120 derived families. First pass: 114 exit 0; 6 could not answer (exit 3 PREREQUISITE NOT MET: check-plugin-teardown-shape --self-test on a shallow clone, check:skill-examples, check:dual-build-cjs-loads, check:i18n with no full build, check:type-check-debt with the lock held; exit 1 MODULE_NOT_FOUND for the cli migrate-meta-engine-guidance test with `@objectstack/mcp` unbuilt). After `git fetch --unshallow origin main` and a full `turbo run build --concurrency=2` (124 of 124 tasks, VERDICT command-exit 0), all 6 re-run: exit 0. Note: families 64-120 of the first pass ran while that full build was writing dist; every one of them exited 0. `dispatch-gates --ran`: 120 accounted, 120 run, 0 NOT-MEASURED (the runner's claim; exit codes recorded in my results file, all 0). Key verdict lines: check-adr-0087-registration both changesets `registered share-user-recipient-unresolved-refused`; check:spec-changes and check:upgrade-guide generate from the registries in memory (protocol 19.0.0); check:nul-bytes OK; check:system-context-census OK (209 elevation read sites). dispatch-gates printed STALE TREE (branch 46 commits behind origin/main, 7 gate files changed in that range); main was not merged (no conflict, overlap-check clean, not ordered). CI on 4e803259a7, read once: 70 check-runs, every executed run success, the rest skipped opt-in jobs; required set: Lint & Repo Gates success, TypeScript Type Check success, Test Core success, Build Core success, Governed Surface Queue Guard success, Type Check UI success, Test UI success, Build & E2E UI success, Live E2E UI success, Dogfood Regression Gate success, Lint UI skipped; Check Changeset success.",
  "dogfood_battery": "4e803259a7 · os-verify-lock: VERDICT command-exit 0 (held the lock 1911s) · Test Files 490 passed | 3 skipped (493) · Tests 4144 passed | 68 skipped (4212) · no failures · `pnpm --filter @objectstack/dogfood test`, no OS_TEST_SHARD, no path, closure from the full build",
  "mcp_calls": "4 — reads only: github pull_request_read (get, get_comments, get_check_runs) and claude-code-remote get_session for this session's id. No GitHub write tool.",
  "api_writes": "1 — this report via `scripts/pm/post-stamped.mjs --comment=38216` (POST /repos/objectstack-ai/objectstack/issues/38216/comments, through the fleet relay). Two `git push` to the branch (not REST writes).",
  "open_questions": [],
  "pr_body_patch": [
    {
      "before": "  - otherwise (`single`, a record with no organization, or no membership table): an existing `sys_user`;",
      "after": "  - walled posture with the grant's organization unresolved (the record-organization read failed, or the record carries none and the session has no active one): no recipient is judged, and the engine refuses that insert for every recipient alike (`ERR_SYSTEM_WRITE_ORGANIZATION_REQUIRED`, 500);\n  - otherwise (`single`, or a walled deployment that registers no membership table): an existing `sys_user`;"
    },
    {
      "before": "- `SharingRuleService.defineRule` applies the same check, in the rule's organization, to a non-system `user` recipient only when the rule is new or its recipient changes; re-saving a stored rule with its recipient unchanged (for example `active: false`) is not re-judged.",
      "after": "- `SharingRuleService.defineRule` applies the same check, in the rule's organization, to a non-system `user` recipient only when the rule is new or its recipient changes; re-saving a stored rule with its recipient unchanged (for example `active: false`) is not re-judged. The rule's organization is the caller's or, for a platform operator with no active organization updating a stored rule, the stored rule's own: that write is an update, which the engine's insert-only organization rule does not refuse, so it is judged here with the same code and sentence. A new rule with no organization under a wall is not judged; the engine refuses its insert for every recipient alike."
    },
    {
      "before": "- `defineRule`: unknown user refused, no rule; another-organization user identical to unknown; member CONTROL stored; an unchanged stored recipient not re-judged (`active: false` lands); moving a stored rule onto an unknown user refused.",
      "after": "- `defineRule`: unknown user refused, no rule; another-organization user identical to unknown; member CONTROL stored; an unchanged stored recipient not re-judged (`active: false` lands); moving a stored rule onto an unknown user refused.\n- walled, grant organization unresolved (`group`, the record-organization read failed): an unknown id, another-organization user and a member all get the engine's 500 `ERR_SYSTEM_WRITE_ORGANIZATION_REQUIRED`, equal in code, status and message; no row;\n- `defineRule` by a platform operator with no active organization (`isolated`, `manage_platform_settings`, no `tenantId`) moving a stored rule: unknown id refused, stored recipient stands; another-organization user identical to unknown; member of the stored rule's organization CONTROL stored."
    },
    {
      "before": "| A5 direct-grant flag forced `true` | 1 of 11 (system context judged) |",
      "after": "| A5 direct-grant flag forced `true` | 1 of 11 (system context judged) |\n| A6 `defineRule` judges in the caller's organization only (`ruleOrgId = orgId`), at head `4e803259a7` | 2 of 15 (operator unknown, operator other-org); the operator CONTROL green |"
    },
    {
      "before": "Two-minute check: `pnpm --filter @objectstack/plugin-sharing exec vitest run --maxWorkers=2 src/record-share-unknown-recipient.test.ts` — expect 11 passed.",
      "after": "Two-minute check: `pnpm --filter @objectstack/plugin-sharing exec vitest run --maxWorkers=2 src/record-share-unknown-recipient.test.ts` — expect 15 passed."
    },
    {
      "before": "check:system-context-census: OK, register matches the tree (209 elevation read sites)",
      "after": "check:system-context-census: OK, register matches the tree (209 elevation read sites)\n\nS1 round, head 4e803259a7:\n  plugin-sharing typecheck TYPECHECK_OK · vitest Test Files 79 passed (79) · Tests 1769 passed | 11 skipped (1780) · VERDICT command-exit 0\n  dispatch-gates --commands (8 paths, merge base 7605e0c9c): 120 derived families, 120 exit 0 (6 re-run after a clone deepen and a full build); dispatch-gates --ran: 120 accounted, 120 run, 0 NOT-MEASURED\n  pnpm --filter @objectstack/dogfood test (full battery, no shard): Test Files 490 passed | 3 skipped (493) · Tests 4144 passed | 68 skipped (4212) · VERDICT command-exit 0"
    }
  ],
  "deviations": [
    "The dispatch named the shared checkout; the worktree guard hook refused an edit there, so the primary checkout was detached (`git checkout --detach`, nothing uncommitted) and a worktree `../objectstack-issue-33912` was added on the same branch. Removed at the end; the primary checkout is back on the branch.",
    "Local commit amended once before its first push (a typo in the Claude-Session trailer); nothing pushed was rewritten.",
    "Ablation A1-A5 rows in the PR body were measured at 11 pins and were not re-run at 15; only A6 is new."
  ],
  "security_findings": "none",
  "out_of_scope_findings": [
    "carrier: none · noted, not filed — under a wall a stored `sys_sharing_rule` row with `organization_id` null is updated by an org-less platform operator unjudged; the ownership ceremony leaves no such row on a certified deployment (ADR-0131 D10); stated in the defineRule comment.",
    "carrier: the seat · unchanged from the previous rounds — the `rule-hooks.ts` `/data` door, the `federated-phantom-share-grant` dogfood test, the flat refusal body of `POST /api/v1/sharing/rules`."
  ]
}

Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract-review-claim: session_017xRBcSAaBEfQpU2yJexSJ8 · head 4e80325 · 2026-11-28T11:35Z

The lane seat runs the owed CONTRACT_REVIEW_TIER delta review (S1 of 7237682248) through an isolated at-tier subagent.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 4e803259a7933c4d890892f955029cc69cf1efcc
Local-runs: none
Scope: packages/plugins/plugin-sharing/src/sharing-service.ts, packages/plugins/plugin-sharing/src/sharing-rule-service.ts, packages/spec/src/migrations/entries/semantic/19.share-user-recipient-unresolved-refused.ts, packages/plugins/plugin-sharing/src/record-share-unknown-recipient.test.ts, packages/plugins/plugin-sharing/src/system-caller-inert-grant.test.ts + packages/objectql/src/assignment-rules.ts (organizationMemberStanding), packages/objectql/src/tenancy/system-write-organization.ts, packages/core/src/security/system-write-organization.ts (resolveSystemWriteOrganization), packages/objectql/src/engine-insert.ts and engine-middleware-and-context.ts (resolveSystemInsertOrganization), docs/adr/0131-total-organization-ownership-no-null-organization-id.md (D9, D10), content/docs/deployment/cli.mdx (the ownership ceremony and the boot refusal) (all read at the head, none reviewed)

Delta round on 8eb8823..4e80325 (f02fb95 the fix and its pin, 4e80325 the prose), and the whole PR judged again at this head.

① Derived judgments

  • SharingRuleService.defineRule, non-system path, the one code change of this round: a user recipient that is new or changed is judged in orgId ?? (stored?.organization_id || null). Right. For a caller with an active organization the left operand is always set, and the existence lookup is scoped to it, so nothing moves for an organization's admin. Only the caller with no organization (a platform operator; assertCanManageRules refuses every other one) reaches the right operand.
  • The row judged is the row written. The operator's lookup is by name alone with limit: 1; the membership question is asked in that row's organization_id, and the update patches that row's id without touching its organization. Two organizations holding one rule name is the lookup's own earlier behaviour and unchanged here.
  • Insert half, unchanged: a new rule with no caller organization under a wall reaches userRecipientResolves with null, which returns true before any read; declaredRuleNamed then answers by name only, and engine.insert is refused for any posture other than single without a database read (resolveSystemWriteOrganization, walled-posture). No recipient is asked about.
  • single: organizationScopeRequired is false, so the organization argument is not read and the sys_user lookup stands, for the operator's update as for every other call. Right.
  • System context: unchanged. The whole hunk sits inside if (!context?.isSystem); grant sets judgeRecipient only on its non-system branch.
  • SharingService.grant and userRecipientRefusal / userRecipientResolves: byte-identical to 8eb8823; the judgments of record 7237682248 stand.
  • Ledger entry 19.share-user-recipient-unresolved-refused: surface, reason and acceptanceCriteria re-read against the tree, see ④.
  • Check-runs on the head: 70 runs; every run that executed concluded success (Test Core, Lint & Repo Gates, TypeScript Type Check, Build Core, Check Changeset, Dogfood Regression Gate, Governed Surface Queue Guard among them); the 10 others are skipped opt-in jobs.

② Semver level

Clause-②: no (narrowing)

Metadata-protocol: narrowed: @objectstack/plugin-sharing minor with the BREAKING banner and the caller's fix, @objectstack/spec patch for the ledger entry alone. Both changesets carry both declaration lines and the ADR-0087 marker registered share-user-recipient-unresolved-refused. The round adds one more refused shape on the same door (an operator's move of a stored rule), inside the narrowing already declared; the levels match what the diff publishes.

③ Boundary flags

Security-touching: yes

The hunks change which shares and sharing rules the sharing doors accept.

  • open_questions (report 7238615920): empty.
  • Dev residual "a stored sys_sharing_rule row carrying no organization under a wall is updated by an organization-less operator unjudged": confirmed by reading, and answered in ④ (N7). It is not reachable on a store a v18 server serves through the product's own writers.
  • Dev deviation "ablation rows A1 to A5 were measured at 11 pins and not re-run at 15; A6 is new": accepted. The two commits touch neither grant nor the condition those legs mutate.
  • Dev deviation on the worktree and the amended local commit: no effect on the head.
  • Out-of-scope findings (the rule-hooks.ts /data door, the federated-phantom-share-grant dogfood test passing for another reason, the flat refusal body of POST /api/v1/sharing/rules): unchanged from the two earlier records; each still owes a follow-up card and none makes this PR's claim false. The changeset still lists the /data door as not judged.
  • SQL push-down: no finding. The fix adds no read of its own: it hands a second organization id to the existing point lookups (sys_member and sys_user, limit: 1). No id set is materialised.

④ Design judgment

The narrowing makes the spec's own refusal real and takes no declared capability away at the consumer.

S1: closed

The update half is now judged, in the organization the stored row belongs to, and the published sentence no longer calls that write refused by the engine. Tried:

  • Stored row with an organization, operator with none, walled: ruleOrgId is the stored row's id; one sys_member read pinned to it. An id no user carries and a member of another organization both come back not_member and get VALIDATION_FAILED with the one rule sentence, differing only in the echoed id; a member of the stored row's organization is stored. Pinned three ways under isolated, and the dev's ablation (ruleOrgId = orgId) reds exactly the two refusal pins.
  • Cross-organization existence oracle: none found. The only recipient-dependent answer on the arm is "member of the stored rule's organization or not", which is the feature; nothing separates "exists elsewhere" from "exists nowhere". unconfirmable comes only from an unregistered sys_member (then no organization can be told apart); a read that throws propagates. The object refusal and the declared-name check that run around it do not read the recipient. The caller on this arm holds platform authority and reads every organization's rules already.
  • Stored row with organization_id null or empty under a wall: || null hands null on, the check stands aside and the update stores the recipient unjudged. See N7: no product writer leaves such a row on a served store, and nothing published says otherwise.
  • Insert half: unchanged and still recipient-blind; the engine's answer carries the object and the posture only.
  • single and the system context: unchanged, as in ①.
  • Unchanged recipient on a stored rule (same type, same id): still not judged for the operator, so a rule whose user has left can still be switched off.

Published sentences against the tree at this head:

  • Ledger surface: names the rule's organization as the caller's or, for the organization-less operator updating a stored rule, the stored rule's own; scopes "already refused for every recipient alike" to an insert. True.
  • Ledger reason: the added sentence (the operator's move is an update, the engine's organization rule is insert-only, so it is judged in the stored rule's organization) is what system-write-organization.ts states of itself and what the hunk does. True.
  • Ledger acceptanceCriteria: the operator clause (same answer, stored recipient stands) is what the pins assert. True.
  • Both changesets and the docs note: same scoping, and "a new rule written with no organization on a walled deployment is not judged: the engine refuses that insert". True.
  • defineRule comment: true, and it is the one place that names the organization-less stored row.

N7 (nit) — the residual the dev names is real and benign, and the prose is honest about it without being complete. A stored rule row with no organization under a wall takes the update unjudged. Such a row needs a store written outside the product: the engine refuses that insert in every walled posture, defineRule's update never rewrites the organization, and a v18 server refuses to start on a database the ownership ceremony has not certified (ADR-0131 D10). If one existed, criteriaContext returns null for it where organizations are composed, so the rule already sweeps nothing and is reported at error whatever its recipient is. The ledger surface covers the case ("rule organization does not resolve" is not judged); the ledger reason then says "the engine refuses that insert", which does not describe an update of such a row, and the changesets and docs note are silent on it. No sentence is false. Left as an accepted deviation.

N8 (nit) — the new pins cover the operator's update under isolated only. group shares the branch, and the operator's insert half (a new rule, no organization, the engine's answer for every recipient alike) has no pin of its own; it was read in the engine, not measured.

N1 (nit) — unchanged: grant re-judges a recipient whose manual share is already stored. Accepted deviation.

N2 (nit) — unchanged: under single, a sys_user outside every organization resolves. Accepted deviation.

N3 (nit) — unchanged and still open on the prose face: the PR body still says "otherwise (single, a record with no organization, or no membership table): an existing sys_user" and "expect 11 passed". The dev's report carries the pr_body_patch; applying it is the seat's write.

N4 (nit) — unchanged: "for every recipient alike … nothing is written" is exact for the insert half of grant only.

N5 (nit) — unchanged: "the engine refuses its insert" assumes the engine and the plugin read the same posture.

N6 (nit) — unchanged: the grant pin for the unresolved organization covers one null shape under group.

No must-fix, no should-fix.

Implemented-by: claude/issue-33912-share-unknown-recipient
Reviewed-by: session_017xRBcSAaBEfQpU2yJexSJ8

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

维护者速读

  • 用户能看到什么变化:给「不存在的用户」手工共享一条记录,或写一条共享给不存在用户的共享规则,以前会成功保存(201)却谁也看不到;现在直接拒绝(400),提示「没有这个用户」,而且对别的组织的用户给出一模一样的回答,不会泄露别的租户里有谁。
  • 为什么做:存下来的是一条永远不生效的共享,管理员以为已经分享了,被分享的人其实一直看不到。
  • 出错会怎样:最坏是某个调用方以前依赖「随便传个 id 也能存」,升级后会收到 400,按提示改成真实用户即可;系统身份的内部写入不受影响。
  • 要你做什么:这是一处「收窄」(以前能存的现在会被拒),按规则要你批准才能合并:请在 PR 上点 Approve,之后由席位落地。

席位意见:建议批准。合同审查(CONTRACT_REVIEW_TIER)经三轮:首轮 FAIL(M1 跨租户可探测)→ 修复后 PASS 留 S1 → 本 head 上 PASS(M1、S1 均已关闭,只余 nit),守卫读取器已核读通。

席位核对 · ACCEPT · head 4e803259a7933c4d890892f955029cc69cf1efcc · 2026-11-28T11:41Z · card #33912

  1. Shape: draft on main, first line Fixes #33912 only, title fix(plugin-sharing)!:. Clause-②: no (narrowing) · Metadata-protocol: narrowed on the body and both changesets, plus the ADR-0087 marker registered share-user-recipient-unresolved-refused and a ledger entry under major 19. Fixes is right: the card asks that a manual share to a user id that does not exist is refused, not stored inert. That is delivered on both doors the card names (grant and defineRule).
  2. Contract review:
    • 7236871996: FAIL, M1, a cross-organization oracle when the grant's organization was null under a wall.
    • 7237682248: PASS, with S1 left open (an operator's update half stored an unjudged recipient).
    • The record on this head: PASS, S1: closed, nits N1–N8.
    • The guard's readers (contractReviewRecordReading, recordPassVerdict) read this record clean.
  3. Evidence at this head:
    • The plugin-sharing package passes: 79 files, 1769 tests, typecheck OK.
    • The pin file passes 15 of 15.
    • Ablations A1–A6: each one turns red exactly the pins it targets.
    • The dogfood battery is pinned to this head: Test Files 490 passed | 3 skipped, no failures (the ! / narrowing arm).
    • dispatch-gates: 120 of 120 run and green.
  4. Accepted deviations: N1 (a stored manual share's recipient is re-judged), N2 (single resolves a sys_user outside every organization), N4 and N5 (prose exact for the insert half), N6 and N8 (pin coverage of one shape of a shared branch), N7 (an organization-less stored rule under a wall is not reachable through product writers; no sentence is false). PR body N3 is applied by the seat: the dev's pr_body_patch, 6 of 6 hunks, identical read-back.
  5. Out of scope: the /data door for sys_sharing_rule (rule-hooks.ts) is filed as sharing: a sharing rule written through /api/v1/data/sys_sharing_rule (the Setup form) still stores a user recipient no user carries, which defineRule now refuses #38254 (Blocked-by: #38216). The federated-phantom-share-grant dogfood test now passes on a 400, a follow-up for its owner. The flat refusal body of POST /api/v1/sharing/rules is pre-existing.
  6. Landing: this declares a narrowing, so it is Tier H by the queue guard's narrowed leg. It goes to the approver with pm:awaiting-merge. NOT governed by path (+~600 lines ≤ 3000), K = 14 < 15. After an authorized approval, the seat lands it (ready, auto-merge).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Request: approval · PR #38216 declares a narrowing (Clause-②: no (narrowing)), so the queue guard lands it only with an authorized approval. The seat ACCEPT and the maintainer brief are on the thread. CONTRACT_REVIEW_TIER is PASS on head 4e803259 (M1 and S1 closed, nits only). Size +624/−2, not governed by path. Please approve; the seat lands it after.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 28, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 28, 2026 14:03
@os-zhuang
os-zhuang enabled auto-merge November 28, 2026 14:03
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit f38a3ca Nov 28, 2026
83 of 84 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-33912-share-unknown-recipient branch November 28, 2026 14:30
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…g, 56 changesets added) and state what npm publishes (objectstack-ai#38645)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9St4eUWHFcCKuRUrCZPperJ)_

Fixes objectstack-ai#38189

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:v19 发布页的 breaking 清单补上 11 月 26 日之后合进来的 56 条改动(其中 30 条还在 main
上、下一次预发布才带上,页上逐条标明),计数和页头的发布状态也改成现在 npm 上的真实情况。
- 为什么做:升级到 19 的人把这页当完整清单用;原清单只数到 19.0.0-next.0 的输入,之后 next.1、next.2 和
main 上的 breaking 改动大多没列。
- 出错会怎样:只改一个文档页,不影响任何代码或发布;某条写错了,读者会被误导,但直接撤回这个改动即可恢复原页。
- 要你做的:无。

## What changes

`content/docs/releases/v19/index.mdx` only.

- **Header.** The publication sentence now states what npm answers:
`latest` is 18.6.0, `next` is `19.0.0-next.2`; the line's versions on
npm are `19.0.0-next.0` (2026-11-26) and `19.0.0-next.2` (2026-11-28).
`19.0.0-next.1` was versioned on `main` (30a8047) and is not on npm, so
its changes first ship in `next.2`.
- **How this list was built.** Re-measured at `6eb23c87` (origin/main at
start, 2026-11-29) with the method the page states:
`classifyReleaseBullet` over every changeset on `main` — the 1,185 in
`.changeset/pre/` (consumed by the next.0, next.1 and next.2 version
passes) and the 219 still pending. 159 breaking from 155 PRs: 98 to act
on, 61 registered.
- **56 new lines' worth of changesets**, each sorted by the classifier
into 需手动处理 (27) or 自动迁移 (29), placed under the page's existing topic
headings, with three new ones: 需手动处理 → Knowledge; 自动迁移 → Knowledge
sources, Sharing and permissions. The 30 still pending carry "— on
`main`".
- **自动迁移 intro** and **Coming from 18.x step 3**: the registered split
restated in changesets (31 on the protocol-19 step, 30 on the
protocol-18 step, of 61).
- **Callout**: no longer says no prerelease was published.

## Tests

The classifier run (script in the dev's scratchpad; it imports
`classifyReleaseBullet` from `scripts/release-github-releases.mjs` and
feeds each changeset body as a CHANGELOG bullet, `- ` on the first line
and two-space indent on the rest), at `b03fd5f5`'s parent tree
`6eb23c87` (the diff touches no changeset):

<details><summary>Raw counts</summary>

```
ALL 1404 {"manual":98,"migrated":61,"other":830,"added":403,"semantic":12}
OLD (in a46efa8 set) 950 {"migrated":31,"manual":71,"other":563,"added":278,"semantic":7}
NEW (after a46efa8) 454 {"manual":27,"other":267,"added":125,"migrated":30,"semantic":5}
  NEW next.0 45 {"other":27,"added":13,"migrated":1,"semantic":2,"manual":2}
  NEW next.1 138 {"manual":9,"other":80,"migrated":12,"added":36,"semantic":1}
  NEW next.2 52 {"added":11,"other":38,"manual":3}
  NEW pending 219 {"added":65,"other":122,"migrated":17,"manual":13,"semantic":2}
missing-from-tree of a46 set: none
```

The same function over the 950 files as they stood at `a46efa8c` (`git
show a46efa8:.changeset/FILE`):
`{"migrated":31,"manual":71,"other":563,"added":278,"semantic":7}`, and
0 of the 950 changed section between `a46efa8c` and `6eb23c87` — the
page's first count reproduces exactly.

</details>

<details><summary>The 57 breaking changesets added after a46efa8 (pass
· section · PR · file)</summary>

```
next.0  manual    37477  37004-retire-knowledge-ragflow.md
next.0  manual    37491  36964-flow-option-label-filters.md
next.0  migrated  37437  35827-data-table-staged-edit-retired.md   (already on the page)
next.1  manual    37605  31908-p4c-sealed-expiry.md
next.1  manual    37640  37604-platform-record-followups.md
next.1  manual    37668  37104-knowledge-settings-readers.md
next.1  manual    37720  37682-i18n-retire-build-chat-keys.md
next.1  manual    37720  37682-retire-build-chat-frontend.md
next.1  manual    37818  37608-disabled-holder-publish-rollback-refused.md
next.1  manual    37883  37575-first-render-grid-shell-passes.md
next.1  manual    37900  36689-mcp-stdio-disabled-package-every-caller.md
next.1  manual    37902  37678-knowledge-turso-settings-group.md
next.1  migrated  37366  37086-define-metadata-form-rename.md
next.1  migrated  37366  37086-form-metadata-type.md
next.1  migrated  37371  36055-view-all-stops-voting-on-fields.md
next.1  migrated  37513  35143-data-model-publish-checks.md
next.1  migrated  37584  37499-disabled-holder-unbound-row-bare-write-refused.md
next.1  migrated  37600  36595-related-list-key-under-arrangement.md
next.1  migrated  37676  37304-knowledge-source-governed-type.md
next.1  migrated  37783  37712-agent-model-provider-retired.md
next.1  migrated  37807  35143-seeds-actions-checks.md
next.1  migrated  37840  36377-flow-bare-ordering-record-date-arithmetic.md
next.1  migrated  37870  37613-book-audience-one-gate.md
next.1  migrated  37910  37717-lookup-depends-on-param-computed-field.md
next.2  manual    37948  37851-disabled-holder-own-row-publish-rollback-refused.md
next.2  manual    38028  managed-email-password-held-off.md
next.2  manual    38042  36679-secret-rewrap-confirmation-exit.md
pending manual    37896  runtime-object-less-action-no-record.md
pending manual    37963  37467-knowledge-title-arm-retired.md
pending manual    37982  37907-knowledge-turso-test-connection.md
pending manual    38038  38019-knowledge-source-review-follow-ups.md
pending manual    38085  37622-related-list-keys-agree-under-arrangement.md
pending manual    38180  auth-switches-read-declaration.md
pending manual    38209  35879-served-schema-platform-stamped-keys.md
pending manual    38268  sec2-wf9p-f12.md
pending manual    38269  37752-app-list-edit-with-ai-removed.md
pending manual    38310  38041-knowledge-source-closure-system-object.md
pending manual    38431  36987-auth-updateuser-returns-void.md
pending manual    38452  38377-retire-split-algorithm-version.md
pending manual    38580  36057-scenarios-delete-agent-confirmation-names.md
pending migrated  37924  37856-ask-ai-action-type-retired.md
pending migrated  37929  36495-action-locations-acted-on.md
pending migrated  37971  37307-knowledge-source-references.md
pending migrated  38001  automation-variable-keys-reserved-segments.md
pending migrated  38013  37983-knowledge-source-save-needs-the-service.md
pending migrated  38060  37961-knowledge-source-unmounted-adapter-refused-at-save.md
pending migrated  38096  34562-record-structural-lint.md
pending migrated  38107  35143-views-dashboards-checks.md
pending migrated  38145  37214-chart-series-measure-format-refused.md
pending migrated  38168  36544-form-view-modal-size-retired.md
pending migrated  38216  33912-share-unknown-recipient-ledger.md
pending migrated  38216  33912-share-unknown-recipient.md
pending migrated  38273  33806-pending-confirmation-service-one-seam.md
pending migrated  38299  35924-publish-reparses-object-draft.md
pending migrated  38398  37753-build-progress-frame-retired.md
pending migrated  38470  38369-knowledge-held-without-embedder-or-store.md
pending migrated  38545  38150-adopt-orphans-door-retired.md
```

PR = the `(#N)` of the commit that added the changeset (`git log
--diff-filter=A`). The pass is the version commit that moved the file
into `.changeset/pre/`: next.0 33a31dc, next.1 30a8047, next.2
9d111a7 (`packages/spec/package.json` reads `19.0.0-next.0/1/2` at
each).

</details>

<details><summary>Page cross-checks</summary>

- Every one of the 155 PRs behind a breaking changeset is linked on the
page (0 missing), and the page links no PR outside that set.
- Each of the 30 pending changesets sits on a line carrying "— on
`main`", and no published one does.
- `!`-titled first-parent commits since 18.6.0 (958ee03) to `6eb23c87`:
135 (87 to `a46efa8c`, as the page said); all 135 are in the list.
- Registered markers resolved to their entry files
(`packages/spec/src/migrations/entries/*/N.*`,
`packages/spec/src/conversions/entries/N/`, and metadata-core's forward
conversion for `permission-view-all-fields-beside-record-bypass`): the
30 registered changesets added after `a46efa8c` name 39 ids, all on step
19; the 31 before it name 33 ids, 32 on step 18 and
`protocol-18-range-refused` on step 19.

</details>

## Acceptance notes

- **Pending changesets are in the list.** The card's done-when covers
every changeset between `a46efa8c` and the measurement sha; 30 of those
are still in `.changeset/` and ship in the next cut, so their lines are
marked "on `main`" and the intro says so.
- **`19.0.0-next.1` is not on npm.** `npm view PKG versions` for
`@objectstack/spec`, `core`, `cli`, `runtime` and `@object-ui/i18n`
lists `19.0.0-next.0` and `19.0.0-next.2` only. The header states that
fact and no more.
- **The registered split is now counted in changesets, not entries.**
The old page said 41 registered entries, 39 on protocol 18. Counting the
ids in the registered markers gives 33 at `a46efa8c` (32 on step 18), so
the 41/39 could not be reproduced from any stated method. The rewritten
intro and step 3 count changesets (31 on step 19, 30 on step 18, of 61),
which match the bullets one to one.
- **Followed the classifier where a title has no `!`:** objectstack-ai#37605, objectstack-ai#37883,
objectstack-ai#37963, objectstack-ai#38209 and objectstack-ai#38269 are breaking by their banner or their
`(narrowing)` arm; objectstack-ai#38209's Clause-② reads "no (narrowing …)", which the
classifier counts as breaking although the body says nothing a client
sends is refused. Listed as classified; no changeset changed.
- **objectstack-ai#37513** merged before the next.0 cut but its changeset was consumed
by next.1 (its body says the next.0 CHANGELOG missed it).
- **One line, several changesets**: objectstack-ai#37720, objectstack-ai#37366 and objectstack-ai#38216 each carry
two changesets; objectstack-ai#37818 with objectstack-ai#37948, objectstack-ai#38038 with objectstack-ai#38310 and objectstack-ai#38013 with
objectstack-ai#38060 share a line. The existing 102 lines were not rewritten.
- **Counts on a release page**: each is anchored to a named measurement
sha, the snapshot the card asks for; it is not a count kept in sync with
the tree.
- **objectstack-ai#37437** (closed card objectstack-ai#37922's bullet) is not added twice.
- **Check Changeset** will be red: this docs-only PR publishes nothing
from any package, the `skip-changeset` case, and the dispatch opens it
without labels, so that label is the seat's to apply.

## Verification

Read first, by risk: the method paragraph and header (`index.mdx` lines
6-47), the 自动迁移 intro, then the new 需手动处理 → Knowledge block.

Two-minute check: `git show
6eb23c8:.changeset/pre/37851-disabled-holder-own-row-publish-rollback-refused.md
| head -12` shows the `fix(metadata-protocol)!` summary and the BREAKING
banner behind the objectstack-ai#37948 line; `npm view @objectstack/spec dist-tags`
prints `{ latest: '18.6.0', next: '19.0.0-next.2' }`.

<details><summary>Local gate readings at b03fd5f</summary>

```
dispatch-gates --commands at b03fd5f: 52 commands (1 path changed)
first pass: 47 exit 0; 5 exit 3/1 = PREREQUISITE NOT MET (lint, spec, client-react unbuilt), re-run after building the closures under os-verify-lock (VERDICT command-exit 0 both):
  pnpm --filter '@objectstack/lint...' build ; pnpm --filter '@objectstack/client-react...' build
final: 52 of 52 :: exit 0
✓ dispatch-gates --ran: 52 derived famil(ies) accounted for — 52 run, 0 NOT-MEASURED (a DERIVED zero — all 52 recorded an exit code and none of them is 3).
check-release-page-status: OK — 3 GA major(s) in scope (v16, v17, v18)
```

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE

<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmRar3Kkg6SpwVgaaVE -->

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A manual record share to a user id that does not exist is accepted (201) and persists an inert sys_record_share row

3 participants