MCPcopy
hub / github.com/multica-ai/multica / TestReasonStringWireValues

Function TestReasonStringWireValues

server/pkg/taskfailure/failure_test.go:14–57  ·  view source on GitHub ↗

TestReasonStringWireValues pins the on-the-wire string for every canonical reason. These strings are persisted into agent_task_queue.failure_reason and surfaced as Prometheus labels — renaming any of them is a breaking change. If this test fails because you intended to rename a value, also update th

(t *testing.T)

Source from the content-addressed store, hash-verified

12// you intended to rename a value, also update the SQL classifier in
13// MUL-1949 and ship a backfill migration before changing the constant.
14func TestReasonStringWireValues(t *testing.T) {
15 t.Parallel()
16
17 cases := []struct {
18 reason Reason
19 want string
20 }{
21 // Platform-side.
22 {ReasonQueuedExpired, "queued_expired"},
23 {ReasonRuntimeOffline, "runtime_offline"},
24 {ReasonRuntimeRecovery, "runtime_recovery"},
25 {ReasonTimeout, "timeout"},
26 {ReasonIterationLimit, "iteration_limit"},
27 {ReasonAgentBlocked, "agent_blocked"},
28 {ReasonAPIInvalidRequest, "api_invalid_request"},
29 // Agent-side.
30 {ReasonAgentProviderAuthOrAccess, "agent_error.provider_auth_or_access"},
31 {ReasonAgentProviderQuotaLimit, "agent_error.provider_quota_limit"},
32 {ReasonAgentProviderCapacityOrRateLimit, "agent_error.provider_capacity_or_rate_limit"},
33 {ReasonAgentProviderServerError, "agent_error.provider_server_error"},
34 {ReasonAgentProviderNetwork, "agent_error.provider_network"},
35 {ReasonAgentProcessFailure, "agent_error.process_failure"},
36 {ReasonAgentEmptyOrUnparseableOutput, "agent_error.empty_or_unparseable_output"},
37 {ReasonAgentTimeout, "agent_error.agent_timeout"},
38 {ReasonAgentContextOverflow, "agent_error.context_overflow"},
39 {ReasonAgentMissingConfig, "agent_error.missing_config"},
40 {ReasonAgentModelNotFoundOrUnavailable, "agent_error.model_not_found_or_unavailable"},
41 {ReasonAgentRuntimeVersionUnsupported, "agent_error.runtime_version_unsupported"},
42 {ReasonAgentRuntimeMissingExecutable, "agent_error.runtime_missing_executable"},
43 {ReasonAgentUnknown, "agent_error.unknown"},
44 }
45
46 if got, want := len(cases), 21; got != want {
47 t.Fatalf("constant count = %d, want %d (canonical taxonomy size)", got, want)
48 }
49
50 for _, c := range cases {
51 t.Run(c.want, func(t *testing.T) {
52 if got := c.reason.String(); got != c.want {
53 t.Errorf("Reason(%q).String() = %q, want %q", c.reason, got, c.want)
54 }
55 })
56 }
57}
58
59// TestIsAgentError pins the platform-side vs agent-side split so a
60// future Prometheus collector / retry policy can rely on the prefix

Callers

nothing calls this directly

Calls 2

RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected