test: broaden fallback-vs-libidn2 backend parity coverage — PSLR-gnmvyymh#8
Merged
Conversation
…ymh) Prove the fallback and optional libidn2 label backends make identical accept/reject decisions and produce identical canonical output. - Compare on the DECISION (accept vs reject) and on accepted OUTPUT, not on raw error text: the backends word rejections differently (e.g. for "xn--zzz999.com" fallback says "Truncated punycode input" while libidn2 says "string contains invalid punycode data"), so message equality would give false failures. - Broaden the corpus to multi-script and PSL-shaped multi-label domains, A-label idempotence, non-transitional sharp-s, single root dot, and a reject set spanning the validation pipeline (empty name/label, STD3, hyphen placement, whitespace, malformed ACE, over-long label). - Add unconditional fallback-only assertions (reject + round-trip) that run on every platform. With libidn2 present the public API routes label work through it, so without these the fallback would be exercised on Linux/macOS CI only via parity equality, and skipped entirely on Windows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Closes the backend-parity work item (
PSLR-gnmvyymh): prove the in-tree fallback and the optional libidn2 label backend make identical accept/reject decisions and produce identical canonical output across PSL-shaped domains, official RFC 3492 vectors, URLs, and edge/reject cases — and that the suite stays green with libidn2 absent.What changed
tests/testthat/test-backends.Rrewritten around a decision/output-split parity model:xn--zzz999.com: fallback "Truncated punycode input" vs libidn2 "string contains invalid punycode data"), so message equality would produce false failures. The old test compared raw output strings and only ever fed valid inputs, so it never hit this._, hyphen placement, whitespace, malformed ACE, >63-octet label).Verification
testthatsuite green locally with libidn2 present (libidn2+fallback); pre-push verify gate passed.🤖 Generated with Claude Code