Case documents and transitions
Upload required documents, satisfy engine guards, and move cases through workflow transitions.
Case documents and transitions
Operational cases follow the workflow definition linked to their monitored process. State-level documents define required file slots; transition-level require_documents: true tells the engine to block the move until every required slot is filled in the case providedDocuments context array.
Model the requirements
In the .kiket/workflows/ directory (workflow YAML files):
- Attach document slots to a state:
states:
risk_review:
type: active
documents:
- id: security_questionnaire
label: Security questionnaire
required: true- Opt a transition into the document guard:
transitions:
- from: risk_review
to: dpa_review
name: Submit DPA Review
require_documents: trueIn the visual editor, select the transition edge and enable Require documents in the property panel. The flag round-trips through YAML save.
Related guard toggles on the same edge:
- Require checklist → require_checklist: true
- Require approval → require_approval: true
Runtime behavior
When a user uploads a file for a case:
- The attachment is stored through
/api/v1/attachments/upload(dev) or/attachments/presign-upload(production storage). - Pass documentRequirementId matching the workflow RequiredDocument id.
- The API writes a document record (id, filename, attachmentKey, and related metadata) into the case
providedDocumentscontext array. - Transition checks read that array through the engine documentGuard.
Direct PATCH /platform/cases/:id with currentStateKey is rejected. Use the transition API instead so guards always run.
API surface
| Method | Path | Purpose |
|---|---|---|
| GET | /platform/cases/:id/transitions | Reachable transitions, blockers, and current document requirements |
| GET | /platform/cases/:id/check-transition?toState= | Dry-run a single transition |
| POST | /platform/cases/:id/transition | Execute a JSON body with toState through engine semantics |
| POST | /attachments/upload | Multipart upload; include caseId + documentRequirementId |
Web UI
Open Operational Cases, select a case, and use Workflow controls:
- Upload panels appear for each required document on the current state.
- Transition buttons show engine blockers inline when guards fail.
- Successful transitions refresh case state labels and close final states automatically.
Scanner alignment
The event scanner already evaluates blocked transitions using the same engine canTransition path. Keeping uploads and transitions on the platform APIs ensures UI actions, scanner findings, and audit evidence stay consistent.