Repository navigation
test(hosting): record the long ACE-label CORS divergence and pin it with tested rows (#945) - #954
Merged
Merged
Conversation
…ith tested rows (#945)
This was referenced Nov 17, 2026
Merged
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.
📝 Description
What does this PR do?
The last part of #945. Upstream's CLI (WHATWG URL parsing,
external/opencode/packages/cli/src/services/service-config.tsat the 2.3.0 pin) accepts valid ACE (xn--) labels of 64 and 65 characters in CORS origins. The SDK'sCorsOriginPolicyrefuses them, because .NET'sIdnMappingalways enforces the 63-character label limit. The maintainer decided to record this as a divergence and to pin it with tested rows rather than port Punycode or UTS-46 (2026-11-17, #945). This PR changes no production code.Corpus. Four rows, with verdicts generated by
bun tools/oracles/service-config.tsfrom upstream's own code:http://xn--"-mga, valid;http://xn--"-9ca, invalid;The two
xn--"rows cover ACE labels that contain the characters fix(hosting): accept the remaining WHATWG host characters in CORS origins and pin the fallback's invariants (#945) #948 added, and the SDK matches upstream on both. No existing verdict changed.Expected differences, tested both ways.
CorsOriginPolicyTestsnames the two long-ACE origins.IsOrigin_Should_Match_Every_Upstream_Cors_Verdictskips exactly those origins and still compares every other row, including the 63-character ACE rows.IsOrigin_Should_Preserve_Recorded_Upstream_Differencesasserts three things for each named origin: it is still in the corpus, upstream accepts it, and the SDK refuses it. The test goes red when either side changes or the row leaves the corpus.Canon.
docs/architecture/client-runtime.md, in theCorsOriginPolicysection, records the divergence in the file's existing form:IdnMappinghas no switch for the limit, and DNS limits a label to 63 octets, so no resolvable host is lost;CHANGELOG. No entry: SDK behaviour does not change.
Related Issue(s):
🔄 Type of Change
🎯 Protocol & API Surface
spec/) is untouchedexternal/was hand-edited🧪 Testing
How has this been tested?
The oracle corpus grows from 172 to 176 rows, and the four new verdicts matched the predictions. After the commit, the oracle ran twice more, with a clean tree each time.
Red proofs (temporary test-side edits, each restored with a clean diff). Each one failed deterministically on net10.0 and net11.0:
upstream True, SDK Falsefor that row.http://example.com, which both sides accept, fails the new test on the SDK side.http://%65xample.com, which upstream refuses, fails the new test on the upstream side.Local check on
75b8eae5(macOS arm64, on master31c7a3c8), all green:dotnet build -c Release, and again with-p:IncludeNet472Tests=true;verify-clones;--helpandgenerate --verify.After the rebase onto master
c764d7fb(#947), the Release build (0 warnings), whitespace, the Tools tests (2874) andCorsOriginPolicyTests(4 runs across net10.0 and net11.0) passed again. After the rebase onto masterf5a26b8f(#953, docs only), whitespace and the Tools tests (2874, including the canon-section guard) passed on the headb831cc23.Review: a fresh read found nothing blocking. It confirmed the label arithmetic (63 compared, 64 and 65 listed), the skip logic and the canon entry. It traced both
xn--"rows throughCorsOriginPolicyon ICU.net472: no production code changed, so there are no mutants to replay. The
xn--"-mgarow has not run on .NET Framework 4.7.2 yet. On Windows, .NET Framework'sIdnMappinguses the Win32 IDN functions rather than ICU, so the gate host runs a baseline-onlyCorsOriginPolicyTestspass on net472 before this PR is enqueued. If net472 refuses that row, the difference is recorded in this PR.📚 Documentation
Known follow-ups
CorsOriginPolicyTestsrepeats the expected-fixture name and its parse in both tests; one private constant or loader would remove the duplication.CorsOriginPolicy's XML summaries still say it applies the CLI's exact policy. Now that one difference is recorded, they could say "the CLI's policy, with the recorded exceptions".