diff --git a/docs/superpowers/specs/2026-05-07-n8n-backup-monitor-design.md b/docs/superpowers/specs/2026-05-07-n8n-backup-monitor-design.md index 46348d3..fd6a034 100644 --- a/docs/superpowers/specs/2026-05-07-n8n-backup-monitor-design.md +++ b/docs/superpowers/specs/2026-05-07-n8n-backup-monitor-design.md @@ -34,6 +34,17 @@ n8n Workflow 2 (Reporter) ## Ruby Notifier Script (`notify_backup.rb`) +### Design principles + +- **Sandi Metz OOP:** Small, single-purpose objects. Each class has one reason to change. Dependencies injected, not hardcoded. No class does more than one job. +- **Self-documenting:** The script's header comment explains its purpose, all accepted arguments, exit behavior, and required ENV vars — enough for any future backup process to integrate without reading the implementation. +- **Classes:** + - `BackupNotifier` — orchestrates the flow; the only public entry point + - `PayloadBuilder` — converts raw CLI args into a clean hash (formats bytes, validates status) + - `WebhookClient` — handles the HTTP POST with auth header; knows nothing about backup data + - `ByteFormatter` — single responsibility: raw integer → human-readable string + - CLI argument parsing at the top level (OptionParser), outside of classes + **Location:** `~/.local/bin/notify_backup.rb` (on each machine that runs backups) **Called from backup scripts with named arguments:**