Repository navigation
feat!: own the admin namespace base and resolve it once - #41
Merged
Merged
Conversation
The admin base was a core constant written into config by this component and read back by everyone: `admin_route_segment` and `admin_route_name_prefix` were two values for one namespace, and a component that reached for the module half instead of the composed pair produced names no route answers. The base now lives here, where it belongs: ADMIN_NAME with one override key (admin_name), resolved by getAdminName(). Components that publish admin routes require this package already, so they consult this value instead of restating it. This component's own routes are that namespace itself — getAdminSegment() `admin` and getAdminNamePrefix() `admin.` — so there is no double prefix to special-case. Route names lose the `webware.` vendor segment in the process: the dashboard is `admin.dashboard.read` on `/admin`. BREAKING CHANGE: admin_route_segment/admin_route_name_prefix are replaced by admin_name; getAdminRouteSegment()/getAdminRouteNamePrefix() are replaced by getAdminSegment()/getAdminNamePrefix(); COMPONENT_NAME is declared here. Signed-off-by: Joey Smith <jsmith@webinertia.net>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Codecov's patch gate flagged 13 uncovered lines in this branch: the three new accessors had no tests, and neither factory had one at all. The accessors are covered for the default, a configured override, and the fallback for a value that is not a usable string. The factories are asserted behaviourally rather than through reflection: the route factory registers /webware.admin's successor at the resolved path and name, and the URL factory passes the resolved prefix to the helper, so a mis-composed namespace fails the test instead of hiding in private state. Signed-off-by: Joey Smith <jsmith@webinertia.net>
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.
Foundation PR 2 of 2 — depends on
webware-core'sfeat/component-name-standard. Merge that first, then this, then cut a release of both.Why
The admin base was a core constant, written into config by this component and read back by everyone through two keys (
admin_route_segment,admin_route_name_prefix) for what is really one namespace. A component that reached for the module half instead of the composed pair produced names no route answers — that is the acl seed defect.What
The base now lives here, where it belongs:
ADMIN_NAME = 'admin'— the default.ADMIN_NAME_KEY = 'admin_name'— the single override key, replacing the two.getAdminName()— resolves the base (config value, elseADMIN_NAME). Components that publish admin routes already require this package, so they consult this instead of restating it.getAdminNamePrefix()/getAdminSegment()—admin.andadmin, which is what this component's own routes use. No double prefix, no special case.ConfigProvidernow publishesadmin_nameas its default config, and the dashboard route is namedadmin.dashboard.readand mounted at/admin(thewebware.vendor segment is gone from route names fleet-wide).Verification
mago fmt/format --check/lint/analyze/guardclean;composer test15 tests / 27 assertions OK;composer test-integration11 tests / 17 assertions OK.Verified against core's branch by temporarily pointing
vendor/webware/webware-coreat the sibling clone, because this package resolves core from a released tag — that local symlink was reverted afterwards and is not part of this change.Breaking
admin_route_segment/admin_route_name_prefixare replaced by the singleadmin_name;getAdminRouteSegment()/getAdminRouteNamePrefix()are replaced bygetAdminSegment()/getAdminNamePrefix();COMPONENT_NAMEis declared here.