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:
2026-02-21 18:32:26 +01:00
parent 6f02536243
commit be7803c0ac
30 changed files with 1281 additions and 67 deletions
+8 -2
View File
@@ -197,7 +197,7 @@ func (s *Server) storageAPIHandler(w http.ResponseWriter, r *http.Request) {
// storageScanAPIHandler handles POST /api/storage/scan.
func (s *Server) storageScanAPIHandler(w http.ResponseWriter, r *http.Request) {
result, err := storage.ScanDisks()
result, err := storage.ScanDisks(s.logger, s.cfg.Logging.Level == "debug")
if err != nil {
s.logger.Printf("[ERROR] storageScan: %v", err)
jsonError(w, "Meghajtók keresése sikertelen: "+err.Error(), http.StatusInternalServerError)
@@ -249,12 +249,14 @@ func (s *Server) storageInitAPIHandler(w http.ResponseWriter, r *http.Request) {
Label: req.Label,
CreatePartition: req.CreatePartition,
SetDefault: req.SetDefault,
Logger: s.logger,
Debug: s.cfg.Logging.Level == "debug",
}
// Smart partition: if disk has exactly 1 partition with no filesystem,
// skip destructive repartitioning and format the existing partition directly.
if fmtReq.CreatePartition {
if scanResult, scanErr := storage.ScanDisks(); scanErr == nil {
if scanResult, scanErr := storage.ScanDisks(s.logger, s.cfg.Logging.Level == "debug"); scanErr == nil {
for _, disk := range scanResult.AvailableDisks {
if disk.Path == req.DevicePath && len(disk.Partitions) == 1 && disk.Partitions[0].FSType == "" {
s.logger.Printf("[INFO] Disk %s has 1 empty partition (%s) — skipping repartition",
@@ -493,6 +495,8 @@ func (s *Server) storageMigrateAPIHandler(w http.ResponseWriter, r *http.Request
CurrentHDDPath: currentHDDPath,
TargetPath: req.TargetPath,
HDDMounts: mounts,
Logger: s.logger,
Debug: s.cfg.Logging.Level == "debug",
}
stopFn := func(name string) error {
@@ -1037,6 +1041,8 @@ func (s *Server) storageAttachAPIHandler(w http.ResponseWriter, r *http.Request)
SubPath: req.SubPath,
Label: req.Label,
SetDefault: req.SetDefault,
Logger: s.logger,
Debug: s.cfg.Logging.Level == "debug",
}
go func() {