Skip to main content

Current Action Inventory (v0) - Exhaustive

This document is a deep-dive inventory of the existing "next action" behaviors currently implied by the backend codebase. It serves as the "as-is" analysis, mapping current error and success responses to a proposed ActionSpec type from the v1 contract.

This is the foundation for refactoring towards the formal API Response Contract.


Exhaustive Implicit Action Inventory

Endpoint / ScenarioTriggerImplied UI ActionProposed ActionSpecwork_stateFile references
Any Authenticated RouteMissing or invalid JWT tokenRedirect user to the login pageREAUTHENTICATENOT_SAVEDhttp/middleware/auth.go
Any Capability-Gated RouteUser lacks the required capabilityInform user they have insufficient permissionsREQUEST_ACCESSNOT_SAVEDservices/authz/service.go
GET for a resourceRLS prevents access or resource does not existShow a standard "Not Found" page(None)(N/A)Various handlers (services.ErrNotFound)
Any endpoint (e.g. /auth/login)Rate limit exceeded (429 Too Many Requests)Inform user to wait before trying againRETRYNOT_SAVEDhttp/middleware/ratelimit.go
Any Write OperationOptimistic locking failure (e.g., stale updated_at)Inform user data is stale; refresh and retryREFRESH_AND_RETRYNOT_SAVEDservices/evaluation_service.go
POST /usersErrConflict due to existing emailInform user the email is already in useRESOLVE_VALIDATIONNOT_SAVEDhttp/handler/user_handlers.go
POST /evaluations/.../publishservices.ValidationError (e.g., empty sections)Display specific validation warnings to the authorRESOLVE_VALIDATIONNOT_SAVEDhttp/handler/evaluation_versions.go
DELETE /evaluations/\{id\}services.EvaluationInUseError (has submissions)Inform user it was archived, not deletedGO_TO_DASHBOARD (kind: PARTIAL_SUCCESS)(N/A)http/handler/evaluation_core.go
POST /sessions/.../submitSession is already submitted (Idempotency)Inform user the submission is already completeGO_TO_DASHBOARDSAFEhttp/handler/evaluation_sessions.go
POST /sessions/.../answers or .../submitSession is closed or abandonedInform user the attempt is over; input was not savedGO_TO_DASHBOARDNOT_SAVEDhttp/handler/evaluation_sessions.go
POST /assignmentsErrConflict on unique index (duplicate assignment)Inform user an identical assignment already existsNEW ACTION NEEDED (VIEW_EXISTING)NOT_SAVEDservices/assignments_service.go
POST /assignments/\{id\}/redeemErrInvalidInput (attempt limit reached)Inform user they have no more attempts remainingGO_TO_DASHBOARDNOT_SAVEDservices/assignments_service.go
POST /assignments/\{id\}/redeemUser has an existing active sessionOffer to resume the existing sessionRESUME_SESSIONNOT_SAVEDservices/assignments_service.go
POST /compliance/... (Async Jobs)Successful async job creation (202 Accepted)Start polling the job's URL for completionPOLL_JOB(N/A)http/handler/compliance_jobs.go
POST /results/.../apply (Async Jobs)Successful async remediation job start (202 Accepted)Navigate to a view to monitor the batch statusVIEW_BATCH_STATUS(N/A)http/handler/results_remediation_handlers.go
POST /compliance/forgetTarget user is under a legal holdInform user the action is blocked by a legal holdNEW ACTION NEEDED (VIEW_LEGAL_HOLD)NOT_SAVEDworkers/privacy_jobs_worker.go
POST /programmes/\{id\}/enrolErrConflict because user is already enrolledInform user they are already enrolledNEW ACTION NEEDED (VIEW_ENROLMENT)NOT_SAVEDservices/programme_enrolment_service.go
(Any endpoint)Attempt to edit a published/immutable resourceBlock the action and inform the user whyCREATE_NEW_VERSIONNOT_SAVED(Gap - See Action Gap List)
(Any endpoint)Unhandled exception / panicShow a generic error with a reference codeNEW ACTION NEEDED (FATAL_ERROR)UNKNOWNhttp/middleware/recoverer.go

Note: This more exhaustive list covers the primary and cross-cutting "next action" behaviors implemented or implied in the backend. work_state is only noted where user-entered input could be at risk.