v0.24.0 — Pre-testing observability: debug logging, diagnostic dump, startup self-test
- Add [DEBUG] logging across all modules (backup, storage, sync, selfupdate, monitor, notify, report, assets, setup) gated behind logging.level: "debug" - Add /api/debug/dump endpoint returning full controller state JSON (debug only) - Add startup self-test validating 9 subsystems (Docker, dirs, storage, hub, restic repos, metrics DB) with pass/warn/fail summary - New packages: internal/selftest, internal/util - Constructor/signature changes: debug bool params, logger params on RunHealthCheck and BuildReport, smart watchdog probe logging Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,51 @@
|
||||
## Changelog
|
||||
|
||||
### v0.24.0 — Pre-Testing Observability (2026-02-21)
|
||||
|
||||
**Three features for pre-testing diagnostics: verbose debug logging, diagnostic dump endpoint, and startup self-test.**
|
||||
|
||||
#### Feature 1: Debug logging across all modules
|
||||
|
||||
All `[DEBUG]` log lines are gated behind `logging.level: "debug"` — zero overhead at `info` level.
|
||||
|
||||
- **New** `internal/util/strings.go`: shared `TruncateStr()` for safely truncating command output in logs.
|
||||
- **Backup** (`backup.go`, `dbdump.go`, `crossdrive.go`, `restore.go`, `local_infra.go`): added `isDebug()` method and per-operation debug logging. DB dump logs container discovery, per-dump command details (passwords masked as `***`), validation results. Cross-drive logs source/dest paths, rsync results, auto-enable decisions. Restore logs step-by-step progress.
|
||||
- **Storage** (`scan_linux.go`, `format_linux.go`, `attach_linux.go`, `migrate.go`): added `Logger`/`Debug` fields to request structs. Logs raw lsblk output (truncated), per-disk classification, pipeline steps for format/attach, rsync progress for migrate. Updated `*_other.go` stubs.
|
||||
- **Sync** (`sync.go`): logs masked clone URLs, per-file hash comparison, post-sync hook triggers.
|
||||
- **Self-update** (`updater.go`): logs registry API calls, tag parsing, version comparison, compose file edits.
|
||||
- **Monitor** (`watchdog.go`): smart logging — periodic 60-probe summaries (~5 min), immediate log on unexpected failures, reconnect attempt details. (`healthcheck.go`): logs raw check values and per-check results.
|
||||
- **Notify** (`notifier.go`): logs event push URL/type/response, preference sync details.
|
||||
- **Report** (`pusher.go`, `builder.go`): logs payload sizes, section summaries, push responses.
|
||||
- **Assets** (`syncer.go`): logs manifest fetch, per-file hash comparison, download/removal actions.
|
||||
- **Setup** (`scanner.go`, `handlers.go`): logs drive scan details, hub recovery/config write operations.
|
||||
|
||||
#### Feature 2: Diagnostic dump endpoint (`GET /api/debug/dump`)
|
||||
|
||||
Returns a comprehensive JSON snapshot of all controller state. Only available when `logging.level: "debug"` — returns 404 otherwise.
|
||||
|
||||
- Sections: `controller` (version, uptime, config hash, PID), `storage` (per-path usage), `stacks` (deployed/running/stopped counts + list), `backup` (status, repo stats), `hub` (push status, consecutive failures), `scheduler` (all jobs with last_run/running/errors), `health` (fresh check), `notifications`, `self_update`, `alerts`.
|
||||
- API router expanded with `SetDebugDumpDeps()` setter for scheduler, hub pusher, alert manager, version, and start time.
|
||||
|
||||
#### Feature 3: Startup self-test
|
||||
|
||||
- **New** `internal/selftest/selftest.go`: runs 9 diagnostic checks on boot with 5s timeout each.
|
||||
- Checks: Docker socket, stacks directory, data directory (write test), system data path (mount point), storage paths (connected vs disconnected), git catalog (.felhom.yml files), Hub connectivity (/healthz), restic repos, metrics DB.
|
||||
- Results logged in a clear block: `[PASS]`/`[WARN]`/`[FAIL]` per check, summary at end.
|
||||
- Self-test summary (pass/warn/fail counts) sent to Hub via `NotifyControllerStarted` details map.
|
||||
- Never blocks startup — purely diagnostic.
|
||||
|
||||
#### Constructor/signature changes
|
||||
|
||||
- `notify.New()`: added `debug bool` param. `NotifyControllerStarted()`: added `details map[string]interface{}` param.
|
||||
- `report.NewPusher()`: added `debug bool` param. `BuildReport()`: added `logger *log.Logger` param.
|
||||
- `monitor.RunHealthCheck()`: added `logger *log.Logger` param (5 call sites in main.go).
|
||||
- `selfupdate.NewUpdater()`: added `debug bool` param.
|
||||
- `assets.New()`: added `debug bool` param.
|
||||
- `backup.NewCrossDriveRunner()`: added `debug bool` param. `WriteLocalInfraBackup()`: added `debug bool` param.
|
||||
- `backup.DiscoverDatabases()`, `DumpOne()`: added `debug bool` param.
|
||||
- `storage.ScanDisks()`: added `logger, debug` params. `FormatRequest`, `AttachRequest`, `MigrateRequest`: added `Logger`/`Debug` fields.
|
||||
- `setup.ScanDrivesForInfraBackups()`: added `debug bool` param.
|
||||
|
||||
### v0.23.0 — CSRF Protection (2026-02-21)
|
||||
|
||||
**CSRF (Cross-Site Request Forgery) protection on all browser-facing POST endpoints — controller and hub.**
|
||||
|
||||
Reference in New Issue
Block a user