Repository navigation
fix(routes): attach the public invoice middleware through the registrar - #35
Merged
Merged
Conversation
RouteRegistrar::group() takes only the callback. Passing the attributes array as its first argument made Router::group() treat the array as a routes file, which fails with 'Array to string conversion' while the routes load and takes the whole API down. The Postman contract job hit it on release/v0.0.13.
Fixes to a release branch were only verified once the release PR itself re-ran, because every workflow listed main alone. Match core-api, which already runs on dev-v* and release/v* targets.
The bootstrap's RouteRegistrar only learned middleware from a group() attributes array, which is the Router form; the registrar's own middleware() call was missing, so the routes file could not be loaded in the test once it used it.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v0.0.13 #35 +/- ##
===================================================
Coverage 100.00% 100.00%
Complexity 1253 1253
===================================================
Files 74 74
Lines 6991 6990 -1
===================================================
- Hits 6991 6990 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes API Contract (Postman) on #32.
#34 wrapped the public invoice routes as
->group(['middleware' => [...]], function ...).RouteRegistrar::group()only takes the callback, so the attributes array reachesRouter::group()as the routes argument and is handed toRouteFileRegistrar, which tries torequireit:Every artisan command and request then fails while the routes load, which is why the contract job died right after
optimize:clear. The unit tests never caught it because the test bootstrap's fake registrar accepted an attributes array ongroup(), which the real one does not.This attaches the middleware with
->middleware([...])on the registrar chain, the same way Laravel's registrar does. Routes and middleware are unchanged. The fake registrar inscripts/pest-bootstrap.phpnow has amiddleware()of its own (pending middleware applied to the nextgroup()), so the routes test loads the file and keeps asserting which routes are logged.Also: run CI on pull requests against release and dev branches.
ember.yml,server.ymlandpostman.ymllistedmainalone underpull_request.branches, so a fix like this one was only verified once the release PR re-ran. They now match core-api and also run fordev-v*andrelease/v*targets; this PR's own checks are the proof.