Skip to content

fix: coerce numeric string timestamps in normalizeEvent - #38

Closed
Pitchfork-and-Torch wants to merge 2 commits into
mainfrom
cook/normalize-event-numeric-string-ts
Closed

Pitchfork-and-Torch wants to merge 2 commits into
mainfrom
cook/normalize-event-numeric-string-ts

Conversation

@Pitchfork-and-Torch

Copy link
Copy Markdown
Owner

Summary

  • normalizeEvent used Number.isFinite(raw.ts), which rejects numeric strings such as "1700000000000".
  • Hub/API/JSON callers often send timestamps as strings, so sort/merge keys silently became Date.now().
  • Coerce non-empty numeric strings before the finite check. Blank strings, NaN, and Infinity still fall back.

Distinct from #30–#37 (chain skip, loadConfig, verifyLedger corrupt, scores, finite numeric ts, readEvents/readLedger limit, verifyLedger maxEntries).

Test plan

  • node test/normalize-event-numeric-string-ts.js
  • node test/normalize-event-ts.js
  • node test/normalize-event-score.js

…mmand Nexus, sealed replay, Home Shield, Merkle forensics.
Hub and JSON callers often pass ts as a string. Number.isFinite on a
numeric string is false, so sort keys fell back to Date.now(). Coerce
non-empty numeric strings before the finite check; keep NaN/Infinity
and blank-string fallbacks.
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