Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Part C

Part C. Profiles

Parts A and B do not change to admit a profile.

C.1 The place

profilematerializerelease
git worktree: a detached worktree, nothing run in itgit worktree add --detach at the candidate; a block of ports held for the place on the host, each checked freethe checks’ process group ended; the policy’s release command run in the place under the checks’ executor, removing what the checks handed to another process, a container engine’s containers above all; git worktree remove; the ports let go
container: a clean checkout of the candidate in a container on the executing hostthe candidate fetched and checked out into a new container’s filesystem, with the environment the repository declaresthe container and everything started in it removed

C.2 The check

profileaffectedrun
moon: the repository’s task runner with declared inputs and a content-keyed cachemoon’s affected projects between the branch’s revision and the candidate, downstream dependents includedmoon’s run of the affected check tasks in the place; the run report gives each task’s outcome and whether it was replayed, the run record gives its hash as the key and its exit code
script: one command with an exit codeevery check, alwaysthe command’s exit code, never a replay
executor profileexecuteenforces
open: a process group on the instance’s hostthe command in the place, as one process group ended with its runthe cores given, by the runner’s own threads; nothing else; never confined
sandbox: the host’s kernel sandbox, Seatbelt on macOS, bubblewrap and Landlock on Linuxthe command in the place under a profile that allows writes only to the place and its scratch, the network only as the policy says, and a container engine’s socket only when the policy allows itpaths and network everywhere; cores and memory only on Linux, by a cgroup the run is started in; confined when no session on the host can write the place and the run cannot reach a container engine, whose containers may mount any path
container: a container engine on the executing hostthe place mounted into a new container from the repository’s imagecores, memory, paths and network; confined as C.8 says

C.4 The branch

profileread / form / commit / move
local refs: one host’s repositorygit rev-parse; git merge-tree --write-tree; git commit-tree with the branch and the head as parents and the verdict as Sluice-* trailers; git update-ref with the expected old value; making a branch git update-ref <branch> <rev> "", removing one git update-ref -d <branch> <expected> (104, 105); branch protection by a reference-transaction hook that refuses any update to a branch in the policy not made by sluice, and logs it (1)
pushed refs: a branch on a remote every host reachesgit fetch then git rev-parse of the remote’s branch; forming and committing as local refs, on the host advancing the branch; the landing a push with --force-with-lease=<branch>:<expected>; making a branch a push leased on its absence, --force-with-lease=<branch>:, removing one a --delete leased on its revision (104, 105); branch protection by the forge’s rules, restricting creating, updating and deleting the branch, which only sluice’s identity bypasses (1)

C.5 The driver

profilesubmit / withdraw / state / notify / forecast
worktrunk: a custom subcommand on the pathwt submit, the executable wt-submit on the path, waiting for the entry’s outcome, which it reports as its exit, or with --no-wait returning the entry at once; wt submit --withdraw; wt submit --status; the outcome of a waiting submit is its exit, of any other the session’s pane prompted through the multiplexer; on landing, worktrunk removes the session’s place; wt submit --check, the same forming as a submission with no entry written
crew: a bolt team’s stagesthe unit’s merge stage submits, and a bolt is submitted from its own place by its conductor; sluice amend sets an After the conductor adds; the conductor reads the entry’s state as the stage; a red or a conflict re-charges the unit’s slot; the conductor’s wait runs a forecast for each unit in code and tells the unit’s agent of a conflict when it is idle
flywheel: the machinery’s effectsa session’s done exit, once approved, is the submission; the entry’s state is evidence; a forecast is evidence on the item, read each tick
branch: sluice branchnot a session’s: sluice branch create <branch> --from <branch> makes a branch at the other’s current revision and prints it (104); sluice branch delete <branch> --into <branch> removes it, main when --into is omitted (105); each exits 0 when done, 1 when a branch it names does not exist, and 2 on a refusal, naming it
remote submit: a session on any hostthe head pushed to the remote and the submission written through the records (peers) or sent to the server (central server); withdrawal the same; state read through the records or from the server; a waiting wt submit polls it until the outcome; a forecast through the records or from the server

C.6 The records

Whatever binds them, the records are one JSON document per entry and one JSON Lines log of check runs and verdicts per branch (53), and what outlives them is the trailers each landing commit carries (23).

profileread / write
local files: one hostthe documents under the repository’s common git directory, one directory per branch and one log of check results per repository (69), readable by every place on the host with no process running, never tracked and never pushed, a version kept beside them; a write under the branch’s lock, refused when the version moved
remote refs: peersthe records as one tree committed under refs/sluice/<branch>/records on the shared remote; a write is a push with --force-with-lease from the commit read
server: a central serverthe server’s local files; other hosts read and write only by asking the server

C.7 Policy

A branch’s policy is a TOML file checked into the repository, one table per pattern of branch names, read from the branch’s revision (56).

C.8 Deployments across hosts

Two ways of running sluice on many hosts, each a choice of profiles and neither a change to Parts A and B.

peersa central server
profilescontainer places on any host; pushed refs; remote submit; remote refs recordscontainer places on the server; pushed refs; remote submit; server records
who advances a branchwhichever host’s sluice wins the write (58, 62); another takes over when it stopsthe server, always
where candidates runany host with room; an executor claims a candidate by a write to the recordsthe server’s executors
a host stopsits claims and its lead pass to others (59, 60)a session’s host: nothing changes; the server: every branch stalls and loses nothing (59)
confinementa container on a host that runs sessions is confined only if no session there can reach itthe server runs no sessions, so its executors are confined
what is new to runnothing but sluice on each hosta server process the operator starts, whose listener belongs to its driver profile, never to the core

The task runner’s cache makes either cheaper and neither depends on it.