package manager: resolve git: sources #322
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Context
Split from #27. A
git:source of a manifest is refused by the resolver ("is not resolved yet"). #27 resolvesarchive:sources and adds the lock rows, resolver and cache plumbing; this issue addsgit:.Source
revision:required; lock pins the resolved commit and the tree hash)Acceptance criteria
git:source is fetched at itsrevision:(tag, branch or commit) with thegitexecutable; the resolved commit and the tree hash of the checkout (without.git) are recorded in the lock aspackage "<name>", git: "<Uri>", revision: "<commit>", hash: "sha256:..."--offlineor a warm cache, no git or network call is madeproject.trbmust equal thesourcenamefile:URL, created by the test), including a tag and a branch revisiongitexecutable gives an error naming it; docs (project-lock-trb, project-trb, PROJECT.md "As built") updated;skills/regeneratedSeed impact
None (ordinary compiler code, no syntax change, native or driver flag).
Dependencies
git:andarchive:sources #27[loop:torbscript] intake: split from #27, in scope (author orion, label loop). Design decisions:
gitis run as an executable like curl/wget (no libgit), the lock pins commit plus tree hash, cache is content-addressed. Refine at the stage where #27 has landed the lock rows, next: waiting (dependency #27)git:andarchive:sources #27[loop:torbscript] claim refine by session:loop-torbscript-20261012 until 2026-10-12T14:08Z
[loop:torbscript] decided by the loop: refinement of the
git:resolver, against the landed #27 (unpackedSource,fetchSourceArchive,LockedPackage.archive,SourceBinding.pin/lockedLocation; the refusal sits incompiler/src/cli/packages.trbat the"git"kind of the source match).package "<name>", git: "<Uri>", revision: "<commit>", hash: "sha256:..."as in the acceptance criteria, plusref: "<revision as written>"betweengit:andrevision:only when the written revision is not the full commit id (tag or branch). Why: thesourceline pins a movable name, the lock pins the commit; withoutref:the build could not tell that asourceline changed from tagv1tov2, which is the mismatch check #27 already does forarchive:. A full 40-hex revision gets noref:. New fieldLockedPackage.git(+ref,commit),isGit(), adescribed()casegit <url> <commit>, and the same mismatch rules asarchive:(URL, ref, or hash differs from thesourceline).gitas an executable throughProcess.runBlocking(no libgit), in a scratch directory under the cache:git init,git fetch --depth 1 <url> <rev>(tag, branch, or commit), falling back to a fullgit fetchwhen the server refuses a shallow fetch of that name;git rev-parse FETCH_HEAD^{commit}gives the commit;git checkout --detach. A locked source fetches the locked commit id instead of the written revision.gitenvironment:GIT_TERMINAL_PROMPT=0(never prompt), no submodules (a checkout with a.gitmodulesis fetched without them and documented as such).file:URLs are relative to the workspace root likearchive:..gitis read into the sameTarEntrylist as an unpacked archive and goes through the registry's safety checks andtreeHashof./archive, so agit:tree and anarchive:tree of the same files hash alike. Symlinks and the other things an archive refuses are refused here too. Installed withinstall(cache, hash, entries)under the tree hash;isInstalledfirst, so a warm cache and--offlinemake no git or network call.--offlinereads).project.trbmust name thesourcepackage, as forarchive:; its dependencies join the resolution like apath:package's.vendorleaves agit:package in place andpublishrefuses a package that depends on one, both exactly as forarchive:;torb updatere-resolvesrefto the current commit.git: if the executable cannot be started: "fetching<url>needsgit, and it could not be started";TORB_GITmay name another executable, likeTORB_FETCHdoes for curl/wget.compiler/src/, no syntax, native or driver flag). Size: one PR,feat(package): resolve git: sourcesplusdocs(tooling): git: sources in the lock, similar in size to #27 (about 15 files).Acceptance criteria (refined, all testable offline with local repositories)
compiler/tests/packages.test.trb: the test creates a repository in a temp directory with thegitexecutable (git init, commit of aproject.trband one source file,git tag v1, a branchnextwith a second commit) and afile:URL to it. Resolving withrevision: "v1"gives a lock row withref: "v1", the commit of the tag, and the tree hash;revision: "next"gives the branch's commit; a full commit id gives a row withoutref:.treeHashof the same files packed as anarchive:(the.gitdirectory never counts), and the package is installed in the cache under it.--offline: after removing the repository, the build still resolves from the cache and starts nogit(test setsTORB_GITto a program that fails).--offlinewith no lock row and a cold cache is an error naming the package.project.trbthat names another package than thesourceline is an error naming both.sourceline whoserevision:or URL changed against the lock is reported as a mismatch by the build,lock --checkandinstall, as forarchive:;vendorleaves the package,publishrefuses it.TORB_GITnaming a program that does not exist gives an error that namesgit.tools/packages.shtranscript (tests/packages/transcript.expected): agit-appfixture whose repository the script creates withgit(fixed author/dates so the commit id is stable) covers lock, run,lock --checkand a mismatch; no network.docs/tooling/project-lock-trb.md,docs/tooling/project-trb.md,docs/design/PROJECT.mdsection 7 and 11 "As built" (replace "git:rows are not written yet" and "refused by the resolver"),docs/how-to/add-a-dependency.md;skills/regenerated.Design: PROJECT.md sections 7 and 11 (
revision:required; lock pins commit and tree hash); ROADMAP "the package manager". Depends on #27, which is onmain.[loop:torbscript] refine: done, decisions and refined acceptance criteria recorded above, label ready set, next: implement (opus/high: compiler/src; about 130k tokens used by this worker)
[loop:torbscript] claim implement by session:loop-torbscript-20261012 until 2026-10-12T18:10Z
[loop:torbscript] implement: PR #330 open, forge CI running; the worker was terminated by a gateway restart after opening it. next: waiting (CI running on PR #330)
[loop:torbscript] release implement: PR #330 landed on main (merged by the merge gate); the follow-up worker died of a session limit but its work was finished by a later worker. Nothing left on this issue.