Skip to content

plugin-sharing: expand the ruled field sharing recipient per record — expandRecipient reads the user field on the matched row, re-materialises on that record's own update, position stays rule-wide (services half of #14103, ruling B) #15072

Description

@zhuangjianguo

Blocked-by: #14103

Filed by the domain:spec seat (session_0174WZTU6XcFcS7g2kykC53i, seat post #6017) as the domain:services half the maintainer ruling on #14103 assigns to this seat to file (ruling 5507512776, director summon #8, 2026-09-02, verbatim 「同意」 adopting B). Contract-first: the spec half (ShareRecipientType gains field) lands first under #14103; this card dispatches when that PR is MERGED and the spec is consumable by this repo's packages. Filed with pm:blocked and the Blocked-by: line; the domain:* label is triage's.

Ruled scope (quoted from 5507512776)

Ruled: B. ShareRecipientType gains one member, field: sharedWith: { type: 'field', value: '<user-field-name>' } shares each matched record with the user or users named by that column on the record, honouring multiple: true. expandRecipient becomes per-record for that member only. ⛔ No manager member.

Execution, contract-first: … the spec seat files the domain:services half (plugin-sharing expandRecipient per-record expansion, re-materialisation on the record's own update, one pin that a position recipient still expands rule-wide) with Blocked-by: pointing at the spec half. Hard precondition for the services half, carried from the confidence gap: before implementing, read the reasoning that removed the owner recipient type and confirm on the tree that criteria-rule materialisation re-runs on a record update that changes the recipient field; if it does not, stop and report the fork rather than adding a second materialisation trigger.

Landing files (measured on origin/main 89eb997d, 2026-09-03T20:02Z; re-verify at dispatch)

  • packages/plugins/plugin-sharing/src/sharing-rule-service.tsSharingRuleService.expandRecipient is "the one switch that decides" (bu-tree-recompute.ts:26); the field member is the only per-record branch: read the named column on the matched record (a user id or, with multiple: true, an array), expand to sys_record_share rows for exactly those principals; every other member keeps its rule-wide expansion.
  • Re-materialisation: a record update that changes the recipient column must re-run the criteria-rule materialisation for that record — the precondition above says to CONFIRM the existing materialiser already does this before adding anything.
  • Pins: field single and multiple; a position recipient still expands rule-wide (the ruling's explicit pin); a record whose recipient column is empty shares with nobody (fail-closed); the owner-removal reasoning cited in the PR body.

Serial constraints known at filing

PR #14930 (open at 19:08Z) touches plugin-sharing/src/index.ts, sharing-rule-service.ts and a reconcile test — the same file this card lands in; the dispatching seat re-reads it. H17: on-hold #6736 declares plugin-sharing/src/sharing-service.ts as a Restart-touch trigger file — the dispatch owes it a notification if the surface reaches that file.

Refs

#14103 (the ruling and the spec half) · #14234 (closed; the misleading lint hint, landed separately) · #6736 · #8241 (the AND-composition family) · ADR on the owner recipient removal (to be located by the implementer: the reasoning the precondition names).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions