diff --git a/agent/internal/httpapi/config_status_test.go b/agent/internal/httpapi/config_status_test.go index e8ee825..d7d4af6 100644 --- a/agent/internal/httpapi/config_status_test.go +++ b/agent/internal/httpapi/config_status_test.go @@ -94,8 +94,11 @@ func TestHandleConfigStatusReportsMetadataHashAndMediaStatus(t *testing.T) { if !ok || media["running"] != true || media["pid"] != float64(1234) { t.Fatalf("media_server = %#v", got["media_server"]) } - lastGood, ok := got["last_good"].(map[string]any) - if !ok || lastGood["exists"] != true { - t.Fatalf("last_good = %#v", got["last_good"]) + previousConfig, ok := got["previous_config"].(map[string]any) + if !ok || previousConfig["exists"] != true { + t.Fatalf("previous_config = %#v", got["previous_config"]) + } + if got["previous_config_path"] != filepath.ToSlash(cfgPath+".last_good.json") { + t.Fatalf("previous_config_path = %#v", got["previous_config_path"]) } } diff --git a/agent/internal/httpapi/extras.go b/agent/internal/httpapi/extras.go index b04853a..c54d0d5 100644 --- a/agent/internal/httpapi/extras.go +++ b/agent/internal/httpapi/extras.go @@ -201,13 +201,13 @@ func (s *Server) configStatusPayload() map[string]any { candidate := readConfigFileStatus(candidatePath) resp := map[string]any{ - "ok": true, - "config_path": filepath.ToSlash(s.agentCfg.ConfigPath), - "exists": current.Exists, - "last_good_path": filepath.ToSlash(lastGoodPath), - "last_good": lastGood, - "candidate_path": filepath.ToSlash(candidatePath), - "candidate": candidate, + "ok": true, + "config_path": filepath.ToSlash(s.agentCfg.ConfigPath), + "exists": current.Exists, + "previous_config_path": filepath.ToSlash(lastGoodPath), + "previous_config": lastGood, + "candidate_path": filepath.ToSlash(candidatePath), + "candidate": candidate, } if current.Exists { resp["size"] = current.Size diff --git a/agent/internal/httpapi/server.go b/agent/internal/httpapi/server.go index 8f760f3..89ab6fc 100644 --- a/agent/internal/httpapi/server.go +++ b/agent/internal/httpapi/server.go @@ -67,9 +67,9 @@ type InfoResponse struct { BuildID string `json:"build_id"` BuildType string `json:"build_type"` GitSHA string `json:"git_sha"` - ConfigPath string `json:"config_path"` - LastGoodPath string `json:"last_good_path"` - UptimeSec int64 `json:"uptime_sec"` + ConfigPath string `json:"config_path"` + PreviousConfigPath string `json:"previous_config_path"` + UptimeSec int64 `json:"uptime_sec"` } func New(agentCfg config.AgentConfig, baseDir string, ms *mediaserver.Client, store *modelstore.Store, deviceID string, agentPort int, mediaPort int, version, buildID, buildType, gitSHA string) *Server { @@ -165,7 +165,7 @@ func (s *Server) handleInfo(w http.ResponseWriter, r *http.Request) { BuildType: s.buildType, GitSHA: s.gitSHA, ConfigPath: s.agentCfg.ConfigPath, - LastGoodPath: s.agentCfg.ConfigPath + ".last_good.json", + PreviousConfigPath: s.agentCfg.ConfigPath + ".last_good.json", UptimeSec: sysinfo.UptimeSec(), } writeJSON(w, http.StatusOK, resp)