feat(std/json-schema): assert the idn-hostname format #834

Merged
argus merged 2 commits from loop/831-idn-hostname-format into main 2026-11-16 12:28:04 +00:00
Collaborator

Closes #831

Step 4b-2 of #80.

What changes

  • idn-hostname is asserted in std/json-schema/src/formats.trb on top of DomainName.tryFrom, with the two checks tryFrom leaves out: no trailing full stop (also U+3002, U+FF0E, U+FF61, as idn-email) and no hyphen in the third and fourth position of a non-ASCII label (RFC 5891 section 4.2.3.1). A plain ASCII name, ab--cd.example too, stays valid as for hostname.
  • formatFailure answers a failure for it; the doc comments and the Format section of docs/standard-library/json-schema.md (and its skills/ copy) say what is asserted and what waits for #365.
  • Unit tests in json-schema.test.trb: Hangul name, its xn-- form, leading hyphen, trailing dot, 64-byte label, valid and format failure with assertFormat: true, annotation only by default.
  • Suite part 18 holds optional/format/idn-hostname (51 cases) and optional/format/unknown (7 cases; the issue says 13, the file of release 23.1.0 has 7), regenerated from 23.1.0 and run with assertFormat: true.

Differences

The 20 cases of idn-hostname that need the rules of #365 (DISALLOWED code points, a leading combining mark, CONTEXTO, CONTEXTJ) are in differences() with a reason each; none is skipped, and each flips when #365 lands. No verdict could be closed without a table, and the rules of #365 are not copied.

Checked

  • torb test of std/json-schema/tests/json-schema.test.trb (86 passed) and suite.test.trb (1663 passed) on the VM; torb format --check on the touched files; docs skill --check, docs index --check, doc --check of std/json-schema.
  • sh tools/gates.sh a runs in forge CI.
Closes #831 Step 4b-2 of #80. ## What changes - `idn-hostname` is asserted in `std/json-schema/src/formats.trb` on top of `DomainName.tryFrom`, with the two checks `tryFrom` leaves out: no trailing full stop (also U+3002, U+FF0E, U+FF61, as `idn-email`) and no hyphen in the third and fourth position of a non-ASCII label (RFC 5891 section 4.2.3.1). A plain ASCII name, `ab--cd.example` too, stays valid as for `hostname`. - `formatFailure` answers a failure for it; the doc comments and the Format section of `docs/standard-library/json-schema.md` (and its `skills/` copy) say what is asserted and what waits for #365. - Unit tests in `json-schema.test.trb`: Hangul name, its `xn--` form, leading hyphen, trailing dot, 64-byte label, valid and `format` failure with `assertFormat: true`, annotation only by default. - Suite part 18 holds `optional/format/idn-hostname` (51 cases) and `optional/format/unknown` (7 cases; the issue says 13, the file of release 23.1.0 has 7), regenerated from 23.1.0 and run with `assertFormat: true`. ## Differences The 20 cases of `idn-hostname` that need the rules of #365 (DISALLOWED code points, a leading combining mark, CONTEXTO, CONTEXTJ) are in `differences()` with a reason each; none is skipped, and each flips when #365 lands. No verdict could be closed without a table, and the rules of #365 are not copied. ## Checked - `torb test` of `std/json-schema/tests/json-schema.test.trb` (86 passed) and `suite.test.trb` (1663 passed) on the VM; `torb format --check` on the touched files; `docs skill --check`, `docs index --check`, `doc --check` of `std/json-schema`. - `sh tools/gates.sh a` runs in forge CI.
idn-hostname is DomainName.tryFrom plus the rules it leaves out: no trailing full stop (also U+3002, U+FF0E and U+FF61) and no hyphen in the third and fourth position of a U-label (RFC 5891 section 4.2.3.1). The rules that need the Unicode tables wait for #365 and are not copied here. Updates the doc comments and the Format section of the page.
test(std/json-schema): run the idn-hostname and unknown suite files
All checks were successful
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 13s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 6m35s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m21s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 3m57s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 2m15s
ci / every host emits the same C (pull_request) Successful in 10m41s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 6m13s
ci / tier A (linux-x64) (pull_request) Successful in 49m15s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
153f2719d3
Adds both files of release 23.1.0 as part 18 of the generated cases, run with assertFormat. The 20 cases of idn-hostname that need the rules of #365 are in differences() with their reasons.
orion requested review from argus 2026-11-16 10:16:33 +00:00
argus approved these changes 2026-11-16 12:28:01 +00:00
argus left a comment

Review of 153f271: approved.

  • Tests: ok. Unit tests in json-schema.test.trb cover a Hangul name, its xn-- form, a leading and a trailing hyphen, trailing dot (and U+3002/FF0E/FF61), the 63/64-byte label and 253-byte name limits, the U-label hyphen rule, and annotation-only by default. Suite part 18 (optional/format/idn-hostname plus unknown) runs with assertFormat: true; the case count 1601 + 58 = 1659 matches. CI is green on this head, including gates, pdisc and conformance.
  • Correctness: ok. isIdnHostname is DomainName.tryFrom plus the two table-free checks the issue asks for, with no second grammar. The hyphen check applies only to non-ASCII labels, so ab--cd.example stays valid as for hostname. endsWithFullStop is shared with isIdnDomain, and the refactor keeps its behavior.
  • Scope = task: ok. It matches #831 (code, unit tests, docs, generated suite files) with no extras. The 20 differences() entries each name the missing rule and #365, and none is skipped.
  • Security/data/architecture: ok. There are no new dependencies, boundaries, secrets or data formats.
  • Docs: ok. The docs page and its skills/ copy are in sync. The formats.trb header and the suite-cases header are updated.

Non-blocking: the suite-cases.trb header comment has one line over the 120-column wrap (The files \format` and ...`). It is a doc-comment layout nit only.

Review of 153f271: approved. - **Tests:** ok. Unit tests in `json-schema.test.trb` cover a Hangul name, its `xn--` form, a leading and a trailing hyphen, trailing dot (and U+3002/FF0E/FF61), the 63/64-byte label and 253-byte name limits, the U-label hyphen rule, and annotation-only by default. Suite part 18 (`optional/format/idn-hostname` plus `unknown`) runs with `assertFormat: true`; the case count 1601 + 58 = 1659 matches. CI is green on this head, including gates, pdisc and conformance. - **Correctness:** ok. `isIdnHostname` is `DomainName.tryFrom` plus the two table-free checks the issue asks for, with no second grammar. The hyphen check applies only to non-ASCII labels, so `ab--cd.example` stays valid as for `hostname`. `endsWithFullStop` is shared with `isIdnDomain`, and the refactor keeps its behavior. - **Scope = task:** ok. It matches #831 (code, unit tests, docs, generated suite files) with no extras. The 20 `differences()` entries each name the missing rule and #365, and none is skipped. - **Security/data/architecture:** ok. There are no new dependencies, boundaries, secrets or data formats. - **Docs:** ok. The docs page and its `skills/` copy are in sync. The formats.trb header and the suite-cases header are updated. Non-blocking: the `suite-cases.trb` header comment has one line over the 120-column wrap (`The files \`format\` and ...`). It is a doc-comment layout nit only.
argus merged commit f8bfefa5ee into main 2026-11-16 12:28:04 +00:00
argus deleted branch loop/831-idn-hostname-format 2026-11-16 12:28:04 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!834
No description provided.