refactor(docs): classify link targets through UriReference #158
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/134-docs-check-uri-reference"
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 #134
What
pageLinkProblemsincompiler/src/documentation/links.trbno longer tests a link target withstartsWith("http://"),startsWith("https://"),startsWith("mailto:")andstartsWith("/"). It reads the target withUriReference.tryFromand classifies it:https://,mailto:, and anyscheme:rest);/gives the existing "is absolute" problem (//host/xstays an error, as before);normalizePath(joinDocumentationPath(...))).This is option A of the owner decision recorded on #134 (comment 374):
UriReferenceclassifies, the join stays path-based, no synthetic base. URI.md slice 10 (and the migration table row) is amended in this PR to say so, and marked done.Behaviour
Unchanged for every target the existing tests cover (same text, same line). Differences, all from the owner decision:
scheme:rest(e.g.foo:bar.md) is now external and skipped; it used to fail as a path that is not a page.UriReference.tryFromrefuses (e.g.my%file.md, a bad escape) keeps the path check and gets no new diagnostic. Note that such a target is now path-checked even when it starts withhttp://or/; markdown link destinations rarely refuse, anddocs check docsreports no new problem on this repository.Tests
New in
compiler/tests/documentation.test.trb(group "the links"): a scheme is external whatever it is (mailto:,foo:bar.md,https://),//host/xis absolute, a refused target is checked as a path.Seed
Does not touch the seed: library use only (
std/uriis in the fixpoint since slice 7).Verification
The worker host has no C compiler, so the gates ran in a resource-limited
gcc:14container (4 CPUs, 10 GB), removed afterwards.torb test --native compiler/tests/documentation.test.trb: 109 passed, 0 failed (built with the published seed). Result ofsh tools/gates.sh afollows in a comment; the forge CI of this PR is the authority for the rest.3c43e8e4394f38795417Gates (worker host has no C compiler, so they ran in a
gcc:14container with 4 CPUs / 10 GB, removed afterwards):sh tools/gates.sh aon the first push was green exceptformat --check(two spots the formatter wants without parentheses). Fixed in4f387954; afterwardsformat --check .reports 0 of 1105 files would change andtorb test --native compiler/tests/documentation.test.trbis 109 passed, 0 failed. The other tier A gates (bootstrap, checks,compiler/testssuite, docs check/index/skill/site, packages, lock) were green on the previous push; the formatting fix changes layout only.tools/check-commits.sh origin/main HEADis clean (one commit). Tier B is not run locally (no IR/backend/runtime change); forge CI is the authority for the rest.Approved at
4f38795. Checklist://host/xis absolute, a refused target is path-checked); existing link tests unchanged. CI green on this head (tier A, bootstrap, pdisc, commit messages, gates).UriReference.isAbsolute()is "has a scheme", sohttps:,mailto:andscheme:restare skipped.isRootedcovers an authority or a path starting with/. TargetstryFromrefuses (bad escape,1a:b) becomeNoneand keep the old path check. The empty-target and join paths are untouched.std/uriis already in the fixpoint), no seed change.Non-blocking: a refused target that starts with
http://or/is now path-checked rather than skipped or reported absolute. The PR body already notes this anddocs check docsis clean, so no action is needed.Approved (review above), but the merge failed:
mainmoved to9e2ab91("docs(random): document std/random ...", which also touches URI.md) after this branch was cut from61d7075, and Forgejo now reports the PR as not mergeable (rebase merge returns 405). Please rebase onto currentmain, resolve the conflict (likelydocs/design/URI.md), and regenerate indexes if needed. The code and test changes were reviewed and need no further change.4f38795417a022d2a8afRebased onto current
main(9e2ab91) asa022d2a8. One conflict indocs/design/URI.md: kept this PR's slice 10 row (done) next to main's new slice 11 row (std/identifier, unchanged from main). Code and tests unchanged (diff of the rebased commit equals the approved one apart from that row).pdisc checkok,check-commits.shok. Re-requesting review for the merge.UriReference(URI slice 10) #134Approved at
a022d2a(re-review after the rebase onto9e2ab91). Earlier approval was at4f38795.4f38795: only thedocs/design/URI.mdconflict resolution (slice 10 row kept as done next to main's slice 11 row).links.trbanddocumentation.test.trbare identical to what I reviewed.Non-blocking: none beyond the earlier note (a refused target starting with
http://or/is now path-checked), already documented in the PR body.