fix(timestamps): localize events and reject malformed ledger dates - #38
Merged
Muyideen-js merged 2 commits intoJul 21, 2026
Merged
Conversation
h3x-lol
marked this pull request as ready for review
July 11, 2026 15:24
Contributor
Author
|
/claim #27 |
Collaborator
|
@h3x-lol fix the conflict |
Collaborator
|
@h3x-lol fix conflict |
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.
Summary
ledgerClosedAtvalues to Unix seconds at the event boundaryNaN, and infinite ledger timestamps with a clearRangeErrorUnique correctness advantage
PR #36 adds
ledgerClosedAtToUnixSeconds, but it returnsNaNfor malformed or non-finite inputs. That bypasses the parser's existing catch path and allows an event containingtimestamp: NaNinto the returned event list.This patch validates the converted millisecond value with
Number.isFiniteand throwsRangeError("Invalid ledger close timestamp"). The existing parser catches that error and discards the malformed event.No seconds-versus-milliseconds heuristic is introduced: event inputs are normalized once at the service boundary, and application formatters retain a Unix-seconds contract.
Regression evidence
With the finite-value guard temporarily removed:
NaN,Infinity, and-Infinitydid not throwtimestamp: NaNinstead of an empty resultWith the guard present:
Additional validation
mainStellarPulsewhile the component rendersStellar Pulseweightinsrc/app/layout.tsxnext lintrequires interactive setupgit diff --check: passedCloses #27