Skip to content

fix(loop-metrics): keep entries with unparseable run_id in timeframe filter - #499

Open
pxmpsdev wants to merge 3 commits into
cobusgreyling:mainfrom
pxmpsdev:fix/loop-metrics-unparseable-run-id-filter
Open

fix(loop-metrics): keep entries with unparseable run_id in timeframe filter#499
pxmpsdev wants to merge 3 commits into
cobusgreyling:mainfrom
pxmpsdev:fix/loop-metrics-unparseable-run-id-filter

Conversation

@pxmpsdev

Copy link
Copy Markdown
Contributor

Problem: filterEntries (used by --timeframe 7d) filters on new Date(e.run_id). When run_id is not an ISO timestamp — e.g. a numeric GitHub run id or a custom slug — new Date() returns Invalid Date (it does not throw), so the comparison NaN >= cutoff is always false and the entry is silently dropped from every timeframe view. The existing try/catch never fires, and parseLogFile intentionally tolerates malformed lines — so the filter contradicts the parser's lenient behavior.

Fix: Detect Invalid Date via Number.isNaN(entryDate.getTime()) and keep the entry, matching the conservative "keep what we can't parse" behavior.

Verified: Added a regression test (numeric GitHub run id is kept with --timeframe 30); cd tools/loop-metrics && npm test passes (2 tests). Built dist is included.

@pxmpsdev
pxmpsdev force-pushed the fix/loop-metrics-unparseable-run-id-filter branch from 16e56f1 to df32673 Compare August 10, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant