Skip to content

fix(lab-ops-hub): judge decoded A-labels by UTS-46 mapped form + IDNA-disallowed categories (#588) - #3774

Merged
dezren39 merged 1 commit into
mainfrom
queue/4845-588-mapped-alabel
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/4845-588-mapped-alabel

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

What

Closes the #588 residual in the lab-ops-hub container validator (pkgs/lab-ops-hub/container/app.py), queue task 4845:

  1. Mapped-form equivalence (_judge_a_label). A decoded A-label must now be its own UTS-46 mapped form: the same mapping validate_crawl_url applies to raw hosts (NFKC + lowercase + ignored-codepoint deletion) must leave it unchanged. The punycode round-trip cannot see this class — it encodes any string — so labels carrying characters UTS-46 maps away (uppercase U+00C0, compatibility U+00B2, fullwidth U+FF0F, space-class U+2000, ignored codepoints) passed while the Worker's WHATWG validator refuses them.
  2. DISALLOWED categories (_judge_idna_label, the shared judge both raw and decoded labels pass through). Non-ASCII punctuation / symbol / separator characters (categories P, S, Z) plus private-use and surrogate codepoints are refused, with the CONTEXTO/CONTEXTJ exceptions exempted and judged by their existing rules (Catalan middle dot U+00B7, Hebrew punctuation U+05F3/U+05F4, Arabic separators U+066B/U+066C, undertie pair U+203F/U+2040). This catches U+00A8, U+00B4, U+037E and currency/math symbols, which are assigned, not format characters, NFKC-stable, and not prohibited by the stdlib IDNA-2003 codec. Category-based rather than an enumerated table, so it imports no unicodedata version skew (the lab-ops-hub: container validator accepts IDNA-invalid hosts the Worker refuses — unassigned codepoints and bidi-violating mixed labels #583/lab-ops-hub: PR #584's A-label check still accepts decoded labels that are not valid UTS-46 labels — mapped/compatibility characters, IDNA-disallowed symbols, leading combining marks #588 Cn pocket is untouched — Cn/Cf handling is unchanged).

Tests

python3 -m unittest discover -s pkgs/lab-ops-hub/test -p 'test_container_validate.py' on the laptop: 64/64 pass, including the new test_a_label_must_be_its_uts46_mapped_form_and_disallowed_free:


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 16:11
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 42 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 96d181a3-4fb9-49d8-a554-6469e0d31925
Commits

Reviewing files that changed from the base of the PR and between 23a38e3 and d7d0692.

Files selected for processing: 2
  • pkgs/lab-ops-hub/container/app.py
  • pkgs/lab-ops-hub/test/test_container_validate.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T16:15:31.535966Z d7d0692 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7d0692dc0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +679 to +680
unicodedata.category(c)[0] in "PSZ"
or unicodedata.category(c) in ("Co", "Cs")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve WHATWG-valid symbol and emoji hostnames

For symbol-bearing domains such as http://xn--ls8h.la/ (💩.la), this blanket category filter rejects hosts that the Worker's WHATWG validator accepts. Executing validateCrawlUrl from src/lib.ts under Bun confirms acceptance of that URL and http://xn--example-u17c.com/, while the parent commit's Python validator accepts both and this commit rejects both. Consequently, Worker-approved requests to these domains can no longer use the container crawler and unnecessarily fall back to the Worker. Match the Worker's actual UTS-46 acceptance behavior rather than treating every Unicode symbol or punctuation category as disallowed.

Useful? React with 👍 / 👎.

Comment on lines +586 to +588
mapped = unicodedata.normalize("NFKC", decoded).lower()
mapped = mapped.translate({cp: None for cp in _UTS46_IGNORED})
if mapped != decoded:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve Cherokee uppercase in the A-label mapping check

For A-labels containing Cherokee letters, Python .lower() is not the UTS-46 mapping: UTS-46 preserves uppercase Cherokee, whereas .lower() converts it to the lowercase block. For example, http://xn--ab-y8l.com/ (decoded label aᎠb, containing U+13A0) succeeds in the parent validator and the actual Worker validateCrawlUrl under Bun, but this check now rejects it as not being its UTS-46 mapped form. These valid letter-only domains therefore lose container crawling even if the symbol-category filter is corrected. Use a UTS-46-compatible mapping for this fixed-point check rather than universally requiring lowercase equivalence.

Useful? React with 👍 / 👎.

@dezren39

dezren39 commented Nov 1, 2026

Copy link
Copy Markdown
Member Author

Codex findings disposition (recorded by Lane F, task 4845 resumer — both findings are VALID, do not merge as-is):

  1. P2 — symbol/emoji over-refusal (app.py, the P/S/Z category arm). Codex verified under Bun that the Worker's WHATWG validator ACCEPTS http://xn--ls8h.la/ (💩.la, category So) and http://xn--example-u17c.com/ (€, category Sc), both of which this PR now refuses (the € case is even asserted as refused in the new test — that assertion is wrong against the Worker). WHATWG domain-to-ASCII is non-strict, so the IDNA2008 DISALLOWED table is not the Worker's rule for symbols. Rework: the category arm must be cut back to what is verified refused by the Worker — before re-landing it, run the lab-ops-hub: PR #584's A-label check still accepts decoded labels that are not valid UTS-46 labels — mapped/compatibility characters, IDNA-disallowed symbols, leading combining marks #588-class examples (U+00A8 Sk, U+00B4 Sk, U+037E Po) through the Worker's validateCrawlUrl under Bun and keep only the categories/classes it actually refuses; drop the € test assertion.

  2. P2 — Cherokee uppercase (app.py, the mapped-form check). Python .lower() is not the UTS-46 mapping for Cherokee: UTS-46 leaves uppercase Cherokee (U+13A0–U+13F4) unchanged, so http://xn--ab-y8l.com/ (aᎠb) is Worker-accepted but now refused. Rework: the mapped-form computation must preserve the Cherokee uppercase block while lowercasing everything else.

The mapped-form arm otherwise stands (the four #588 headline hosts are genuinely Worker-divergent). Resume path for task 4845: apply both reworks, re-run the container battery (64 tests) plus the two Codex example hosts as accepted-controls, reply on both review threads with the fix commits, then merge.

@dezren39
dezren39 merged commit ba05276 into main Nov 1, 2026
1 check passed
@dezren39
dezren39 deleted the queue/4845-588-mapped-alabel branch November 1, 2026 16:48
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