Finding
scripts/fetch-hive-history.js is a 448-line script with 15 functions that runs every 2 hours via CI (update-hive-cache.yml). It has no test coverage despite containing complex parsing logic:
extractRenderData(html) — parses JS-embedded JSON from HTML with brace-depth tracking
extractMetrics(data) — extracts and normalizes hive snapshot metrics with fallback chains
safeNum(v) — type guard for finite numbers
All other scripts in this repo have corresponding .test.js files.
Recommendation
- Export pure functions (
extractRenderData, extractMetrics, safeNum) for testability
- Guard
main() with require.main === module check
- Add unit tests covering parsing edge cases, fallback logic, and error handling
Priority
- Impact: medium (data pipeline correctness, runs every 2 hours)
- Effort: low (pure functions, straightforward to test)
Filed by quality agent (hold-gated mode)
Finding
scripts/fetch-hive-history.jsis a 448-line script with 15 functions that runs every 2 hours via CI (update-hive-cache.yml). It has no test coverage despite containing complex parsing logic:extractRenderData(html)— parses JS-embedded JSON from HTML with brace-depth trackingextractMetrics(data)— extracts and normalizes hive snapshot metrics with fallback chainssafeNum(v)— type guard for finite numbersAll other scripts in this repo have corresponding
.test.jsfiles.Recommendation
extractRenderData,extractMetrics,safeNum) for testabilitymain()withrequire.main === modulecheckPriority
Filed by quality agent (hold-gated mode)