Permissions, flags and failures
The server decides who may do what, and the screen follows. Contain each crash, time out slow requests, and survive expired sessions and lost networks.
- Required 4
- Recommended 4
Required
Enforce permissions on the server
RequiredTreat hidden and disabled buttons as a convenience only. The server checks the user's permission on every request, whatever the screen shows.
Survive an expired session
RequiredWhen a session expires, keep the screen and the unsaved work. Let the person sign in again in place, then repeat the request that failed.
Contain each crash to its panel
RequiredWrap each route and each independent panel in an error boundary. One broken part then shows a fallback, and the rest keeps working. Report every caught error.
Give every request a time limit
RequiredGive every request from the screen a time limit, say when a request is slow, and retry only reads and requests with an idempotency key.
Recommended
Let the server say what each user may do
RecommendedSend the actions the user may take on each record with the record, and show controls from that list. Never rebuild the permission rules in the client.
Read feature flags before the first paint
RecommendedDecide feature flags on the server and send them with the first page or data load. A flagged feature then never flashes in or out. The API checks the same flag.
Say when the network is gone
RecommendedWhen the connection drops, say so in a banner and keep everything already loaded on screen. Either queue changes with idempotency keys and send them on reconnect, or block them with a reason.
Recover when a new release replaces the old files
RecommendedWhen a tab still runs the old release and a code chunk fails to load after a deploy, reload once to get the new release. Keep older files online as keep the previous build's assets sets.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers app interface playbook: https://agentwranglers.se/playbook/app-ui/permissions-flags-and-failures.