Skip to content

feat(muxed): Add uint64 round-trip test for max uint64 boundary#176

Merged
codeZe-us merged 1 commit intoBoxkit-Labs:mainfrom
GEEKYFOCUS:feat/add-uint64-max-roundtrip-test
Mar 27, 2026
Merged

feat(muxed): Add uint64 round-trip test for max uint64 boundary#176
codeZe-us merged 1 commit intoBoxkit-Labs:mainfrom
GEEKYFOCUS:feat/add-uint64-max-roundtrip-test

Conversation

@GEEKYFOCUS
Copy link
Copy Markdown

Description

This PR adds a focused unit test to validate correct round-trip encoding/decoding
at the uint64 maximum boundary, ensuring serialization safety without buffer
overflow or precision loss.

Problem

ID integers maxing at uint64 (18446744073709551615) run risks of buffer overflow
or precision drop depending on intermediate serialization logic. Without explicit
testing, subtle errors can go undetected.

Solution

Added TestEncodeMuxedUint64MaxRoundtrip that:

  1. Uses maxUint64 := ^uint64(0) as the test value
  2. Encodes through EncodeMuxed and decodes through DecodeMuxed
  3. Validates bit-for-bit correctness with triple verification:
    • Base account matches exactly
    • ID string representation matches exactly
    • Decoded value converts back to uint64 without precision loss

Testing

✅ All tests pass:

  • TestEncodeDecodeMuxedIsLosslessForUint64Max
  • TestEncodeMuxedWithJS53Boundary
  • TestEncodeMuxedJSONUnmarshalWithJS53Boundary
  • TestEncodeMuxedUint64MaxRoundtrip (NEW)
  • TestRoundtrip_Uint64EdgeCases (comprehensive edge cases)

Impact

  • Prevents regressions at uint64 serialization boundaries
  • Adds native Go execution validation
  • Strengthens safety guarantees for max ID values

Files Changed

  • packages/core-go/muxed/muxed_test.go - Added uint64 max round-trip test

- Add TestEncodeMuxedUint64MaxRoundtrip to validate round-trip encoding/decoding at max uint64 (18446744073709551615)
- Ensures bit-for-bit correctness without buffer overflow or precision loss during serialization
- Uses maxUint64 := ^uint64(0) as specified in issue requirements
- Includes explicit uint64 conversion validation to detect precision loss
- Tests following established patterns in muxed test suite

Closes Boxkit-Labs#78
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

Hey @GEEKYFOCUS! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#78 Implement uint64 round-trip tests in muxed_test.go for max uint64 values Link to this issue

ℹ️ Learn more about linking PRs to issues

@GEEKYFOCUS
Copy link
Copy Markdown
Author

Hello Maintainer.
Kindly review my PR, so the issue can me be closed. Thanks

@codeZe-us codeZe-us self-requested a review March 27, 2026 16:14
@codeZe-us codeZe-us merged commit f9e462d into Boxkit-Labs:main Mar 27, 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.

2 participants