Add tiered LOTL mining onion and fleet recon so agents can fallback across execution tiers while operators see spread and vuln posture in Crucible. Includes triple-onion chain, spread cred graph, and full Go/TS/E2E test validation.

This commit is contained in:
AetherForge
2026-06-06 23:53:21 -07:00
parent 6372b07e6c
commit 3938bcd1c5
268 changed files with 21347 additions and 1130 deletions

View File

@@ -0,0 +1,49 @@
package db
import (
"fmt"
"testing"
"time"
)
func TestBulkLastFleetTaskRunsAtScale(t *testing.T) {
d, err := New(t.TempDir())
if err != nil {
t.Fatal(err)
}
defer d.Close()
const agents = 120
const tasks = 25
agentIDs := make([]string, agents)
taskIDs := make([]string, tasks)
for i := 0; i < agents; i++ {
agentIDs[i] = fmt.Sprintf("agent-%03d", i)
}
for j := 0; j < tasks; j++ {
taskIDs[j] = fmt.Sprintf("task-%02d", j)
}
// Seed a subset of runs (not full N×M matrix).
for i := 0; i < agents; i += 3 {
for j := 0; j < tasks; j += 2 {
if err := d.RecordFleetTaskRun(agentIDs[i], taskIDs[j]); err != nil {
t.Fatal(err)
}
}
}
start := time.Now()
got, err := d.BulkLastFleetTaskRuns(agentIDs, taskIDs)
elapsed := time.Since(start)
if err != nil {
t.Fatal(err)
}
if len(got) == 0 {
t.Fatal("expected some last-run rows")
}
if elapsed > 2*time.Second {
t.Fatalf("bulk query too slow at %d×%d: %v", agents, tasks, elapsed)
}
t.Logf("BulkLastFleetTaskRuns %d agents × %d tasks: %d rows in %v", agents, tasks, len(got), elapsed)
}