feat(uri): repaired(text) and the String pair as Decode pair (#132) #465
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/132-uri-repaired"
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 #132
Summary
repaired(text)instd/uri(std/uri/src/repaired.trb,public useinlib.trb, not in the prelude): the repairs the WHATWG URL parser makes before it parses. Leading/trailing U+0000..U+0020 are stripped, every tab, LF and CR is removed, and\becomes/before the first?/#for the special schemes (http,https,ws,wss,ftp,file, any case) or a text with no scheme. A\in the query, the fragment or after another scheme stays. Total, idempotent, nothing is checked. Tests instd/uri/tests/repaired.test.trb.compiler/src/semantics/checker/derive.trb): a capsule with several conversion pairs takes the one withStringas itsEncode/Decodepair (conversionPairOf, and the diagnostic notes use it). Several pairs and noneStringis unchanged: noDecode, same message. Nothing was derived before that is not derived now. Tests reworked incompiler/tests/implementations.test.trb, conformance programtests/conformance/encoding-capsule-text-pair.trb.docs/design/URI.md(slice 5 done, section 6, section 8, gap 9 closed 2026-10-24),docs/design/ENCODING.md,docs/language/types/data-or-capsule.mdrules 5 and 6,docs/language/reflection/encode-and-decode.md,docs/standard-library/uri.md(newrepairedsection) andencoding.md.Verified by
Nothing ran locally: the worker box has no toolchain, so everything here is verified only by forge CI (tier A gates: build, std/compiler tests, docs checks incl.
docs skill --check; tier B for the conformance program in VM and--native).skills/: no toolchain to runtorb docs skill docs skills, so the matching copies underskills/(uri.md,data-or-capsule.md,encode-and-decode.md,encoding.md) were edited by hand with the same text;docs/design/*has no skills copy. The new text has no links, so the copies are byte-identical to the docs ones. CI--checkis the verification; if it reports a diff, regenerate withtorb docs skill docs skills.Unbudgeted allocations
tests/conformance/encoding-capsule-text-pair.allocationsisunbudgeted: ...because the allocation count could not be measured without a toolchain. After CI is green, runsh tools/conformance.sh --filter encoding-capsule-text-pair --update-budgetson linux x86_64 and commit the number.URI.md correction (NUL)
Section 6's table said a browser removes a NUL silently. It does not: the WHATWG parser only strips leading/trailing C0 controls and spaces and removes tab/LF/CR inside the text; any other control character, a NUL included, is percent-encoded, as
Uri.tryFromdoes (%00). The NUL row now says "they agree", a tab row was added where they differ, the row counts and therepaireddoc comment are corrected.CI red on
6872007: ci / tier A (linux-x64) failed after 4m (so did the aggregate ci / gates); all other jobs green or skipped (tier B and the conformance jobs were skipped because of it). The job log is not readable with the reviewer token, so the cause is not confirmed. One candidate from the diff: the new doc comment ofderivesThroughPairincompiler/src/semantics/checker/derive.trbhas a line well over the 120 columns the neighbouring comments keep ("withString), and theSourceof that pair has to carry the trait itself: ..."), which a format/lint gate would flag. No other blocker seen in the code diff so far; review follows once CI is green on a new head.Tier A was red on
6872007for a real reason (job log read):std/uri/tests/repaired.test.trbcalledrepaired textinstead ofrepaired(text)(lines 12 and 85; this also madecheck, both std test lanes,doc --checkand the whole-repository type test incompiler/testsfail), anddocs/standard-library/uri.md:411hadprint Uri.tryFrom(...)?with an operator at the top level of the argument (docs check; skills copy too). Fixed ind1c3f82; I also wrapped the over-long doc comment ofderivesThroughPairat 120 columns (not the cause, but valid). Re-requesting review once CI is green on the new head.CI red on
d1c3f82: ci / tier A (linux-x64) failed after 23m and ci / tier B (linux-x64) failed after 10m (so did the aggregate ci / gates); build, bootstrap, pdisc, commit messages, release-sync, same-C and playground jobs are green, the remaining jobs were skipped. The job logs are not readable with the reviewer token, so the cause is not confirmed; the 4m tier A failure on6872007is gone, this is a later gate (likely the std/compiler tests or the conformance programencoding-capsule-text-pair, which has never run, or itsunbudgetedallocations file). No other blocker seen in the code diff so far; review follows once CI is green on a new head.CI on
d1c3f82was red for two real reasons (job logs read): (1)doc --check --no-run std(tier A): the doc-comment example ofrepairedinstd/uri/src/repaired.trbimportedrepairedinto its own module ("already imported") and usedprintwith a top-level?; (2) the conformance programencoding-capsule-text-pair(tier B, native + both VM lanes) left with exit 1: aStringinsideOk(...)is displayed quoted, so the check expectsOk("a-b"), notOk(a-b). Both fixed in4c4f9f0(example without the import and withprint(...); expected text quoted). Re-requesting review.Checklist (head
4c4f9f0, CI green: gates, tier A, tier B, pdisc, bootstrap, same-C, playground):std/uri/tests/repaired.test.trbcovers trimming, tab/LF/CR removal, special vs other schemes,?/#cut-off, IDNA viaUri, idempotence;compiler/tests/implementations.test.trbkeeps the multi-pair-without-String case (now Title/Label) and adds the String-wins case; the new conformance program runs in VM and native.conversionPairOfreturns the sole pair or theStringone, elseNone;capsuleNotesOfstays consistent with it (message only when no pair resolves).repairedis total and idempotent (the trim runs before the line-break removal, so removal cannot expose new edge characters).repairedplus gap 9); no seed, syntax or driver change.Decodenow derives one throughString; it only adds, nothing derived before is lost.skills/copies match and the docs--checkgate is green.tools/conformance.sh; Orion's follow-up to measure and commit the number is the right step.Non-blocking:
sh tools/conformance.sh --filter encoding-capsule-text-pair --update-budgetson linux x86_64 and commit the count, as the PR body says.