test: cover safeNum and loadHistory in fetch-hive-history.js - #1255
Merged
castrojo merged 1 commit intoSep 13, 2026
Merged
Conversation
The merged projectbluefin#947 suite already pins extractMetrics, the sole reader of the live hive payload. This closes the remaining gaps the issue named: - safeNum: finite numbers pass, everything else (NaN, +/-Infinity, strings, null/undefined, objects) coerces to undefined. - loadHistory: fresh start returns the seeded default, a valid file parses, and a corrupt file degrades to the default instead of throwing. loadHistory now takes an optional path (default OUTPUT_FILE) so it can be driven at a temp file without touching the tracked seed, and safeNum + loadHistory are added to module.exports. Closes projectbluefin#947. Signed-off-by: kylerankin <kylerankin@users.noreply.github.com>
castrojo
approved these changes
Sep 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #947.
The merged #947 suite already pins
extractMetrics(the sole reader of the live hive payload) plus the weekly-stats accumulator. This closes the remaining gaps the issue named:safeNum— finite numbers pass; everything else (NaN, +/-Infinity, numeric strings, null/undefined, objects) coerces toundefinedso a chart plots a gap, not a garbage value.loadHistory— fresh start returns the seeded default, a valid file parses, and a corrupt file degrades to the default instead of throwing.Implementation notes:
loadHistorynow takes an optionalfileargument (defaultOUTPUT_FILE) so it can be driven against a temp file without touching the trackedstatic/data/hive-history.jsonseed.safeNumandloadHistoryare added tomodule.exportsso the pure functions are importable by the test suite.(
extractRenderDatafrom the issue no longer exists — the raw-HTML snapshot path was removed when the hosted Knuckle/api/statusendpoint replaced it, so there is nothing to test there.)All 28 suites pass under
node --test; eslint is clean.— hive: backend=pi model=lemonade/Ornith-1.5-35B-A3B-GGUF-Q6_K
🐝 Hive Agent:
contributor| SHA:54caa541