Skip to content

Admin Health Report

public.get_admin_operations_checklist() is the admin-facing operations checklist for barbelic. It wraps the DB-side health report with Edge Function deployment probes and Supabase migration history checks.

public.get_admin_health_report() still exists as the lower-level DB/import/stats health report. Admin UI should call get_admin_operations_checklist().

RPC

sql
select public.get_admin_operations_checklist();

Lower-level DB/import/stats report:

sql
select public.get_admin_health_report();

Optional thresholds:

sql
select public.get_admin_operations_checklist(
  p_stale_after := '15 minutes'::interval,
  p_stats_stale_after := '1 day'::interval,
  p_rpc_response_warning_bytes := 3000000
);

RPC response size outliers are measured from samples supplied by the caller. Admin UI passes recent frontend operation logs as p_rpc_response_samples. It also appends Edge Function deployment samples by probing each configured function's health GET endpoint:

sql
select public.get_admin_operations_checklist(
  p_rpc_response_samples := '[
    {
      "operationName": "get_calendar_month_summary",
      "durationMs": 220,
      "responseBytes": 4200000,
      "at": "2026-06-22T00:00:00.000Z"
    },
    {
      "sampleKind": "edge_function_deployment",
      "name": "wodup-start-import",
      "expectedVersion": "20260821-barbelic-headers-v1",
      "deployedVersion": "20260821-barbelic-headers-v1",
      "ok": true,
      "status": 200
    }
  ]'::jsonb
);

Permissions

The function is security definer, but execution is still restricted:

  • service_role can execute it for backend/admin automation.
  • Authenticated users must pass public.is_lift_guild_admin().
  • anon and public have no execute grant.

Checks

The report returns:

  • status: ok, warning, or critical
  • ok: true only when no critical check is present
  • summary: count-only fields for dashboards and alerts
  • checks: detailed status and samples for each health area

Health areas:

  1. orphan_session_exercises
    • Critical when a session_exercise_part.exercise_id (옛 session_exercises, 이슈 #1215) has no matching exercises.id.
  2. wodup_import_batches
    • Critical when a batch failed, has result_error_count > 0, or is stuck in a non-terminal state longer than p_stale_after.
    • Warning when a batch is currently open but not stale.
  3. stats_refresh_jobs
    • Critical when a dirty stats refresh job failed or is stale.
    • Warning when a job is pending/processing but still fresh.
  4. stats_staleness
    • Critical when completed session data is older than p_stats_stale_after and is missing materialized rollups/stats, or the materialized rows are older than the source rows.
  5. rpc_response_outliers
    • Critical when supplied frontend operation samples exceed p_rpc_response_warning_bytes.
  6. edge_functions
    • Critical when a deployed function reports a different deployment version or cannot be reached.
    • Warning when the browser did not supply a probe sample for an expected function.
  7. schema_migrations
    • Critical when Supabase migration history is unavailable or an expected migration version is missing.

Edge Function Deployment Version

Each deployed function exposes:

  • GET /functions/v1/{function_name}
  • x-lift-guild-function-name
  • x-barbelic-deployment-version
  • JSON body with function_name and deployment_version

The expected versions live in src/react/services/deploymentManifest.js. When a function is changed, bump the manifest version and redeploy every listed function. The deployment pipeline check keeps the manifest, supabase/config.toml, and function folders aligned.

Notes

This report deliberately does not expose raw Wodup payloads. Sample rows include IDs, dates, statuses, counts, and short operational fields only.