Skip to content

[502] Verify audit_ledger_sum_checker math using detailed numeric test data - #595

Merged
godamongstmen897 merged 1 commit into
Goldii-locks:mainfrom
Goodnessukaigwe:fix/502-verify-audit_ledger_sum_checker-math-using-detailed-numeric-test-data
Sep 29, 2026
Merged

godamongstmen897 merged 1 commit into
Goldii-locks:mainfrom
Goodnessukaigwe:fix/502-verify-audit_ledger_sum_checker-math-using-detailed-numeric-test-data

Conversation

@Goodnessukaigwe

Copy link
Copy Markdown
Contributor

Summary

  • audit_ledger_sum_checker already implemented overflow-safe sums, split assertions, and round-half-to-even helpers, but Jest coverage did not pin multi-entry fixtures with independently derived expected totals.
  • Adds a dedicated numeric suite so reviewers can audit the arithmetic from the test file without relying on the implementation as the source of truth.

Implementation

  • Tests only; no production behavior change.
  • Fixtures cover mixed string/number/bigint ledger entries, zeros, stroop-scale decimals as integers, three-way split reconstruction, shortfalls, exact and inexact division, remainder-preserving divideWithRounding, and fee-style applyRoundedScale cases that distinguish half-even from half-up.

Calculation / serialization behavior

  • Expected values are integer minor units computed by hand (for example 15_000_000 + 2_500_000 + 4_000_000 = 21_500_000; 5/2 rounds to 2, not 3).

Validation

  • npm test -- --testPathPatterns=audit_ledger_sum_checker, full npm test, and npx tsc --noEmit passed.

Reviewer notes

  • Rate-limit buckets are reset in beforeEach because sumLedgerAmounts records calls.

Closes #502

Made with Cursor

…xtures

Pin ledger sums, split reconstruction, half-even division, and scaled fees to hand-calculated bigint outcomes so arithmetic regressions are visible in Jest.

Co-authored-by: Cursor <cursoragent@cursor.com>
@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

@Goodnessukaigwe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@godamongstmen897
godamongstmen897 merged commit 82678f9 into Goldii-locks:main Sep 29, 2026
1 check passed
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.

Verify audit_ledger_sum_checker math using detailed numeric test data

2 participants