package httpapi import ( "context" "github.com/dtoro/oikos/internal/db" "github.com/google/uuid" "github.com/jackc/pgx/v5" ) // ensureDefaultChecks derives an entity's default checks from the monitoring // kinds its type declares. Thin wrapper over the shared db.EnsureEntityChecks // hook so the HTTP create/patch paths and the MCP entity-mutation tools stay // in lockstep. // // Note the ordering caveat (carried from db.LoadTypeTree / checkdefaults.Ensure): // an entity created through the API usually has no edges yet, so a type whose // address comes from its host (a service) will produce no checks on this pass. // That gap is real and deliberately visible — coverageSweep reports it, and // the next inventory ingest fills it in once the hosting edge exists. func ensureDefaultChecks(ctx context.Context, tx pgx.Tx, entityID uuid.UUID, slug, entityType, name string, attrsJSON []byte) error { _, err := db.EnsureEntityChecks(ctx, tx, entityID, slug, entityType, name, attrsJSON) return err }