Repository navigation
feat(backend): add ledger sequence difference calculator module (#373) - #471
Open
jdjioe5-cpu wants to merge 1 commit into
Open
jdjioe5-cpu wants to merge 1 commit into
jdjioe5-cpu wants to merge 1 commit into
Conversation
- Implement backend/src/ledgerSequenceDiff.js to compute non-negative ledger count differences - Validate non-negative integer bounds and clarify which sequence argument is newer - Export constants LEDGER_SEQUENCE_ARGUMENT, LEDGER_SEQUENCE_SIGN, and LEDGER_SEQUENCE_ERROR - Add 9 single-behavior node:test test files covering directional checks, equality, boundary, BigInt safety, options objects, constants, and invalid inputs - Add feature documentation under docs/features/ledgerSequenceDiff.md Closes Kitewell-lab#373
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
Implements the ledger sequence difference calculator in
backend/src/ledgerSequenceDiff.jsto compute non-negative ledger count differences between two ledger sequence numbers per #373.Changes
backend/src/ledgerSequenceDiff.jsexportingcalculateLedgerDiff(andledgerSequenceDiffalias)"first","second", ornullwhen identical)backend/src/ledgerSequenceDiffConstants.js(LEDGER_SEQUENCE_ARGUMENT,LEDGER_SEQUENCE_SIGN,LEDGER_SEQUENCE_ERROR)node:testtest files inbackend/src/:ledgerSequenceDiff-happy.test.js(happy path)ledgerSequenceDiff-first-newer.test.js(first sequence newer)ledgerSequenceDiff-second-newer.test.js(second sequence newer)ledgerSequenceDiff-equal.test.js(identical sequence numbers)ledgerSequenceDiff-boundary.test.js(boundary difference and safe integer handling)ledgerSequenceDiff-options-object.test.js(options object interface)ledgerSequenceDiff-invalid-negative.test.js(negative number rejection)ledgerSequenceDiff-invalid-non-integer.test.js(non-integer rejection)ledgerSequenceDiff-invalid-missing.test.js(missing input rejection)ledgerSequenceDiff-constants.test.js(constant immutability verification)docs/features/ledgerSequenceDiff.mdVerification
npm testrun frombackend/passes 396/396 tests cleanCloses #373