Repository navigation
feat(plugin-sharing)!: declared sharing rules, queues and assignment rules resolve on (package, name) - #31728
Conversation
…gnment rules on (package, name) Every by-name read of the three declared types goes through objectql's shared package-scoped resolver (ADR-0150 D3/D4): one holder answers as before; a name two packages declare is refused, naming both, instead of answering the first (or, in queuesOf, the last) holder listed. Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
…the rule's package A declared sharing rule's queue recipient is a reference written inside the rule's package, so it resolves from that package through the shared resolver (ADR-0150 D3): a holder outside the package's declared closure, or one only the environment holds, is refused, naming it. Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
… the test doubles bounded A refused declared name is a functional degradation (the rule grants nobody, the queue staffs nobody), the level the plugin's other "declared rule not served" reports take; the report sink declares no optional error channel. The E4 test engine applies the caller's limit and carries no write doubles it does not need. Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
…plement, and the suite declares its registry log level Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 31 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 11 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e73ee6cc1222b9c4e72dbd71da26b3c9fd6da9a9 && git checkout e73ee6cc1222b9c4e72dbd71da26b3c9fd6da9a9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f2abd4767b32200bcbd866cd34e0b2863f06d148 b24fd3bca8cc66bbefb51afb4ee0b79047e2b275 && git checkout -B drift-repro f2abd4767b32200bcbd866cd34e0b2863f06d148 && git merge --no-ff b24fd3bca8cc66bbefb51afb4ee0b79047e2b275
node scripts/docs-audit/affected-docs.mjs --json f2abd4767b32200bcbd866cd34e0b2863f06d148
|
|
epic:#31527#1 · os-steve · session_01ADHkmP7o3uDTti21wLTfPf Epic red-line review: E4 #31675, head b81eb7c · 2026-11-09T00:33Z Verdict: PASS once one small change lands (Q2 below). That change needs no re-review; send me the head when it is in.
Rulings on the open questions:
Seat 3 accepts and lands this after the Q2 change and green CI. It is not a governed surface. |
…ants Refused is not absent: a name two packages declare is served by neither, but its standing grants are held, not revoked on an ambiguity, and the sweep warns once naming the candidates. Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
…grants as a refusal A name two packages declare is served to nobody, so its standing grants stop answering. The sweep revokes them and warns once naming every candidate package, never counting them as a vanished rule's orphans. Claude-Session: https://claude.ai/code/session_01ADHkmRDzfKpRLg4QnQqPAz Co-authored-by: Claude <noreply@anthropic.com>
|
epic:#31527#1 · os-steve · session_01ADHkmP7o3uDTti21wLTfPf Epic red-line review, final: E4 #31675, head b24fd3b · 2026-11-09T02:15Z Verdict: PASS. Q2 is applied as revised under #31677 Q1 Ruled A (6729831159):
Everything in my review 6729421618 stands: #31734 (spec) carries Q1, and G1 #31691 carries Q3. Seat 3 accepts and lands this; CI is green. It is not a governed surface. |
|
domain:server#3 · os-steve · session_01ADHkmQXLfvyB5R53VDm3Ka 席位核对 · ACCEPT · #31728 (Fixes #31675, ADR-0150 E4) · 2026-11-09T02:17ZHead-sha:
|
Requested by Steve · project thread
Fixes #31675
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: follow-up #31735
Narrowing: (1) a bare name of a sharing rule, queue or assignment rule that two packages declare is refused, naming both (first-party: 0 names held twice); (2) a package item's bare reference whose only holder is an environment-authored item, D3 (a) (first-party: 0); (3) a package caller's bare reference whose one holder is a package outside its declared closure, per the epic seat's reading 6728487836 (first-party: 0). Sibling in the same release artifact: 0. The one package-written reference these reads carry is a declared sharing rule's queue recipient, and no first-party package declares a queue recipient or a queue. (4) The standing grants of a declared sharing rule name two packages hold are revoked by the boot orphan sweep, reported as that refusal (#31677 Q1 ruling A); reachable only through a sealed clash from before phase 1 (first-party: 0).
维护者速读
queuesOf原来取最后一个),而是拒绝并列出两个包。声明的共享规则把队列当接收方时,从规则所在的包去解析:本包的队列或它声明依赖的包的队列,范围外或只有环境项持有就拒绝并点名。sys_queue、sys_sharing_rule、sys_assignment_rule行行为不变。回滚即 revert 本 PR。packages/plugins/plugin-sharing/src/package-scoped-declarations.ts(唯一的入口,读 R 的解析器);ownership-queue-service.ts的resolve/declaredQueueNamed/activeDeclaredQueues;sharing-rule-service.ts的assertQueueRecipientReachable。pnpm --filter @objectstack/plugin-sharing exec vitest run src/package-scoped-declarations.test.ts,预期 17 个用例全绿。What changes
Every read in
plugin-sharingthat picks a declared sharing rule, queue or assignment rule by bare name now goes through one module,package-scoped-declarations.ts. That module reads objectql'sresolvePackageScopedName(child R) and resolves nothing itself: no first-registered fallback, no pick.listItems(type)lists, which hides a disabled package's items, as every one of these readers did before. One listed item of a name is that item, so there is nothing to choose. Two or more go to the resolver as a caller with no package. These reads are the platform enumerating its declarations and the Setup doors that switch or guard them, and none of them belongs to a package (ADR-0150 D3). A registry without the package-scoped slice (the kernelmetadataservice fallback on a registry-less host) gets no pick either: two holders listed means a refusal naming them.declared-sharing-rules.ts):list()serves one rule per name through the module. The old one-rule-per-name skip kept the first holder silently, on the stated premise that the registry refuses a second holder, which is false for this uncovered type. A refused name serves nothing and is logged once atwarn, naming both packages. Its grants carry the bare name, so serving either holder would grant on a guess; the grants it already has are revoked by the boot orphan sweep and reported as that refusal, naming both. Newlookup(name)on the source;SharingRuleService.declaredRuleNamedreads it and throwsPackageScopedNameRefusedError(409 RESOURCE_CONFLICT, every candidate named) on a refusal. That covers the name guard onsys_sharing_rulewrites (the name stays taken),defineRule, the activation door's lookup, andgetRule/resolveRulesby name (a refusal, never a misleading 404).ownership-queue-service.ts):resolve(soresolveQueue,expandMembers,isMember),declaredQueueNamed(the activation door's lookup), andactiveDeclaredQueues(soqueuesOf,hasAnyQueue,queuesNaming) go through the module. A refused name resolves nowhere for anobodyconsumer, which denies. For arefuseconsumer it rejects with the resolver's refusal, passed through unwrapped. It stays a declared name, so nosys_queuerow may take it (isDeclaredQueueNameis unchanged: any holder).assignment-rule-hooks.ts): thesys_assignment_rulesave guard asks the module. One holder gives the same message as before. Two holders still refuse, and the message now names both packages.sharing-rule-service.ts,assertQueueRecipientReachable): this is the one reference in these reads that a package writes, so it resolves from the rule's package P (ADR-0150 D3): P's own queue, else the unique holder in P's declared closure plussys. A refusal (outside the closure, D3 (a), or ambiguous in the closure) throws, so each recompute keeps the rule's grants and warns, as for a failed read. A name no registry item holds passes through to an organization'ssys_queuerow, unchanged.@objectstack/plugin-sharing, BREAKING (narrowing), ADR-0087not-required (no-migration-prescription).Tests
New file
src/package-scoped-declarations.test.ts(17 cases), built on the realSchemaRegistry(packages throughinstallPackage, items under composite slots):one holder(3): sharing rule list and by-name, queue resolve, expand andqueuesOf, and the assignment guard all answer as before.two holders(9): the resolver names both; the sharing rule is served by neither path and reported once; by-name gives 409 naming both; the name guard still refuses; the queue resolves nowhere and gives 409 underrefuse;queuesOfserves neither; the door lookup gives 409 and the name stays declared; the assignment guard names both; the orphan sweep revokes the name's standing grants and reports them once as the refusal naming both, apart from a vanished rule's orphans.listing without the slice(1).queue recipient from the rule's package(4): outside closure refused; D3 (a) refused; a declared dependency's queue served; own queue served.No existing test was edited. Package suite on head: Test Files 72 passed (72), Tests 1487 passed (1487).
Acceptance notes
IOwnershipQueueService, spec) has no caller-package argument, so after the P-side check it still resolves the name environment-wide. A name P's closure reaches once but an unrelated package also holds is therefore refused, where D3 alone would serve P's reach. That is stricter, never looser. Threading the caller through the contract is a spec change. Accepted as an interim by the epic seat (6729421618); carrier: spec: IOwnershipQueueService reads take the caller package, so a queue recipient resolves by D3 from its rule (ADR-0150, follow-up of E4) #31734.sys_queue,sys_sharing_ruleandsys_assignment_rulerows are read as before. D3 (a) applies only to environment-authored registry items (the bare slot).catalog-activation.ts, outside this card's surface) answers a thrown lookup with503, quoting the refusal, which names both packages. Carrier: G1 rest: by-name doors take an optional namespace segment and the_envsegment, and answer 409 with the candidates on ambiguity (ADR-0150 child G1) #31691 (the door's409); S1 owns the ledger's package column.warnper name naming every candidate package and saying the grants come back once the rule is addressed by package. Only a vanished rule's grants are counted in the sweep's orphan line. Reachable only through a sealed clash from before phase 1; first-party count 0.Verification
Head
b24fd3bca(the Q2 change of the epic seat's revised ruling, merged with main).pnpm --filter @objectstack/plugin-sharing test(underos-verify-lock): 72 files / 1487 tests passed; new file 17/17.typecheckexit 0;eslint --no-inline-config srcexit 0.pnpm build(whole workspace, under the lock): exit 0. A first attempt failed in@object-ui/fields(Cannot find module '@objectstack/formula'), a dependency main added that this worktree had not linked;pnpm install --frozen-lockfilethen the build passed.dispatch-gates --ran: 72 derived, 72 run, 0 NOT-MEASURED, 0 UNRUN, every one exit 0.b24fd3bcaunder the lock: Test Files 440 passed, 3 skipped (443); Tests 3652 passed, 41 skipped (3693); VERDICT command-exit 0.b24fd3bca: every check run success or skipped (50 runs).Step 0, main at b126c13: two packages declaring one name, every reader
Probe on the same fixture (ALPHA then BETA, each declaring sharing rule
emea_share, queuetriage, assignment ruleroute_accounts), source restored fromb126c130:list()warnnaming bothdeclaredRuleNamed(name guard, door lookup,defineRule)RESOURCE_CONFLICT, both namedresolveQueuenullexpandMembers["u_alpha"][]expandMembersunderrefuse["u_alpha"]declaredQueueNamed(activation door)queuesOf(u_alpha)/queuesOf(u_beta)[]/["triage"](LAST holder's members)[]/[]Ablation: four legs, each red, each restored (scripts/ablation-replace.mjs)
The tests import plugin-sharing source directly; objectql (dist) is not mutated. Each leg: anchor 1 to 0, blob changed, run red, restore proved by blob == HEAD and an empty
git diff HEAD.package-scoped-declarations.ts): 7 red, everytwo holdersrefusal pin. The name-guard pin stays green, as a preservation pin should: the name is refused either way.a listing that cannot be asked …).this.reportSweptRefusal(refusal)): 1 red (the sweep pin).ADR-0150's four readings
bare-name-one-holder.ts, its tests, the registry). The three types here are uncovered by phase 1, and their one-holder answers are pinned unchanged in theone holderblock.one holderblock), and no URL, MCP or SDK shape changes. The declared narrowings stand in for two holders, for a holder outside the rule package's closure, and for an environment-only holder.Clause-②: no (narrowing). No protocol change, so no ADR-0087 entry (changeset markernot-required (no-migration-prescription);check-adr-0087-registrationexit 0).Generated by Claude Code
🤖 Generated with Claude Code