feat(package): read manifest sources and registry URLs as Uri, and lock the canonical text #216
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/26-uri-manifest"
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 #26
URI slice 9 (docs/design/URI.md), option A as decided on the issue.
What changed
registry "...", url:withhttps:orhttp:is read as aUri(registryUrlOfincompiler/src/project/manifest.trb) and kept as the canonical text ofuri.normalized(): lower-case scheme and host, no default port,/for an empty path.publicRegistryis nowhttps://packages.torb.dev/.file:registries keep the relative directory as written, becauseUriresolvesfile:../registrytofile:registry.git:andarchive:locations are parsed intoSourceBinding.uri, aUri?that isNoneforpath:.path:stays a directory.locationProblemsOfadds aManifestProblemat the string literal for a registry URL that is no URI or is neitherhttps:norhttp:, and for agit:/archive:location that is no URI. It runs as part ofmanifestProblemsOf, sotorb checkreports--> project.trb:line:col. The package commands (contextOfincompiler/src/cli/packages.trb) refuse the first one before anything is fetched or written.readLockreadsregistry:throughregistryUrlOf, so a lock from before this change (https://packages.torb.dev) is the same registry. It gives no mismatch against the binding, andtorb lockwrites it once in the canonical form.torb lock --checkfails on an old lock until that rewrite is done. No lock in this repository has anhttps:registry, so nothing here needs rewriting.Decisions
String. The receiver types ofRegistry/SourcestayString. Afile:registry is noUri, and the checked-literal rule would refuse it. The toolchain's static reader does the URI reading, which is where the errors with a place come from anyway.RegistryLocation.Webstill drops the trailing/, so cache keys and paths stay the same. The shipped-key comparison inwebRegistryKeysignores a trailing/on both sides.Uri.text(), not the password-redactingshow(), which matches the previous as-written behaviour. Messages useshow().git:/archive:yet. They are still not resolved or locked. The parseduriis there for the resolver when it lands.std/uri. So no two-commit split is needed.Tests
compiler/tests/project.test.trbfile:kept as written.path:asNone.ftp:, a scp-stylegit@host:x.git, a relative archive.project.trb:3:23.compiler/tests/packages.test.trbpublicRegistry, renders ashttps://packages.torb.dev/, and rendering again is stable.file:is untouched.Docs
Follow-ups
git:andarchive:sources, usingSourceBinding.uri.Uri(URI slice 9) #26Checklist at
3bc8c81(CI combined status success: tier A, bootstrap, playground, pdisc, every-host-same-C).file:as written, source URIs withpath:asNone, the problems (bad host,ftp:, scp-stylegit@host:x.git, relative archive), the string-literal span, the workspace problem atproject.trb:3:23, and the old-lock read/rewrite/stable-rerender round trip.registryUrlOfis the single reader used by the manifest, the lock and the problem check.RegistryLocation.Webstill drops the trailing/, so cache keys and paths stay the same, and thewebRegistryKeyscomparison now ignores a trailing/on both sides, so the shipped key still matchespublicRegistry. A pre-change lock reads as the same registry, so there is no binding mismatch. No lock in the repo has anhttps:registry.std/projectreceiver types are deliberately unchanged.text(), as before, and messages useshow(). The lock format changes only by the trailing/, with a documented one-time rewrite (torb lock --checkfails on an old lock until then).Non-blocking:
locationProblemLinesand the early refusal incontextOf(compiler/src/cli/packages.trb) have no direct test; the covered path ismanifestProblemsOfviafindWorkspace. A CLI-level case ("torb lock refuses a bad registry URL before any fetch") would pin the claim in the PR body.webRegistryKeystrailing-slash handling has no dedicated test; the shipped-key lookup forpublicRegistryis the case worth asserting.