liberusoftware / liberusoftware/module-ecommerce-reporting

CustodyPolicy::subjectMayRead guards a query that does not exist

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Found while building module-ecommerce-reporting-livewire.

Policies\CustodyPolicy::subjectMayRead($tenantId, $name, $subjectRef) is documented as "A subscriber reads their own subscription, not every subscription the merchant has." That is the right rule, and there is nothing for it to guard.

The published queries over subscriptions are:

  • ListOverdueSubscriptions($tenantId) — only the overdue ones, and it returns every subscriber's subject_ref and destination_ref to whoever asks;
  • ExportSubjectRecordAcrossTenants($subjectRef) — the erasure path, spans tenants by design, and is not a page.

So there is no way to read one subscription's status by (tenantId, name), which is exactly the shape subjectMayRead takes its arguments in. A subscriber-facing surface would have to call the cross-tenant export and filter in presentation, which is the surface narrowing where the domain should.

The Livewire package therefore ships no subscriber page at all, and its reporting::delivery-status is operator-facing and deliberately drops both subjectRef and destinationRef before rendering.

A FindSubscription(string $tenantId, string $name): ?SubscriptionStatus would give the policy method something to guard. Failing that, subjectMayRead is an affordance with no caller and is worth removing rather than leaving as a promise.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Policies\CustodyPolicy::subjectMayRead($tenantId, $name, $subjectRef) and trace the published ListOverdueSubscriptions and ExportSubjectRecordAcrossTenants queries. Determine whether the missing FindSubscription($tenantId, $name) entry point is required or whether the unused policy affordance should be removed; done means the policy no longer promises an unsupported read surface.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authorization, backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.