-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Make load/create/update/delete entity authorization result interfaces consistent #253
base: @wschurman/02-19-chore_upgrade_typescript_and_related_packages
Are you sure you want to change the base?
Conversation
…erfaces consistent
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## @wschurman/02-19-chore_upgrade_typescript_and_related_packages #253 +/- ##
================================================================================================
Coverage 100.00% 100.00%
================================================================================================
Files 72 78 +6
Lines 1985 2033 +48
Branches 279 278 -1
================================================================================================
+ Hits 1985 2033 +48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Looks fine but I think it'd be a good idea to push out a breaking change to Entity where everything is enforcing by default and you need to call unenforcing() (or withAuthorizationResults()). We talked about this before I believe. Almost all our callsites use enforcing() and we'd be making the common case the default. |
Yep. This change to making it explicit should help with the proposed breaking change that changes the default (assuming upgrades are done one-by-one version). In the current state though (before this PR) we can't do the breaking change without creating risk of implicit return type changes which are harder to detect (wouldn't necessarily show up for |
Why
The idea here is to unify the pattern that we use for loading across mutations as well.
Currently, loading looks like:
But mutations still look like:
This is proving to be too error-prone. Mostly with the
deleteAsync
/enforceDeleteAsync
distinction not being explicit enough since the returned result fromdeleteAsync
is rarely used in application code.This PR proposes changing the mutations to be more like the loading:
How
Add layer in-between entity methods and mutator factories that requires dictating
enforcing
orwithAuthorizationResults
to vend a mutator.Note that this will likely require a codemod in any application that uses it. But the codemod is pretty straightforward.
Test Plan
This has full test coverage.