ReturnRequestPolicy's docblock contradicts its own code on orphan visibility

Open Beginner friendly
#1 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
74/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Tech stack
php
Domain
authorization

Research direction

Start with the ReturnRequestPolicy docblock and compare its orphan-visibility statement with view(), ownsIt(), and the existing tests. Update the documentation to match the behavior those tests already assert: orphan returns are invisible and not writable; do not change the policy code.

Written by the indexing model from the issue text.

Description

ReturnRequestPolicy's docblock says an orphan return — one whose team_id is null — is "visible, so an orphan can be found and fixed, and not writable".

The code does not do that. view() calls ownsIt(), which is false when team_id is null, so an orphan is visible to nobody.

Code and tests agree with each other; only the docblock is out of step. Found while writing the Filament package's docs, where the docblock was the thing being documented from — a comment that describes an access decision that the code does not make is the kind of thing an adopter takes at face value.

Two ways out, and they are not equivalent:

  1. Fix the docblock. Orphans are invisible. That is a defensible position: a row with no team cannot be scoped, and showing it to whoever asks is cross-tenant by construction.
  2. Fix the code. Orphans become visible-but-not-writable, as written. That needs a deliberate answer to "visible to whom", because "anyone with the view ability" is every tenant.

(1) matches what the tests already assert, so it is the smaller change and the safer default. (2) is a real feature and should be argued for on its own terms if anyone wants it.

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

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.

More from liberusoftware/module-ecommerce-returns

All issues in liberusoftware/module-ecommerce-returns

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.