Files
Pulse/internal/ai/tools/names_test.go
rcourtman 39f988b220 Remove AI Discovery
AI Discovery ran a separate model-backed service scanner beside Patrol
and the Assistant: its own store, scheduler, model route, API, tool and
drawer UI. No telemetry counter ever measured its use (the telemetry
discovery_enabled flag OR'd it with network subnet discovery), the
maintainer judged it a flop, and the context it produced is already
available to the models through pulse_query, pulse_read and the
unified-resource context sections.

This deletes internal/servicediscovery, internal/ai/infradiscovery, the
pulse_discovery tool, the /api/discovery routes, the mock Discovery
fixtures, the Discovery tabs in the resource, guest, node and Docker host
drawers, the identified-service cards, readiness badges, provenance
markers, suggested web-interface URLs, the Workloads AI Context column,
the chat "Discovery is off" hint and the AI Service Context settings page.
The old settings route redirects to Assistant settings. The model-bound
sanitizer allow-list existed only to pass Discovery context through, so it
goes too, along with the CopyableCodeRow primitive that only the
Discovery tab used.

Network subnet discovery (/api/discover, the Infrastructure discovery
settings) and the discoveryTarget agent coordinates are separate features
and stay. Stored discovery_enabled, discovery_interval_hours and
discovery_model AI settings are ignored on load; the settings API decoder
is lenient, so older frontends saving those fields still succeed.
2026-10-11 22:20:25 +01:00

93 lines
2.4 KiB
Go

package tools
import (
"testing"
"github.com/rcourtman/pulse-go-rewrite/internal/agentcapabilities"
)
func TestKnownToolNamesIncludesRegisteredTools(t *testing.T) {
// Spot-check a representative subset of canonical names that should
// always be registered. Drift here means registerTools() lost a tool
// or IsKnownToolName() stopped reading from the canonical registry-backed
// shared provider-tool name catalog.
expected := []string{
agentcapabilities.PulseQueryToolName,
agentcapabilities.PulseReadToolName,
agentcapabilities.PulseSummarizeToolName,
agentcapabilities.PulseControlToolName,
agentcapabilities.PulseMetricsToolName,
agentcapabilities.PulseStorageToolName,
agentcapabilities.PulseDockerToolName,
agentcapabilities.PulseKubernetesToolName,
agentcapabilities.PulseAlertsToolName,
agentcapabilities.PulseKnowledgeToolName,
agentcapabilities.PulsePMGToolName,
agentcapabilities.PulseQuestionToolName,
agentcapabilities.PatrolReportFindingToolName,
agentcapabilities.PatrolResolveFindingToolName,
agentcapabilities.PatrolGetFindingsToolName,
agentcapabilities.PatrolAssessFindingToolName,
agentcapabilities.PatrolActionCapabilitiesToolName,
agentcapabilities.PatrolProposeActionToolName,
}
for _, name := range expected {
if !IsKnownToolName(name) {
t.Errorf("IsKnownToolName(%q) = false, want true", name)
}
}
}
func TestRetiredFileMutationToolIsNotKnown(t *testing.T) {
if IsKnownToolName(agentcapabilities.PulseFileEditToolName) {
t.Fatal("retired file mutation tool must not remain in the provider catalog")
}
}
func TestIsKnownToolNameRejectsUnknown(t *testing.T) {
cases := []string{
"",
"frobnicate",
"my-vm",
"PULSE_QUERY", // case-sensitive
"pulse_unknown_tool",
}
for _, name := range cases {
if IsKnownToolName(name) {
t.Errorf("IsKnownToolName(%q) = true, want false", name)
}
}
}
func TestIsKnownToolNamePrefix(t *testing.T) {
cases := []string{
"p",
"pulse_",
"pulse_q",
"pulse_re",
"pulse_read",
"patrol_",
"patrol_report",
}
for _, prefix := range cases {
if !IsKnownToolNamePrefix(prefix) {
t.Errorf("IsKnownToolNamePrefix(%q) = false, want true", prefix)
}
}
}
func TestIsKnownToolNamePrefixRejectsUnknown(t *testing.T) {
cases := []string{
"",
"x",
"Pulse_",
"helper",
"pulse_unknown_tool",
}
for _, prefix := range cases {
if IsKnownToolNamePrefix(prefix) {
t.Errorf("IsKnownToolNamePrefix(%q) = true, want false", prefix)
}
}
}