High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix(dashboard): count a quarantined temporary profile in /health's temporaryProfiles, matching GET /profiles' Temporary-first precedence, so profiles + quarantinedProfiles equals the default list length universally (PIN-308)
Luigi Agosticc42ba9b1fbe
diff --git a/internal/dashboard/config_health.go b/internal/dashboard/config_health.goindex 1ab5543c..7f40a4af 100644--- a/internal/dashboard/config_health.go+++ b/internal/dashboard/config_health.go@@ -58,11 +58,16 @@ func (c *ConfigAPI) healthInfo(includeSecurity bool) (healthEnvelope, error) {profiles, err := c.profiles.List()if err == nil {for _, p := range profiles {+ // Temporary is checked before Quarantined to match GET /profiles'+ // own precedence, which hides Temporary first: a quarantined+ // temporary (an instance-*.quarantine-* dir) is a temporary the+ // listing hides, so counting it as quarantined would break the+ // reconciliation profiles + quarantinedProfiles == default list length.switch {- case p.Quarantined:- quarantinedCount++case p.Temporary:temporaryCount+++ case p.Quarantined:+ quarantinedCount++default:profileCount++}diff --git a/internal/dashboard/config_health_test.go b/internal/dashboard/config_health_test.goindex 76e741a2..17745af7 100644--- a/internal/dashboard/config_health_test.go+++ b/internal/dashboard/config_health_test.go@@ -48,6 +48,11 @@ func TestHealthCountsEachProfileInExactlyOneBucketThatReconcilesWithTheListing(tprofileDir(t, baseDir, "instance-9869")profileDir(t, baseDir, "instance-9870")profileDir(t, baseDir, "default.quarantine-1700000001")+ // A quarantined TEMPORARY: the real quarantine flow renames instance-9871 to+ // instance-9871.quarantine-<ts>, so List() reports it Temporary AND Quarantined.+ // GET /profiles hides it as temporary, so /health must count it as temporary too+ // or profiles + quarantinedProfiles no longer equals the default list length.+ profileDir(t, baseDir, "instance-9871.quarantine-1700000002")pm := profiles.NewProfileManager(baseDir)api := newConfigAPIForTest(config.Load(), nil, pm, nil, nil, "test", time.Now())@@ -61,8 +66,8 @@ func TestHealthCountsEachProfileInExactlyOneBucketThatReconcilesWithTheListing(tt.Fatalf("decode: %v", err)}- if health.Profiles != 2 || health.TemporaryProfiles != 3 || health.QuarantinedProfiles != 1 {- t.Errorf("profiles/temporary/quarantined = %d/%d/%d, want 2/3/1", health.Profiles, health.TemporaryProfiles, health.QuarantinedProfiles)+ if health.Profiles != 2 || health.TemporaryProfiles != 4 || health.QuarantinedProfiles != 1 {+ t.Errorf("profiles/temporary/quarantined = %d/%d/%d, want 2/4/1 — the quarantined temporary belongs in temporaryProfiles, the bucket GET /profiles treats it as", health.Profiles, health.TemporaryProfiles, health.QuarantinedProfiles)}all, err := pm.List()if err != nil {