Files
Agent-System-Backend/internal/app/intent_flags_test.go
T
weichen 904742ca4b
ci / vet-and-test (pull_request) Successful in 40s
Wire GenAI telemetry: settings surface, service name, and agent names (N3 WP4)
Why: spans now follow the OTel GenAI convention (Agent-Native#32); the
product needs the settings surface for the exporter, a meaningful
service.name, and per-profile agent names.
Evidence: go test -count=1 ./... green; TestTelemetryFlagsDefaults
(otlpEndpoint registered default empty = no export, serviceName
default agent-system-backend); nested pins carry the convention work.
Impact: nothing is exported unless telemetry.otlpEndpoint (or the env
var) is set; agent spans are named by profile id.
Refs: Agent-Native#32, Agent-Squad#36, N3 plan WP4
2026-10-07 15:41:01 +00:00

45 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package app
import (
"testing"
"agent-system-backend/internal/settings"
core "agent-system-core"
)
// 慢通道开关默认关(行为与 I1 一致的机器证明):
// 两条 runtime.intentSemantic / runtime.intentGenerator 必须注册且默认 false。
func TestIntentSlowLaneFlagsDefaultOff(t *testing.T) {
seen := map[string]core.SettingDesc{}
for _, d := range settings.Schema() {
seen[d.Key] = d
}
for _, key := range []string{"runtime.intentSemantic", "runtime.intentGenerator"} {
d, ok := seen[key]
if !ok {
t.Fatalf("设置未注册:%s", key)
}
if d.Type != core.SettingBool {
t.Fatalf("%s 类型应为 bool,得到 %v", key, d.Type)
}
if def, isBool := d.Default.(bool); !isBool || def {
t.Fatalf("%s 必须默认 false,得到 %v", key, d.Default)
}
}
}
// 遥测开关默认安全(N3 WP4):otlpEndpoint 默认空(不导出,保持现状),
// serviceName 有非空默认。两处都注册进 Schema。
func TestTelemetryFlagsDefaults(t *testing.T) {
seen := map[string]core.SettingDesc{}
for _, d := range settings.Schema() {
seen[d.Key] = d
}
if d, ok := seen["telemetry.otlpEndpoint"]; !ok || d.Default != "" {
t.Fatalf("otlpEndpoint 必须注册且默认空:%+v", d)
}
if d, ok := seen["telemetry.serviceName"]; !ok || d.Default != "agent-system-backend" {
t.Fatalf("serviceName 必须注册且默认 agent-system-backend:%+v", d)
}
}