Skip to content

v0.36.0

Latest

Choose a tag to compare

@github-actions github-actions released this 20 Nov 21:57
· 3 commits to main since this release
6a29034

🚀 aiHelpDesk v0.36.0: Drilled Recovery

A backup nobody has restored is a hope. A restore nobody has practiced is a first attempt on the worst day. And a first attempt is billed in downtime, against a budget you never measured

The first two bits in that tag line are common sense you hear everywhere, but that third bit is ours.

v0.35 told you what a restore would cost before anyone approved it. How? It priced a restore in minutes of downtime against a budget. This was a major step forward and it was the first application of aiHelpDesk objective framework.

But it wasn't complete: a production database server is rarely restored and so unlikely to have a restore history and as a result, the recovery-time figure is assumed to be the declared rto (remember we said: "how do you get that history of restores? that's v0.36 😉").

v0.36 now puts a number on how much to trust that price. Welcome to the drills! A drill is a way to find out the price before the bad day, when it is cheap and not stressful to find out (without a VP looking over your shoulder with the stopwatch and a pep talk).

There are three headlines in this release:

1. Restore drills: practice on a copy, on the record

  • Restore your backup onto a clone you bring (a scratch VM, a snapshot, a pgBackRest restore) and tell aiHelpDesk about it: helpdesk-client --drill-record. It checks the clone R/O on both servers and records the drill whatever the verdict.
  • The link between the two is not a name. It is the Postgres system_identifier, read from both servers. A logical dump or a fresh cluster is refused: it is not a restore of this backup.
  • A clone that could push WAL into your production archive is refused too (the archive guard). We reproduced the hazard for real: a promoted clone that kept the source's archiving pushed its own timeline into the repository within seconds.
  • Only a verified drill counts. A refused or unverifiable attempt stays on the record and never counts. A drill is not an incident and never charges the availability budget.
  • This is what a drill looks like for a database server hosted on a Linux VM:
Restore drill of pgbackrest-ubuntu-vm on orders-clone: VERIFIED
  PASS reachable
  PASS same_system: system identifier 7694453216872244409
  PASS not_the_source
  PASS archive_guard: archive_mode is off
  PASS consistent: out of recovery
  PASS size_class: clone 22.0 MiB, source 22.0 MiB
  PASS verify_sql

Recorded as drl_aad337d6 (verified)
  took     3s (reported)
  counts   yes: a verified drill

(yes, tiny database testbed of 22MiB only, restored in 3s)

2. Drills feed the plan and a reminder keeps you practicing

  • Below three real restores, a server's verified pgBackRest drills (comparable size, last 90 days) plan the restore: "demonstrated on a copy, not on this server". From three real restores, the real ones take over and the drills stay on their own line, never mixed in. A drill that took longer than the rto raises RTO CHECK (!) before any real restore has shown it.
  • A database with an objective and no verified drill within drill_interval (90 days unless you set it) shows DRILL OVERDUE (!) in the plan, in get_pgbackrest_status and in vault budget. It only reminds: nothing is blocked.
  • docs/RESTORE_OPS.md is the operating guide: how to bring a clone, what to time, how to read a refusal and how drills tie to the Flywheel (the outer loop of objectives turns on a quiet day, not only after an outage).

3. The decision answers for itself: plan vs actual, a justification and what waiting costs

  • After a restore, the incident narrative sets the plan against what happened:
═══ PLAN VS ACTUAL ═══  the plan of 18:38:51 against what happened
recovery time  planned 3s (the longest restore drill, demonstrated on a copy (too few
               for a p90)); took 37s (34s over)
data loss      planned 12s → within; at the stop 1m 18s → within (1m 06s more)
budget         planned -3m 15s left → exceeds; the incident was charged 1m 40s, so
               overspent by 4m 55s → exceeds
  • Acknowledging a breach now can carry a justification and a ticket (--justification, --ticket), inside the hash-covered recovery_decision event and the gateway can be configured to insist on a justification (HELPDESK_REQUIRE_BREACH_JUSTIFICATION, Helm gateway.requireBreachJustification).
  • The plan says what waiting costs: while a gate sits open, a serving instance keeps taking writes (the loss grows) and an open incident is charged in full when the restore runs. Waiting, budget and Waiting, data say when each would break its objective.

