Repository navigation
Support application-owned route policies with constrained dispatch wrappers - #1933
Draft
parsonsmatt wants to merge 5 commits into
Draft
parsonsmatt wants to merge 5 commits into
parsonsmatt wants to merge 5 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authorization tied to
Yesod.isAuthorizedmakes a focused route test depend on every policy in the application. This prototype lets generated dispatch retain an application-supplied constraint and invoke a handler wrapper using the selected fragment and its parent captures.setRouteDispatchWrapperwraps ordinary matched endpoints and matched subsite routes, including method mismatches. Subsite misses keep the normal 404 path.setRouteDataGeneratorand the exportedparseResourceTypeshelper let applications generate their own route views; Yesod no longer ownsRouteLeavesor its policy traversal. MWB uses these hooks to treat both nested fragments and subsite mounts as delegation to an endpoint's dictionary.The wrapper runs inside existing middleware and shares the handler's session. Existing users retain their dispatch behavior, and no exported runtime record gains a field. Mounts retain the existing parent-runner contract, including its documented limitation for transitive raw-WAI bypasses. The named authorization and plain handler-wrapper APIs remain available.
Validation: 715 yesod-core examples passed. A separate fixture compiled and ran three focused requests without unrelated policies, and a missing policy was rejected by GHC. The data-extension test covers root, focused, and subsite data splices and verifies dispatch does not invoke it.
The ordinary hspec-yesod suite needs no library changes: validation PR, with 81 examples passing. MWB integration owns the leaf model and migration.