git
The git system is a repository that a task has checked out. The runner fetches the repository
from the forge into the task’s workspace, on a branch of the task’s own. The verbs of git act
on the remote. The runner performs them with its credential, and the task never holds it.
What a charter sees
iod git writes a repository’s refs, its head and its commits into the store:
| Address | What it is |
|---|---|
git.<repo>.ref.<name> |
a branch or a tag: its sha, the tree of each directory the iod names, and an annotated tag’s trailers |
git.<repo>.head |
where the repository’s checkout stands, and whether it is dirty |
git.<repo>.commit.<sha> |
a commit: its message, author, parents and trailers |
A rule reacts to a ref that moves as it reacts to any data:
condition: subject: path: "git.app.ref.main" on: {sha: changed}
iod git has the flags and the whole payload.
What a charter writes
Refs. With -out, the iod carries a rule’s writes back to the repository. A rule writes an
input under git.<repo>.out, and the iod makes the tag or moves the branch. The iod also
installs the charters that a tree holds
(the out half of git). So a rule can tag a commit
that passed, or move a branch forward, with no task.
What a task can do
A task gets a repository with a git block in its environment. The runner checks the
repository out from the branch that from names, onto a branch of the task’s own. The block’s
verbs say what the task may do with it, and its push shapes which pushes are within reach; a
push no shape matches is refused before any row is read. The autonomy then decides among what
the environment gives:
spawn: agent: {name: viff} prompt: "Make the failing check on $[subject.ref] pass." environment: systems: network: {mode: open} git: - repo: acme/app from: main fetch: {} push: - {ref: !glob "refs/heads/viff/auto/*", exists: false} - {ref: !glob "refs/heads/viff/auto/*", own: true} autonomy: - {then: allow}
Two of a push’s fields are the runner’s to fill, from the forge: exists, whether the branch is
there before the push, and own, whether its tip is a commit this task made (every commit a
task delivers carries its trailers). They are how a shape keeps a task to its own branches: the
first shape above gives a branch the task makes, the second one it made, and another task’s
viff/auto/* branch is neither, so a push onto it, a rewrite of it or its deletion is outside
the environment. A push to main is too, since no shape names it. A shape with no exists or
own gives by the ref alone, so {ref: !glob "refs/heads/viff/auto/*"} lets a task push onto every
task’s branch. A task that retires the branches that landed is given
{ref: !glob "refs/heads/viff/auto/*", delete: true} for that reason: the branches it deletes are
other tasks’.
A git block that names no verb gives every verb of git, any call: every push, forced or
deleting, of any branch. A charter that ships writes its push shapes instead.
| Tool | What it does | Step |
|---|---|---|
git-push |
pushes the task’s committed work to a branch of the remote, or deletes a branch there; fast-forward unless force, and a branch this run created is its own to rewrite |
git.push, with repo, from, ref, delete, force, and exists and own, which the runner fills |
git-fetch |
updates the checkout’s view of the remote: the mirror/* refs and the tags move, and nothing of the task’s own is touched |
git.fetch, with repo and from |
A push sends what the task committed, and nothing it left uncommitted. Each commit carries
trailers that name the task. The runner first puts the work in its own mirror, so a push that
does not reach the remote is tried again, not lost. In a row, repo is the repository as host/owner/name in lower
case, from is the branch the checkout started at, and ref is a full ref such as
refs/heads/main, however the spawn wrote them. A pattern on a field is a tony one:
!glob "refs/heads/*" is every branch, since a glob’s * stays within one /, and
!regexp "^refs/" is every ref. A script calls the same
tools with viff-call-tool, and the same rows decide them. The trailers a commit must end with
are in its environment as VIFF_TRAILERS, the lines a commit message’s last paragraph holds, so
it commits with git commit -m <subject> -m "$VIFF_TRAILERS". A trailer naming another task or
person is refused at the push.
Where the credential lives
The iod needs no credential for a repository on disk. For a mirror of a private remote, it uses the git credential that git finds where the iod runs.
The task holds no credential. The runner fetches and pushes from its own mirror, with its
token for the forge, which it reads from GITHUB_TOKEN.
The operator sets a limit on what any task may push, in the runner’s configuration, under each doer whose tasks may use it. A repository on another forge than the runner’s is refused.
repos: mirrors: /var/lib/viff-runner/mirrors agents: claude: systems: git: ceiling: - repo: !regexp "^github\\.com/acme/" fetch: {} push: {ref: !regexp "^refs/heads/viff/"}
Viff refuses to install a spawn whose environment gives a push beyond the ceiling, every shape
within one of the ceiling’s, saying what the ceiling gives. A ceiling lists what it allows, so
!regexp "^refs/heads/release/" is beyond this one, written nowhere. A row wider than the environment installs:
what is fixed at install is that the task has git.push at all, and each push is decided at the
act, by the row and then by the ceiling, which the runner reads again
(the viff runner).