Action Inventory - Gap Analysis
This document lists the gaps identified during the exhaustive review of the codebase, comparing existing behaviors against the proposed v1 api-response-contract.md.
1. New ActionSpec Types Required
The following scenarios are not cleanly covered by the proposed v1 Action Registry and may require new, specific action types to be added.
| Scenario | Implied UI Action | Proposed New ActionSpec Type | Notes |
|---|---|---|---|
| Duplicate Resource | A POST request fails because an identical resource already exists (e.g., creating a duplicate assignment for the same user). | VIEW_EXISTING_RESOURCE | The UI needs to direct the user to the existing resource. An alternative is extending the GO_TO_DASHBOARD payload to include a highlight_id. |
| Legal Hold Block | A POST /compliance/forget request is blocked because the target user is under a legal hold. | VIEW_LEGAL_HOLD | The UI should ideally direct the admin to the part of the Compliance Centre where the legal hold can be reviewed or lifted. |
| Already Enrolled | A user tries to enroll in a programme they are already enrolled in. | VIEW_ENROLMENT | A simple "already enrolled" message is okay, but a better UX would be to navigate the user to their existing enrolment status page. |
| Generic Server Error | A 500 Internal Server Error occurs due to an unhandled exception or panic. | SHOW_FATAL_ERROR | The v1 registry lacks a generic action for when the only "next step" is to show a support reference ID and ask the user to try again later. |
2. Required Payload Extensions for Existing v1 Actions
Some existing behaviors can be mapped to the v1 registry, but require extending the action's payload to be fully effective.
ActionSpec Type | Required Payload Extension | Scenario / Reason |
|---|---|---|
REQUEST_ACCESS | resource_type: string?, resource_id: string? | The current payload only includes the missing capability. Adding the specific resource the user was trying to access provides more context for an admin who might grant the permission. |
3. Gaps in Code Implementation
This is a behavior defined in the v1 contract that is not yet fully implemented in the code.
ActionSpec Type | Missing Behavior | Current Behavior |
|---|---|---|
CREATE_NEW_VERSION | Attempts to PATCH a published, immutable resource (like an Evaluation Version) should be rejected with a 409 Conflict and this ActionSpec. | It is not clear from the current handler code (evaluation_versions.go) that this specific 409 Conflict with a structured error is being returned. The logic to block the edit likely exists, but it may be returning a generic error. |