Decouple stream cancellation and clarify failover rules
This commit is contained in:
@@ -61,3 +61,26 @@ func TestPriorityDemotionRecordFromEventPayloadKeepsReason(t *testing.T) {
|
||||
t.Fatalf("expected createdAt %s, got %s", createdAt, record.CreatedAt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPlatformPolicyEventFromPayloadUsesAttemptErrorMessage(t *testing.T) {
|
||||
createdAt := time.Date(2026, 5, 12, 10, 30, 0, 0, time.UTC)
|
||||
record := platformPolicyEventFromPayload("event-1", "task-1", "task.policy.failover_disabled", "fallback event message", "upstream invalid api key", map[string]any{
|
||||
"platformId": "platform-1",
|
||||
"platformModelId": "platform-model-1",
|
||||
"reason": "failover_allow_policy",
|
||||
"errorCode": "auth_failed",
|
||||
"category": "auth_error",
|
||||
"statusCode": float64(401),
|
||||
"policySource": "gateway_runner_policies.failover_policy",
|
||||
"policy": "failoverPolicy",
|
||||
"policyRule": "allowCategories",
|
||||
"matchedValue": "auth_error",
|
||||
}, createdAt)
|
||||
|
||||
if record.EventType != "task.policy.failover_disabled" || record.Reason != "failover_allow_policy" {
|
||||
t.Fatalf("expected disabled event identity to survive, got %+v", record)
|
||||
}
|
||||
if record.ErrorMessage != "upstream invalid api key" || record.StatusCode != 401 {
|
||||
t.Fatalf("expected disabled reason details from attempt, got %+v", record)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user