Skip to content

fix: coerce numeric string scores in normalizeEvent - #39

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

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

Conversation

@Pitchfork-and-Torch

Copy link
Copy Markdown
Owner

Summary

  • normalizeEvent used Number.isFinite(raw.score), which rejects numeric strings such as "5".
  • Hub/API/JSON callers often send scores as strings, so severity silently became the type default.
  • Coerce non-empty numeric strings before the finite check. Blank strings, NaN, and Infinity still fall back.

Distinct from #30–#38 (chain skip, loadConfig, verifyLedger corrupt, non-finite scores, finite numeric ts, readEvents/readLedger limit, verifyLedger maxEntries, numeric string timestamps).

Test plan

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

…mmand Nexus, sealed replay, Home Shield, Merkle forensics.
Number.isFinite rejects string scores such as \"5\", so JSON/hub callers
silently fell back to type-derived scores. Coerce non-empty numeric
strings before the finite check, matching timestamp handling.
@Pitchfork-and-Torch
Pitchfork-and-Torch deleted the cook/normalize-event-numeric-string-score branch September 18, 2026 04:29
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