fix: repair 5 MCP analysis tools with SQL errors + seed entity_status rows
- 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:
@@ -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++
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user