R-492: delete the always-empty cfg.Paths.HDDPath (field, env binding, every fallback)

Readers (report builder, health check, /api/system, web primaryHDDPath, metrics collector,
AutoDiscoverStoragePaths' fallback parameter) now use the storage registry only. An old
controller.yaml still carrying paths.hdd_path keeps loading (non-strict YAML), pinned by
TestR492_OldConfigWithHDDPathStillLoads.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
2026-10-05 21:45:53 +02:00
parent d15ad105be
commit 7b8216abac
11 changed files with 45 additions and 47 deletions
-2
View File
@@ -164,7 +164,6 @@ type PathsConfig struct {
StacksDir string `yaml:"stacks_dir"`
DataDir string `yaml:"data_dir"`
SystemDataPath string `yaml:"system_data_path"`
HDDPath string `yaml:"hdd_path"`
}
type WebConfig struct {
@@ -450,7 +449,6 @@ func applyEnvOverrides(cfg *Config) {
envStr("FELHOM_WEB_LISTEN", &cfg.Web.Listen)
envStr("FELHOM_WEB_PASSWORD_HASH", &cfg.Web.PasswordHash)
envStr("FELHOM_PATHS_STACKS_DIR", &cfg.Paths.StacksDir)
envStr("FELHOM_PATHS_HDD_PATH", &cfg.Paths.HDDPath)
envStr("FELHOM_LOGGING_LEVEL", &cfg.Logging.Level)
envStr("FELHOM_MONITORING_SYSTEM_HEALTH_INTERVAL", &cfg.Monitoring.SystemHealthInterval)
}
@@ -0,0 +1,27 @@
package config
import (
"path/filepath"
"testing"
)
// R-492 — the global paths.hdd_path was deleted (it was empty on every box and every reader already
// fell back to the storage registry). The consequence that matters is the OLD box: a controller.yaml
// written before the deletion that still carries `hdd_path` (empty or not) must keep loading, with
// every other field intact — a config that fails to parse is a controller that does not start.
// RED-PROOF (REPORT): switch loadAndParse to a strict decoder (yaml KnownFields) and this fails.
func TestR492_OldConfigWithHDDPathStillLoads(t *testing.T) {
for _, v := range []string{`""`, `/mnt/legacy_hdd`} {
y := minimalYAML(bcryptHash) + "paths:\n stacks_dir: /opt/stacks\n hdd_path: " + v + "\n"
cfg, err := LoadFromBytes([]byte(y))
if err != nil {
t.Fatalf("hdd_path=%s: an old config no longer loads: %v", v, err)
}
if cfg.Paths.StacksDir != filepath.FromSlash("/opt/stacks") && cfg.Paths.StacksDir != "/opt/stacks" {
t.Errorf("hdd_path=%s: neighbouring field lost: stacks_dir=%q", v, cfg.Paths.StacksDir)
}
if cfg.Customer.ID != "demo" {
t.Errorf("hdd_path=%s: customer.id lost: %q", v, cfg.Customer.ID)
}
}
}