package companion import ( "testing" "time" ) func TestConsoleSemanticEventProducerParsesOnlyBoundedKnownOutput(t *testing.T) { availability := VerifiedSemanticEventProducer() if !availability.Available || availability.Reason == "" { t.Fatalf("console event producer should be available: %+v", availability) } batch := ParseConsoleRecords("server-1", []ConsoleRecord{{ServerID: "server-1", Stream: "stdout", Sequence: 1, OccurredAt: time.Now(), Text: "SCUM LOGIN 76561198000000001 10.0.0.1"}, {ServerID: "server-1", Stream: "stderr", Sequence: 2, OccurredAt: time.Now(), Text: "unrecognised output"}}, "fixture-secret") if len(batch.Events) != 1 || batch.Events[0].Type != "scum.login" || batch.Events[0].NetworkCorrelation == "" || len(batch.Diagnostics) != 1 || batch.Diagnostics[0].Code != "unknown-console-format" { t.Fatalf("unsafe console parsing result: %+v", batch) } if batch.Events[0].NetworkCorrelation == "10.0.0.1" { t.Fatal("raw network value leaked") } }