Skip to content

test: broaden fallback-vs-libidn2 backend parity coverage — PSLR-gnmvyymh#8

Merged
bart-turczynski merged 1 commit into
mainfrom
test/backend-parity
Jun 15, 2026
Merged

test: broaden fallback-vs-libidn2 backend parity coverage — PSLR-gnmvyymh#8
bart-turczynski merged 1 commit into
mainfrom
test/backend-parity

Conversation

@bart-turczynski

Copy link
Copy Markdown
Owner

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.R rewritten around a decision/output-split parity model:

  • Parity is asserted on the decision (accept vs reject) and on accepted output — never on raw error text. The two backends word rejections differently (e.g. 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.
  • Broader corpus: multi-script U-labels, PSL-shaped multi-label names, 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, >63-octet label).
  • Unconditional fallback teeth (reject + round-trip) that run on every platform. With libidn2 present the public API routes label work through libidn2, so without these the fallback backend would be exercised on Linux/macOS CI only via parity equality and skipped entirely on Windows.

Verification

  • Full testthat suite green locally with libidn2 present (libidn2+fallback); pre-push verify gate passed.
  • CI installs libidn2 on Linux + macOS (4/5 jobs run real cross-backend parity); Windows uses fallback-only and exercises the unconditional fallback assertions, confirming "passes with libidn2 absent".

🤖 Generated with Claude Code

…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>
@bart-turczynski bart-turczynski merged commit 19bd0e9 into main Jun 15, 2026
8 checks passed
@bart-turczynski bart-turczynski deleted the test/backend-parity branch June 15, 2026 11:39
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.

1 participant