Skip to content

feat(canopy): send health_details (sizes, fixes, duration) with verification#88

Merged
passcod merged 1 commit into
mainfrom
feat/canopy-health-details
Jul 2, 2026
Merged

feat(canopy): send health_details (sizes, fixes, duration) with verification#88
passcod merged 1 commit into
mainfrom
feat/canopy-health-details

Conversation

@passcod

@passcod passcod commented Jul 2, 2026

Copy link
Copy Markdown
Member

🤖 Stacks on #87. Canopy accepts an arbitrary health_details map on
/restore-verification, and bestool-canopy 0.4.4 adds a generic request
escape hatch (bestool#626). The typed RestoreVerification struct has no
health_details field, so pgro serializes the typed report, splices in
health_details, and POSTs the merged body via CanopyClient::request
to the same endpoint.

health_details (snake_case)

  • sizes — per-database on-disk bytes (pg_database_size), keyed by
    db name.
  • fixes — an arbitrary jsonb map of the fix steps the restore
    applied: locale, reindex, reset_wal, recreated_pg_wal. Stored
    in _pgro.restore_info.fixes by the init script and forwarded
    verbatim, so adding a fix later is one shell line + its flag file
    no schema change, no operator change. (reindex/locale were the
    example; this carries whatever we apply.)
  • restore_duration_sec — wall-clock from the restore CR's
    createdAt to report time (≈ activation).

Gathering

sizes + fixes come from a single read-only connection to the
restore's postgres, done in the switchover block before #87's
ephemeral teardown destroys the DB. Best-effort: on the failure path (or
if postgres never came up) those pieces are omitted and the verification
still sends. restore_duration_sec is independent of postgres.

Records pg_resetwal / pg_wal-recreation via flag files so they
surface in fixes next to the existing locale/reindex flags.

Follow-up: typed schema (bestool#628)

This uses the arbitrary-JSON request path. Once bestool#628 lands and
releases (build-time bestool_canopy::schema:: types generated from
canopy's OpenAPI), a follow-up will swap the hand-built Value for the
generated RestoreVerification type + request_json, for compile-time
safety against canopy's spec. Deliberately not blocking this PR on it.

More stats?

Easy follow-ups if you want them (all cheap from the same connection):
per-db table count, largest-relation size, pg_stat_database xact/blks
counters, or the snapshot→restored size ratio.

…ication

Canopy now accepts an arbitrary `health_details` map on
/restore-verification, and bestool-canopy 0.4.4 adds a generic request
escape hatch. The typed RestoreVerification struct has no such field, so
pgro serializes the typed report, splices in `health_details`, and POSTs
the merged body via CanopyClient::request to the same endpoint.

health_details (snake_case) carries:
- sizes: per-database on-disk bytes (pg_database_size), keyed by db name.
- fixes: an arbitrary jsonb map of the fix steps the restore applied
  (locale, reindex, reset_wal, recreated_pg_wal). Stored in
  _pgro.restore_info.fixes by the init script and forwarded verbatim, so
  adding a fix is one shell line + its flag — no schema or operator
  change.
- restore_duration_sec: wall-clock from the restore CR's createdAt to
  report time.

sizes + fixes come from one read-only connection to the restore's
postgres (done in the switchover block, before any ephemeral teardown
destroys the DB). Gathering is best-effort: on the failure path, or if
postgres never came up, those pieces are omitted and the verification
still sends. Duration is independent of postgres.

Records pg_resetwal / pg_wal-recreation via flag files so they surface
in fixes alongside the existing locale/reindex flags.
@passcod passcod force-pushed the feat/canopy-health-details branch from 7f70f21 to 7cc83b8 Compare July 2, 2026 06:18
@passcod passcod force-pushed the feat/canopy-verify-teardown branch from 30ab42c to 518d535 Compare July 2, 2026 06:18
Base automatically changed from feat/canopy-verify-teardown to main July 2, 2026 06:39
@passcod passcod merged commit 9d28e0e into main Jul 2, 2026
18 of 31 checks passed
@passcod passcod deleted the feat/canopy-health-details branch July 2, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant