feat(auth): add recent activity logging to access tracker
CI / build-and-test (push) Failing after 0s

* Introduced AccessLogEntry type for logging access details
* Updated AccessTracker to maintain a recent activity log
* Modified Metrics to include recent activity log in response
* Added RecentActivityLog component to display logged activities
This commit is contained in:
2026-05-24 16:36:59 +02:00
parent e38a0377d5
commit 0227912325
6 changed files with 106 additions and 5 deletions
+8 -2
View File
@@ -58,8 +58,14 @@ func TestStatusSnapshotShowsTrackedAccess(t *testing.T) {
if snapshot.Metrics.UniqueTools != 1 {
t.Fatalf("Metrics.UniqueTools = %d, want 1", snapshot.Metrics.UniqueTools)
}
if len(snapshot.Metrics.TopIPs) != 0 || len(snapshot.Metrics.TopAgents) != 0 || len(snapshot.Metrics.TopTools) != 0 {
t.Fatalf("Top breakdowns should be hidden in counts-only status: %+v", snapshot.Metrics)
if len(snapshot.Metrics.TopIPs) != 1 || len(snapshot.Metrics.TopAgents) != 1 || len(snapshot.Metrics.TopTools) != 1 {
t.Fatalf("Top breakdowns not populated: %+v", snapshot.Metrics)
}
if len(snapshot.Metrics.RecentLog) != 1 {
t.Fatalf("RecentLog len = %d, want 1", len(snapshot.Metrics.RecentLog))
}
if snapshot.Metrics.RecentLog[0].Tool != "list_projects" {
t.Fatalf("RecentLog[0].Tool = %q, want %q", snapshot.Metrics.RecentLog[0].Tool, "list_projects")
}
}