Pulse/internal/ai/chat/metrics_additional_test.go
rcourtman fa1b74792e docs: add comprehensive deep-dive documentation for AI subsystems
Adds detailed architecture documentation for Pulse Patrol and Pulse Assistant. Updates AI.md and PULSE_PRO.md. Also includes additional tests.
2026-02-02 10:29:07 +00:00

28 lines
1,009 B
Go

package chat
import "testing"
func TestAIMetricsRecording(t *testing.T) {
m := GetAIMetrics()
if sanitizeLabel("") != "unknown" {
t.Fatalf("expected empty label to be sanitized")
}
if sanitizeLabel("has space") != "has_space" {
t.Fatalf("expected spaces to be replaced")
}
m.RecordFSMToolBlock(StateReading, "pulse_query", ToolKindResolve)
m.RecordFSMFinalBlock(StateResolving)
m.RecordStrictResolutionBlock("validateResolvedResource", "restart")
m.RecordRoutingMismatchBlock("pulse_control", "node", "vm")
m.RecordPhantomDetected("provider", "model")
m.RecordAutoRecoveryAttempt("STRICT_RESOLUTION", "pulse_query")
m.RecordAutoRecoverySuccess("STRICT_RESOLUTION", "pulse_query")
m.RecordAgenticIteration("provider", "model")
cb := NewAIMetricsTelemetryCallback()
cb.RecordStrictResolutionBlock("validateResolvedResource", "start")
cb.RecordAutoRecoveryAttempt("ERR", "tool")
cb.RecordAutoRecoverySuccess("ERR", "tool")
cb.RecordRoutingMismatchBlock("pulse_control", "node", "vm")
}