Define allowed-routes allowlist for blocked-role navigation
epic-no-access-screen-access-control-task-006 — Create a constant or configuration set of route paths that remain accessible to blocked roles (e.g., /logout, /auth/login, /auth/org-select). Centralise this allowlist in the route guard so future route additions requiring bypass can be managed in one place without modifying guard logic.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 5 - 253 tasks
Can start after Tier 4 completes
Implementation Notes
Create lib/features/no_access/routing/no_access_route_constants.dart with: abstract class NoAccessRouteConstants { static const Set
This prevents route rename regressions. Keep the set small and well-commented — resist the urge to add speculative routes.
Testing Requirements
Unit tests using flutter_test. Test scenarios: (1) NoAccessRouteConstants.allowlistedPaths contains /logout, (2) contains /auth as prefix, (3) contains /no-access, (4) does NOT contain any main app routes (e.g., /home, /contacts). Also verify the guard correctly uses startsWith prefix matching against the set — test that /auth/login is covered by the /auth entry. These are fast, pure constant validation tests with no mocking required.
If the GoRouter redirect callback evaluates the no-access route itself as a blocked destination, it will trigger an infinite redirect loop, crashing the navigator.
Mitigation & Contingency
Mitigation: Add an explicit guard condition in the redirect callback: return null (no redirect) when the current location is already the no-access route or the logout route. Write a dedicated unit test covering this exact scenario.
Contingency: If the redirect loop is detected in production, deploy a hotfix that adds the null-return guard; the feature can be toggled off via the existing feature-flag infrastructure while the fix is prepared.
The access-denial-service may read role state before authentication completes (e.g. during app resume), causing a temporary false-positive block that redirects valid peer-mentor users to the no-access screen.
Mitigation & Contingency
Mitigation: Subscribe to the role-state-manager's loading/ready lifecycle and only evaluate role-based access once the RBAC state is confirmed as loaded. Return a 'pending' state that causes the guard to defer rather than redirect.
Contingency: Add a retry mechanism: if a user lands on the no-access screen but their role subsequently resolves as non-blocked, automatically navigate them to the role-based home screen.