Skip to content

test(facade): pin empty-input round-trip uniformly across all codecs (#70)#71

Merged
nao1215 merged 1 commit into
mainfrom
test/issue-70-empty-input-round-trip
May 8, 2026
Merged

test(facade): pin empty-input round-trip uniformly across all codecs (#70)#71
nao1215 merged 1 commit into
mainfrom
test/issue-70-empty-input-round-trip

Conversation

@nao1215

@nao1215 nao1215 commented May 8, 2026

Copy link
Copy Markdown
Owner

Summary

Pins the empty-input round-trip contract uniformly across all 32 facade pairs in yabase/facade. Without this test, a future refactor could silently flip the rule for one codec; with it, that surfaces as a single-test diff. Closes #70. Companion to yabase#63 / #64 / #65 (which all addressed non-empty inputs).

Changes

  • test/empty_input_round_trip_test.gleam (new): one test per facade pair, asserting:
    • For every total encode_*: decode_*(encode_*(<<>>)) == Ok(<<>>).
    • For the two Result-returning encoders (encode_z85, encode_rfc1924_base85): let assert Ok(encoded) = encode_*(<<>>) then the same round-trip on encoded.
    • For the RFC 4648 family (Base16, Base32, Base32hex, Base64, Base64 strict, Base64url, Base64 nopadding, Base64url nopadding): decode_*("") == Ok(<<>>) directly.
  • CHANGELOG.md: notes the new test under [Unreleased].

Design Decisions

  • Hand-picked exhaustive test instead of metamon forall_round_trip: metamon is not a dev-dep of yabase, and the empty case is a single fixed input — a forall over input length would just amplify the work for a constant whose answer the test is defining. Listing every facade pair makes adding a new codec obviously incomplete (the new pair has to be added here too).
  • decode("") only pinned for the RFC 4648 family: non-RFC-4648 codecs (Bech32, Base58Check) have their own conventions for "" (no version byte, no checksum) and shouldn't be coerced to a uniform contract. The issue explicitly notes this split.
  • No production-code change: every test passes against the current facade, so this PR is pure regression coverage. If a future change to a codec breaks one of these, the failing test name names the codec.

Limitations

  • README / per-codec docstring updates suggested in the issue's third acceptance bullet are not added in this PR. The test is the load-bearing artefact; a follow-up doc sweep can reference this test as the empty-case authority.
  • Test count grew by 32 cases (gleam test reports 747 vs. 715 before).

Closes #70

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@nao1215 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 27 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 72e5a5f8-3c98-4fe9-b735-4f983278e01b

📥 Commits

Reviewing files that changed from the base of the PR and between 71bd8bc and afbce1b.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • test/empty_input_round_trip_test.gleam
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/issue-70-empty-input-round-trip

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nao1215 nao1215 merged commit 20bface into main May 8, 2026
8 checks passed
@nao1215 nao1215 deleted the test/issue-70-empty-input-round-trip branch May 8, 2026 00:07
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.

Pin empty-input round-trip uniformly across every facade codec

1 participant