Alternative to #3041: gate UI on my/routes (allowed-route manifest)#3044
Merged
Conversation
…-open tests
- fetchInstance() now validates Array.isArray(json) before using the parsed body;
a non-array 200 response (error envelope, null, {}) returns null like a network
failure instead of propagating into load() and rejecting refresh()
- Add test: both instances return non-array 200 → loaded=false
- Add test: both instances throw network error → loaded=false (global fail-open)
- Fix arrange() in useAllowedRoutes.spec.ts to set loadAttempted=true so future
ready-computed tests work correctly by default
Auto-fix prettier in apiRoutes.ts, routeMatching.ts, AllowedRoutesStore.ts, AllowedRoutesStore.spec.ts. Remove async from mock json() helpers (require-await). Add eslint-disable-next-line for intentional future-scope _resource param in useAllowedRoutes.ts.
Each store now calls useAllowedRoutes/canCall and exposes a typed computed
getter (canRetry, canEdit, canDelete, canRestore, canManageNotifications,
canTestNotifications, canManageRedirects, canDeleteEndpointInstance,
canDeleteMonitoredEndpoint). Components bind to store.canX via storeToRefs;
the old can("...") calls and usePermissions imports are removed from all
migrated files. Test updated from PermissionsStore to AllowedRoutesStore.
ServiceControl serializes its HTTP API in snake_case, so the manifest field is url_template, not urlTemplate. Reading the camelCase name yielded undefined keys so gating never matched against a live server. Tests now use the real wire shape.
dvdstelt
approved these changes
Jun 26, 2026
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.
Alternative to:
Instead of gating the UI on ServiceControl's internal permission vocabulary (
can("error:messages:retry")frommy/permissions/all), this gates on the API routes the token may call (canCall(ApiRoutes.retryMessage)fromGET /api/my/routes— ServiceControl PR Particular/ServiceControl#5556). ServicePulse couples only to the public HTTP routes it already calls, so a permission-model change on the server can't break the UI.apiRoutes.ts, capability →{method, path}) + structural matcher (param names collapsed to{}; couples to method+path only).Map; fail-open per instance (older ServiceControl 404 → UI unchanged).canCall(entry, resource?)— the (dormant) seam for future per-resource scope.Depends on ServiceControl
my/routes(Particular/ServiceControl#5556). Targets the #3041 branch so the delta is reviewable in isolation.Compare #3041 branch vs this branch: authz-resource-scopes...route-based-ui-gating