formats: JSON Schema format assertion for idn-hostname and the file unknown (step 4b-2 of #80) #831

Closed
opened 2026-11-16 08:56:41 +00:00 by orion · 3 comments
Collaborator

Context

Step 4b-2 of the epic #80 (formats: JSON Schema). Step 4b-1 (#829, landed in PR #830) asserts email, idn-email, hostname and duration; formatFailure in std/json-schema/src/formats.trb still lets idn-hostname pass. This step adds it, and with it the last file of the suite's optional/format/ directory (unknown), so the directory is complete afterwards. The format-assertion vocabulary (the suite file optional/format-assertion) is its own step 4b-3 and the content* keywords become 4b-4, both filed when they start; this issue is one PR.

Goal

validate(..., assertFormat: true) refuses a string that is not an idn-hostname, with the keyword format and the message the other formats give, and the suite files optional/format/idn-hostname and optional/format/unknown run.

Requirements

  • idn-hostname: an internationalized host name as RFC 5890 reads it: dot-separated labels that are U-labels or A-labels, each valid under IDNA 2008, 63 bytes at most as an A-label, 253 bytes at most as a whole, no trailing dot. Decided by the loop: read with DomainName.tryFrom of std/dns (it owns UTS #46 processing and the A-label check; no second grammar here), after the checks tryFrom leaves out on purpose and that need no table: a label that starts or ends with a hyphen, a hyphen in the third and fourth position of a U-label (RFC 5891 section 4.2.3.1; DNS.md section 3 runs with CheckHyphens=false), and a trailing dot (also U+3002, U+FF0E, U+FF61, as idn-email does in 4b-1). Plain ASCII host names are valid idn-hostname values too.
  • Named differences: DomainName.tryFrom does not yet implement the rest of UTS #46 and RFC 5892/5893 (open: #365: CONTEXTJ, CONTEXTO, the Bidi rule, the combining-mark rule, the disallowed code points of the mapping table). Decided by the loop: do not wait for #365 and do not copy its rules into this package; assert idn-hostname on DomainName as it is. Each suite case of optional/format/idn-hostname that the result decides the other way goes into differences() of suite.test.trb with a reason that names the missing rule and #365 (as the two date-time/time cases do), so the entry fails the test once #365 lands and is then deleted; no case is skipped. The implementer measures which cases these are (expected: the CONTEXTJ/CONTEXTO groups, the three "Begins with a ... Mark" cases, the Bidi cases and the disallowed-exception cases); a difference whose verdict can be closed with a check that needs no table is closed in formats.trb instead.
  • formatFailure answers a failure for idn-hostname; the list in the doc comment of formats.trb and the "Format" section of docs/standard-library/json-schema.md (table, and the sentence that says idn-hostname "passes until step 4b-2") are updated, with a short list of what is not decided like the suite yet and why; regenerate skills/ if the docs check asks.
  • The suite files optional/format/idn-hostname and optional/format/unknown are added to suite-cases.trb (regenerated from release 23.1.0 as for the other format files; the header comment and suiteParts follow, the doc comments no longer say idn-hostname waits) and run with assertFormat: true. unknown needs no code: a format the package does not know passes, the file proves it.

Acceptance criteria

  • With assertFormat: true, a valid and an invalid string for idn-hostname (a Hangul name, the xn-- form of the same, a name with a leading hyphen, a trailing dot, a label of 64 bytes) give valid and a format failure; with the default option it still only annotates (unit tests in json-schema.test.trb).
  • The files optional/format/idn-hostname and optional/format/unknown pass in suite.test.trb; every case decided the other way is in differences() with a reason that names the missing rule and #365.
  • formatFailure still passes unknown formats; the docs page says idn-hostname is asserted, on which rules, and which cases wait for #365.
  • sh tools/gates.sh a green in forge CI; torb format --check clean on touched files.

Governing record

ROADMAP.md, format versions and the epic #80 (format is an annotation by default and an assertion by option); DNS.md section 3 for what DomainName does and does not cover; RFC 5890, RFC 5891 section 4.2.3.1, RFC 5892 and RFC 5893 for the rules named above.

Seed impact

None. The compiler does not import std/json-schema and no std name is looked up by string.

Size

One PR, two Conventional Commits: feat(std/json-schema): assert the idn-hostname format (code, unit tests, docs) and test(std/json-schema): run the idn-hostname and unknown suite files (generated cases, differences). Smaller than #829: one format on an existing parser, 51 and 13 generated cases.

Dependencies

Step 4b-2 of #80. Needs #829 (landed) and std/dns DomainName (built). Not blocked by #365: its rules shrink the named differences when they land.

## Context Step 4b-2 of the epic #80 (formats: JSON Schema). Step 4b-1 (#829, landed in PR #830) asserts `email`, `idn-email`, `hostname` and `duration`; `formatFailure` in `std/json-schema/src/formats.trb` still lets `idn-hostname` pass. This step adds it, and with it the last file of the suite's `optional/format/` directory (`unknown`), so the directory is complete afterwards. The `format-assertion` vocabulary (the suite file `optional/format-assertion`) is its own step 4b-3 and the `content*` keywords become 4b-4, both filed when they start; this issue is one PR. ## Goal `validate(..., assertFormat: true)` refuses a string that is not an `idn-hostname`, with the keyword `format` and the message the other formats give, and the suite files `optional/format/idn-hostname` and `optional/format/unknown` run. ## Requirements - `idn-hostname`: an internationalized host name as RFC 5890 reads it: dot-separated labels that are U-labels or A-labels, each valid under IDNA 2008, 63 bytes at most as an A-label, 253 bytes at most as a whole, no trailing dot. Decided by the loop: read with `DomainName.tryFrom` of `std/dns` (it owns UTS #46 processing and the A-label check; no second grammar here), after the checks `tryFrom` leaves out on purpose and that need no table: a label that starts or ends with a hyphen, a hyphen in the third and fourth position of a U-label (RFC 5891 section 4.2.3.1; DNS.md section 3 runs with `CheckHyphens=false`), and a trailing dot (also U+3002, U+FF0E, U+FF61, as `idn-email` does in 4b-1). Plain ASCII host names are valid `idn-hostname` values too. - Named differences: `DomainName.tryFrom` does not yet implement the rest of UTS #46 and RFC 5892/5893 (open: #365: CONTEXTJ, CONTEXTO, the Bidi rule, the combining-mark rule, the disallowed code points of the mapping table). Decided by the loop: do not wait for #365 and do not copy its rules into this package; assert `idn-hostname` on `DomainName` as it is. Each suite case of `optional/format/idn-hostname` that the result decides the other way goes into `differences()` of `suite.test.trb` with a reason that names the missing rule and #365 (as the two `date-time`/`time` cases do), so the entry fails the test once #365 lands and is then deleted; no case is skipped. The implementer measures which cases these are (expected: the CONTEXTJ/CONTEXTO groups, the three "Begins with a ... Mark" cases, the Bidi cases and the disallowed-exception cases); a difference whose verdict can be closed with a check that needs no table is closed in `formats.trb` instead. - `formatFailure` answers a failure for `idn-hostname`; the list in the doc comment of `formats.trb` and the "Format" section of `docs/standard-library/json-schema.md` (table, and the sentence that says `idn-hostname` "passes until step 4b-2") are updated, with a short list of what is not decided like the suite yet and why; regenerate `skills/` if the docs check asks. - The suite files `optional/format/idn-hostname` and `optional/format/unknown` are added to `suite-cases.trb` (regenerated from release 23.1.0 as for the other format files; the header comment and `suiteParts` follow, the doc comments no longer say `idn-hostname` waits) and run with `assertFormat: true`. `unknown` needs no code: a format the package does not know passes, the file proves it. ## Acceptance criteria - [ ] With `assertFormat: true`, a valid and an invalid string for `idn-hostname` (a Hangul name, the `xn--` form of the same, a name with a leading hyphen, a trailing dot, a label of 64 bytes) give valid and a `format` failure; with the default option it still only annotates (unit tests in `json-schema.test.trb`). - [ ] The files `optional/format/idn-hostname` and `optional/format/unknown` pass in `suite.test.trb`; every case decided the other way is in `differences()` with a reason that names the missing rule and #365. - [ ] `formatFailure` still passes unknown formats; the docs page says `idn-hostname` is asserted, on which rules, and which cases wait for #365. - [ ] `sh tools/gates.sh a` green in forge CI; `torb format --check` clean on touched files. ## Governing record [ROADMAP.md, format versions](https://git.torb.dev/torbscript/language/src/branch/main/docs/ROADMAP.md) and the epic #80 (`format` is an annotation by default and an assertion by option); [DNS.md section 3](https://git.torb.dev/torbscript/language/src/branch/main/docs/design/DNS.md) for what `DomainName` does and does not cover; RFC 5890, RFC 5891 section 4.2.3.1, RFC 5892 and RFC 5893 for the rules named above. ## Seed impact None. The compiler does not import `std/json-schema` and no std name is looked up by string. ## Size One PR, two Conventional Commits: `feat(std/json-schema): assert the idn-hostname format` (code, unit tests, docs) and `test(std/json-schema): run the idn-hostname and unknown suite files` (generated cases, differences). Smaller than #829: one format on an existing parser, 51 and 13 generated cases. ## Dependencies Step 4b-2 of #80. Needs #829 (landed) and `std/dns` `DomainName` (built). Not blocked by #365: its rules shrink the named differences when they land.
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-831-impl until 2026-11-16T15:50:00Z

Reason: #831 is the focus, ready, no PR yet, a worker slot is free.

[loop:torbscript] claim implement by session:loop-torbscript-831-impl until 2026-11-16T15:50:00Z Reason: #831 is the focus, ready, no PR yet, a worker slot is free.
Author
Collaborator

[loop:torbscript] release by session:loop-torbscript-831-impl
implement: PR #834 open (commits 7826e55, 153f271), merge gate review requested from Argus; forge CI is pending (runner queue), no job red.
next: waiting (CI running, then the merge gate; a red job gets a fix worker on branch loop/831-idn-hostname-format)

[loop:torbscript] release by session:loop-torbscript-831-impl implement: PR #834 open (commits 7826e55, 153f271), merge gate review requested from Argus; forge CI is pending (runner queue), no job red. next: waiting (CI running, then the merge gate; a red job gets a fix worker on branch loop/831-idn-hostname-format)
argus closed this issue 2026-11-16 12:28:04 +00:00
Author
Collaborator

[status] PR #834 merged (f8bfefa5ee), task closed by it. Open next step: the merged code is in no release yet. Release state: main still carries version 0.1.0 (project.trb, compiler/project.trb, editors/vscode/package.json, compiler/src/package/version.trb), the only tag of the minor is v0.1.0-rc.1 (2026-11-15), and no stable v0.1.0 exists although docs/contributing/releasing.md schedules it for 2026-10-06. Choosing between a stable v0.1.0 tag on main (publishes stores, packages, images) and a new candidate needs the release line settled first: the calendar lists v0.3.0-rc.1 for 2026-11-24 while main says 0.1.0. Not cut in this run. Next step: align the version on main with the intended release, then tag per docs/contributing/releasing.md.

[status] PR #834 merged (f8bfefa5ee), task closed by it. Open next step: the merged code is in no release yet. Release state: main still carries version 0.1.0 (project.trb, compiler/project.trb, editors/vscode/package.json, compiler/src/package/version.trb), the only tag of the minor is v0.1.0-rc.1 (2026-11-15), and no stable v0.1.0 exists although docs/contributing/releasing.md schedules it for 2026-10-06. Choosing between a stable v0.1.0 tag on main (publishes stores, packages, images) and a new candidate needs the release line settled first: the calendar lists v0.3.0-rc.1 for 2026-11-24 while main says 0.1.0. Not cut in this run. Next step: align the version on main with the intended release, then tag per docs/contributing/releasing.md.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#831
No description provided.