fix(health): normalize prober global status_counts#2044
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2044 +/- ##
=======================================
Coverage 93.23% 93.23%
=======================================
Files 48 48
Lines 7626 7626
Branches 2804 2802 -2
=======================================
Hits 7110 7110
Misses 90 90
Partials 426 426
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review — safe to merge
✅ Approved — safe to merge Review summary
Nits — 3 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. Two-line fix routing both global `counts` accumulator loops in `runHealthProber` and `persistToKv` through `normalizeProbeStatus` before keying into the counts object, so unrecognized statuses like `"throttled"` fold into `unknown` instead of silently creating out-of-schema keys. The switch from `(counts[row.status] || 0) + 1` to `counts[normalizeProbeStatus(row.status)] += 1` is safe: the counts object is pre-initialized with all four canonical keys to `0`, and `normalizeProbeStatus` — already in use for the same purpose in `health-serving.mjs::summarizeRows` — always returns one of those keys. The regression test is thorough, covering all three downstream representations (`result.counts`, `summary.status_counts`, `meta.status_counts`) and explicitly asserting the spurious key is absent. Nits (2)
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
runHealthProber/persistToKvwere the missed siblings of fix(health): normalize unrecognized probe statuses before rollup #1739:summarizeGroupalready routes throughnormalizeProbeStatus, but the cron returncountsand served KVsummary.status_counts/meta.status_countsstill bucketed rawrow.status.What Changed
src/health-prober.mjs: both globalcountsloops now incrementnormalizeProbeStatus(row.status).tests/health-prober.test.mjs: regression test withstatus: \"throttled\"asserting it folds intounknown.Fixes #1942
Registry Safety
Validation
npx vitest run tests/health-prober.test.mjs -t \"folds unrecognized probe status\"git diff --check