Propagate correlation_id/causation_id through execution events, add API version header

Execution events (started/failed/succeeded) never carried the
correlation/causation IDs from the ExecuteRequest, even though the
fields existed on Execution. Added CausationID to ExecuteRequest and
Execution, and split emitEvent into a correlated variant used
throughout the execution lifecycle. handleExecute falls back to
X-Correlation-ID/X-Causation-ID headers when the body omits them.
Also add X-Hexis-Version negotiation on /api/v1/*, matching Nexus.

Part of Vikunja #273.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ghELqYhZNLub2TXGMazqA
This commit is contained in:
kami
2026-07-20 11:11:49 +04:00
parent 89d8433d17
commit ed593efb71
5 changed files with 390 additions and 14 deletions
+2
View File
@@ -11,6 +11,7 @@ type ExecuteRequest struct {
Origin map[string]string `json:"origin,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
CausationID string `json:"causation_id,omitempty"`
ResolutionEvidence []map[string]any `json:"resolution_evidence,omitempty"`
ConfirmationID string `json:"confirmation_id,omitempty"`
}
@@ -68,6 +69,7 @@ type Execution struct {
Error string `json:"error,omitempty"`
ResolutionEvidence []map[string]any `json:"resolution_evidence,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
CausationID string `json:"causation_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}