Still deliberately narrow: nothing here decides who may say yes (that is next) and aiHelpDesk never creates your clone: it verifies the one you bring.


Here are the details:

✅ Production readiness

  • Test coverage is now at 74% (and that number doesn't count the upper parts of our test pyramid)
  • make test, integration, faulttest* and e2e print the reason for every skipped test in their summary, so an accidental skip is not read as an intentional one.
  • make integration and make integration-nocache now set HELPDESK_REQUIRE_INFRA=1: they bring the infrastructure up, so a test that cannot find Docker, the pgBackRest image or the test Postgres fails instead of skipping and the Postgres-backend tests (the audit store on port 15434) now always run there. A bare go test -tags integration still skips them, as before.
  • scripts/demo-restore-cycle.sh gained HOLD_GATE=1 (keep the gate open and re-read the plan to watch what waiting costs), JUSTIFICATION and TICKET. Its output wraps.
  • The dev auditd is its own Compose project (make dev-auditd-up, port 15440), so no test target's down -v can delete a stack's history.

✅ Restore drills

  • Record:
    New --drill* options in aiHelpDesk CLI tool:
helpdesk-client --drill-record --drill-source <db> --drill-clone <clone> --drill-method pgbackrest | snapshot | cloud | other
  • --drill-started / --drill-finished or --drill-duration
  • --drill-backup-label
  • --drill-recovery-target
  • --drill-verify-sql (one SELECT that must return true on the clone)
  • --ticket
  • --drill-note
  • --drill-supersedes <earlier drill>

The new --drill-list option lists the drills. The command exits non-zero for a refused or unverifiable drill, so a script notices.

  • Checks (run by a new Database Agent tool, verify_restore_drill, R/O on both sides): reachable, same_system, not_the_source, archive_guard, consistent (a clone still in recovery is refused: a paused restore and a standby cannot be told apart, so it fails closed), size_class (within 20% of the source, else a warning) and your verify_sql.
  • Where it is kept: a restore_drills table and a thin, hash-covered restore_drill audit event. Records are immutable: a re-verification is a new record that names the one it replaces (supersedes). Each row snapshots the keys, system identifiers, endpoints (no credentials), host type and a digest of the infrastructure config, so changing infrastructure.json later cannot rewrite what a drill was.
  • A drill is one restore. Recording the same restore twice (same source, clone, start and finish) is refused with HTTP 409 and names the drill it duplicates: it would otherwise count twice in the estimate. Replace one on purpose with -- drill-supersedes.
  • API: POST /api/v1/drills (verifies, then stores; a refused or unverifiable clone answers 201 with its status), GET /api/v1/drills, GET /api/v1/drills/{id}. A failed attempt (a clone that is not registered, a request that is wrong) leaves a gateway request event, record_restore_drill.
  • Looking back: vault drills [--target <db>] [--status S] [--all] [--days N] [drl_…] lists them, or prints one drill in full with every check and what replaced it.
  • Free text is terminal-safe: the gateway refuses control characters and bidi-overrides in a note, and every printer replaces them.

doc link

✅ Drills in the estimate, the reminder and the posture check

  • Counted for the estimate: verified, the same system, method pgBackRest, a recorded duration, within 20% of the size of the restore being planned and no older than 90 days. Drills plan below three real restores (the longest of three to nine, a p90 from ten) and never pool with real restores.
  • The server's system_identifier is read when it can be: psql on a serving instance, pg_controldata on the data directory when it is down. When neither works, drills are matched by name and the plan says so.
  • drill_interval is a duration in the objectives ("90d" by default for a database that has an rpo, an rto or an availability_slo; "0d" turns it off; an unreadable value falls back to the default and is reported). Any verified drill resets it, whatever its method or size. A refused attempt since the last good drill is named with what failed.
  • get_pgbackrest_status returns drill_currency and drill_overdue. They are not part of the objective_exposure verdict, and the RTO check there now falls back to drills.
  • Drills never charge the ledger and are not considered to be incidents.

✅ Plan vs actual

  • A new section in vault incidents sets the plan against the outcome for recovery time, data loss (with the rpo verdict at each end) and the budget and says what each was based on (the declared rto, past restores or drills).
  • The recovery duration is the remediation hop after the approval (restore, restart, verify). It is not the downtime (see Known limitations).
  • vault incidents now also accepts an incident ID (inc_...), not only a playbook run ID. Long rows wrap under their own text.

doc link

✅ A justification and a ticket at the gate

  • helpdesk-client --pitr-approve … --justification "<why>" --ticket INC-1234.
    Both are recorded in the hash-covered recovery_decision event and shown in the narrative and on the incident line of vault budget.
  • HELPDESK_REQUIRE_BREACH_JUSTIFICATION=true (Helm gateway.requireBreachJustification) refuses an approval that acknowledges an objective breach without a justification of at least ten characters. Nothing changes unless you set it. For security reasons the text is redacted like a connection string.
  • Query by ticket: vault incidents --ticket INC-1234 (auditd gained a ticket column, filled in for earlier decisions at start).
  • The justification is the approver's claim, not a verified fact. Verifying who said it is audit-evidence work still to come.

✅ The cost of waiting

  • The plan now prints Waiting, budget and Waiting, data: the latest start that stays within the budget under stated assumptions, "no remaining margin" or "projected budget breach" (kept apart from a breach that has happened). For a serving instance, this show how the loss grows with every minute and when it would cross the rpo.
  • A behaviour change worth knowing: the budget verdict at the gate and at execution now counts the age of the open incident the restore is for. A gate held for a while can flip from within to exceeds. We found that live (a gate held ten minutes still said within while the incident ended at 103% of the budget) and fixed it at both places. An approval, by closing the triage, used to hide that incident from the ledger.
  • Approving the gate ends the triage and marks the incident closed before the restore step runs, so at execution the ledger no longer saw it as open. To remedy that the Gateway now carries the incident's start time in the approval (incident_started_at), the restore's own budget check reads it and a restore refused for the data loss names the budget among the objectives in the way when the budget was too.

✅ Proven on Linux VMs

Run on an Ubuntu 24.04 VM over SSH (PostgreSQL 16, pgBackRest, services on a laptop):

What Result
Five verified drills of a second cluster on the same VM, restored with --archive-mode=off all checks pass; the source's system_identifier matched, read while serving and while stopped (pg_controldata over SSH)
The plan after three drills planned the restore from the drills; RTO CHECK (!) raised by them
The duplicate guard, --drill-supersedes, DRILL OVERDUE, a clone that is the source HTTP 409; accepted and the old row left the current list; raised; HTTP 400 and a failed-attempt event
availability_enforcement: refuse on the serving instance refused at execution, instance not stopped (the unit stayed active), decision recorded why
Three real restores through the gateway each charged 1m 36s to 1m 41s; recovery duration median 35 s, longest 37 s; the plan then switched from drills to the real restores
Plan vs actual on the first of those planned 3 s from the drills, took 37 s

The refuse mode was a v0.35 known limitation ("not run live"); it has now run.

🐛 Bug fixes

  • The v0.35 budget verdict could say within for a gate that had been held long enough that approving it breached the budget, and again at execution after the approval had closed the triage: the open incident's age was not counted (see the cost of waiting above). Both found live and fixed.
  • The integration tests skipped when HELPDESK_IDENTITY_PROVIDER or HELPDESK_USERS_FILE was set in your shell.
  • scripts/demo-restore-cycle.sh printed stray wrapped fragments.
  • Several alignment problems in the vault incidents narrative.

⚠️ Upgrade notes

  • Restart auditd, the gateway, the database agent and the sysadmin agent together (and use the new helpdesk-client and faulttest). auditd creates the restore_drills table and the ticket column at start. Old event hashes are unchanged (pinned by a test).
  • DRILL OVERDUE (!) will appear for every database that has an objective and no verified drill, because the reminder is on by default (90 days). It only reminds. Set drill_interval: "0d" to turn it off for a database.
  • Policy: the drill's checks run through the database agent, which asks for read on both servers. With deny-by-default, a clone with no tag, or a tag no policy names, is refused (policy denied … No policy matched). Register the clone in infrastructure.json and give it a tag a read rule allows. The drill needs no write or destructive permission.
  • The database agent's host must reach the clone's Postgres port.
  • Helm: one new optional value, gateway.requireBreachJustification (default false). Compose and the host .env.example pass HELPDESK_REQUIRE_BREACH_JUSTIFICATION through.
  • make integration still ends with down -v on the disposable test auditd database (port 15434). The dev auditd on 15440 is separate and is not touched.

⚠️ Known limitations

  • A drill reads shorter than a real restore. On a 22 MiB database a drill took 3 s and the same server's real restores a median of 35 s (about twelve times as long): the real run adds the archive flush, the stop, the WAL save and the agent's own steps. Until a server has three real restores, a drill-planned figure and the RTO CHECK from drills are a lower bound, not a forecast. This is why drills and real restores are never pooled.
  • The method and the duration are the operator's word. A snapshot clone labelled pgbackrest would count. The record says reported.
  • Anyone authenticated may record a drill or approve the gate. Nothing yet says who may accept a breach of an SLO somebody else owns. Decision rights are the next release.
  • A refused restore is listed as an unconfirmed outage. When a restore is refused and the instance is never stopped (outcome no_action), the incident is still listed under "Unconfirmed" in vault budget and lowers the worst-case figure. It is never charged.
  • faulttest runs never count toward the ledger or the estimate (they are origin faulttest). Use scripts/demo-restore-cycle.sh, or a real incident, to build a history.
  • get_pgbackrest_status and vault budget still match drills to the server by name; the restore plan matches by system_identifier.
  • A drill record that gives only a duration (no start and finish) cannot be checked for being a duplicate.
  • The count of transactions actually discarded after a restore is not made (the figure is measured just before the stop). Recording a decline or deferral at the gate, and pricing the alternatives to a restore, are not in this release.
  • The audit trail is tamper-evident, not tamper-proof against someone who controls the audit database. With static identity on K8s the auditor and secbot still poll auditd without credentials and get 401 (not fixed).
  • A model still makes small mistakes around the restore (a wrong parameter name it then corrects). The decisions that matter are in tools that refuse regardless.

📚 Documentation

  • docs/RESTORE_OPS.md (new): the restore operations guide, modelled on PLAYBOOK_OPS.md: setting objectives, running a drill, what to time, reading the verdict, refusals, limits, checklist.
  • docs/OBJECTIVES.md: drills in §6.2, drill_interval, the flywheel connection.
  • docs/PITR.md: drills in the plan, the justification and ticket, what waiting costs (with the timeline and the formulas).
  • docs/API.md: the drills endpoints. docs/CLIENT.md: the drill flags. docs/PLATFORMS.md: the VM runs.
  • docs/tools/database.md and capabilities.md regenerated for verify_restore_drill.

List of Changes

[boris@ ~/helpdesk]$ git log release/v0.35.0..release/v0.36.0 --oneline
d7e659f (origin/release/v0.36.0, release/v0.36.0) fix: four minor linter issues.
e5f4433 doc: update the restore ops, pitr, platforms and objectives docs with the v0.36 test results.
9527b4c fix: small display garp in narrative's "Objectives in force" block.
8f0031e fix: presentation adjustments to the plan output for drill currency in helpdesk-client and vault drills.
1ae03fe feat: a duplicate guard to recording the restore drill runs.
d1fbf3c fix: vault drills crash.
87f83d5 doc: update the restore ops doc with the policy comment.
1dc5479 chore: the skipped tests run via make now show the reason for skipping.
692e5bf doc: add a new restore ops doc + update the links in objectives and pitr docs.
75da1ca chore: add restore drill integration test.
bb89217 chore: add test coverage for the `vault drill` command.
bf1e925 feat: new `vault drills` CLI command for restore drills.
565c681 chore: add test coverage for the overdue drill.
d05fd1c feat: add drill_overdue feature to restore drills.
6845d74 chore: lazy read coverage for the system id (for restore drills).
2607a8e feat: estimate now matches drills to the source by system id whenever it can read one.
ed549f5 chore: feed newest drill's size the posture signal + addional test coverage for restore drills.
eae12ba feat: add estimates to the restore drill.
e1804ca chore: add test coverage to the client side of the restore drills.
bbc8d02 feat: add the client side to the restore drills.
f0feb68 feat: keep a reord of the failed restore drill attempts, not just successes.
9486cee chore: add test coverage to the gateway part of the restore drills.
5eec305 feat: add gateway endpoint part to the restore drill feature.
5d1ab38 chore: add test covrerage for the base restore drill functionality.
933a335 feat: new restore fire drill functionality.
e2f56bb chore: minor change in gate wording n the vault recovery decision around acknowledged: data loss.
a8bc073 chore: add a dedicated compose project for the local dev stack on auditd.
92516f2 chore: add test coverage to the new `vault incidents` extension of inc_ IDs.
902ae3f feat: make `vault incidents` accept an actual incident as a parameter, not just a PB run ID.
51c2e03 feat: `vault budget` now prints the ticket on the incident line, in the Charged and Unconfirmed sections alike.
0f701cf feat: add a new capability of querying by ticket id.
e275369 fix: integration test now strips and ignores the HELPDESK_IDENTITY_PROVIDER and HELPDESK_USERS_FILE env vars to prevent skipped tests.
4fc9c3a feat: integration tests hardnenning.
efb1566 chore: add test coverage for faulttest harness passing justification through.
d66fc82 feat: faulttest harness now gives the gateway a justification when it acknowledges a breach.
b3620a9 fix: cosmetic text alignment fixes in the vault incidents output.
d1fa330 feat: make long rows in the "plan vs actual" section wrap under their own text and not back under the label.
fa33807 feat: edge case of a refused restore due to the data-loss check.
88fbce9 fix: adjust the demo restore script guidance + the commit rate floor setting.
991f510 feat: change the verdict to use "left minus the elapsed time of the open incident this restore is for".
c5b0ecf fix: bug in the demo restore script around grep that prints stray wrapped fragments.
fa138d1 feat: add HOLD_GATE=1 to demo restore script.
1f9cf10 feat: wrap/align long lines in a plan properly for ease of reading.
3abc4e3 fix: commit rate fix (suppress for short runs).
046fe7c feat: make the demo restore script smarter to handle justification + ticket.
5966cdb doc: add a timeline + formulas in pitr doc and a link in the objectives doc.
cf8d48d chore: add test coverage and adjust the pitr timeline cost of delay budget/ledger/margin.
90b05d2 feat: cost of delay.
5cc1d1b chore: add test coverage for justification and ticket at gate approval for restore.
8f074ac feat: add justification and ticket to the restore approval at the gate.
14f5bf5 feat: data-loss line in plan vs actual now shows the RPO verdict at each end.
1704e2a feat: plan vs actual for recovery time, data loss, tx and discared.
cbe1726 doc: add another anchor in the pitr doc for statuses.
1065ca3 doc: add an anchor in the pitr doc.
1c3ebab doc: minor cosmetic changes in sample 031.
e6551eb doc: add a link in sample 30 and a line in samples readme.
ae7fb0a doc: add more data to sample 031 doc.
25b6742 doc: brush up the sample 030 doc.
3162e68 doc: add a section in informed consent and update customer bill of rights.
e4a8012 doc: add an anchor to the tx count by pg_waldump.
d81e2e9 doc: updated the two clocks section, added the timeline to distinguish down vs serving instance.
83b9841 doc: add an anchor in objectives + upate sample 30 docs.
6fc36f6 doc: update the sample 030 and 031 docs.
88bf587 (tag: v0.35.0) Merge pull request #37 from borisdali/release/v0.35.0

Full Changelog: v0.35.0...v0.36.0