Implement platform management features

This commit is contained in:
npc0-hue
2026-08-17 08:48:45 +08:00
parent 65353cf269
commit 302f1f64b7
38 changed files with 2185 additions and 110 deletions
@@ -0,0 +1,31 @@
package service
import (
"testing"
"browser.local/platform/domain"
)
func TestSanitizeLogNetworkFieldsIsGameAgnostic(t *testing.T) {
batch := domain.LogBatchIngest{Entries: []domain.LogEntry{
{Fields: map[string]string{
"eventType": "game.session.opened",
"networkFingerprint": "fingerprint",
"ip": "192.0.2.1",
"ipAddress": "2001:db8::1",
"playerId": "player-1",
}},
}}
sanitizeLogNetworkFields(&batch)
fields := batch.Entries[0].Fields
for _, key := range []string{"networkFingerprint", "ip", "ipAddress"} {
if _, exists := fields[key]; exists {
t.Fatalf("expected %s to be removed", key)
}
}
if fields["playerId"] != "player-1" {
t.Fatal("expected unrelated fields to be preserved")
}
}