feat(std/json-schema): assert the email, idn-email, hostname and duration formats #830
No reviewers
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language!830
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/829-format-assertions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #829
Step 4b-1 of #80:
validate(..., assertFormat: true)now asserts the formatsemail,idn-email,hostnameandduration.hostname: ASCII only, no trailing dot, read withDomainNamefromstd/dns(labels of at most 63 bytes, at most 253 bytes, validxn--labels).email: an RFC 5321 mailbox (dot-string or quoted-string, domain or address literal[IPv4]/[IPv6:...]), ASCII only.idn-emailallows non-ASCII in the local part and reads the domain withDomainName, refusing a trailing dot (also U+3002, U+FF0E, U+FF61). The RFC 5321 length limits are not checked.duration: a small grammar written in the package, sincestd/timehas no ISO 8601 duration parser.optional/format/{email,idn-email,hostname,duration}), count 1526 -> 1601. No case needs an entry indifferences():torb test std/json-schema/tests/suite.test.trbandjson-schema.test.trbpass locally on the nightly VM.docs/standard-library/json-schema.mdand the generated skill copy.idn-hostnamestays for step 4b-2 and is named as such.Decision to review:
durationfollows the RFC 3339 appendix A ABNF strictly. SoP1Y2D(year then day) andPT1H30S(hour then second) are refused, and a week (P2W) stands alone. The suite does not test these, so the strict reading is a choice, not forced by it.Seed impact: none.
formatassertion for email, hostname and duration (step 4b-1 of #80) #829[loop:torbscript] note for the merge gate:
mainCI is red since17298cd0(merge of #822):ci / commit messagesrefuses a merge commit ("a merge commit - main is linear") and the jobs behind it stay blocked. The repo default merge style ismerge. Landing the next green PR with the rebase style puts a clean commit range onmainand clears the red; the loop holds new work until then. Nothing is needed on this PR itself.Approved at
54f36ce7.suite.test.trb). CI green on this head (tier A, bootstrap, conformance, pdisc, commit messages, gates).isDurationagainst the RFC 3339 appendix A ABNF: the date listsD, M, MD, Y, YM, YMDand the time listsS, M, MS, H, HM, HMSmatch the rules, the week stands alone,PT/P/P1YTare refused. The strict reading (P1Y2D,PT1H30Srefused) is the ABNF and fine as the stated rationale. The mailbox grammar (dot-string, quoted-string with quoted-pair, address literals, first@outside quotes) and the hostname rules (ASCII, no trailing dot,DomainNamefor labels andxn--) match the RFC 5321 / 1123 text; bounds of thebyteOfreads hold.idn-hostnamestays for 4b-2 and is named so. Two Conventional Commits as the issue asks.std/dns(already in std), no data or storage change; seed impact none.formats.trbandsuite-cases.trbupdated.maincheck.formatassertion for email, hostname and duration (step 4b-1 of #80) #829formatassertion for idn-hostname and the fileunknown(step 4b-2 of #80) #831