fix: repair 5 MCP analysis tools with SQL errors + seed entity_status rows
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled

- get_event_timeline: event_type/actor/message → type/source/data::text
- get_blast_radius: add JOIN entities for slug column
- get_state_snapshot: remove nonexistent disk_usage_pct, drift_count
- get_change_history: timestamp/actor_label/details → ts/actor_id::text/detail
- seed: upsert entity_status rows during inventory ingest (was empty, causing INNER JOIN on get_health_summary to return nothing)
This commit is contained in:
2026-07-08 12:27:25 +02:00
parent 4724d6f297
commit 3ea43adcfd
4 changed files with 248 additions and 9 deletions

View File

@@ -131,6 +131,18 @@ func IngestInventorySeed(ctx context.Context, tx pgx.Tx, data map[string]any) (*
if err != nil {
return nil, fmt.Errorf("entity %s: %w", slug, err)
}
// Seed initial entity_status row so health queries return
// results even before the scheduler populates check results.
_, err = tx.Exec(ctx,
`INSERT INTO entity_status (entity_id, health, updated_at)
VALUES ($1, 'unknown', now())
ON CONFLICT (entity_id) DO NOTHING`,
entityID)
if err != nil {
return nil, fmt.Errorf("entity_status %s: %w", slug, err)
}
r.Entities++
}