gunk-dev/the-valley

approve.txt

sourceca98fdc29fbfmain's published tip history
9.1 KiB
1usage: valley approve [-v] [--head <sha>] [--build-here] <change>
2
3 approve [-v] [--head <sha>] [--build-here] <change>
4 do what review's [a]pprove does for the change, without
5 paging it: the same checks, the same refusals, the same
6 leased request write and the same output. exits non-zero
7 when it refuses. a change with a record is approved at
8 exactly one head, and its request is filed as
9 refs/the-valley/integration-requests/main/c-<change id>,
10 at that head:
11 --head SHA approve exactly this head, which must be
12 one of the record's version heads,
13 active or not. a front end passes the
14 head it showed, so a record that moves
15 after review cannot change what lands.
16 without --head, approve shows the active version's head
17 and title and asks to confirm them, on a terminal; off
18 one it refuses. a branch no record is on is approved at
19 its tip on origin, which --head must name if it is
20 given (review's [a]pprove files the head it showed, and
21 refuses once the branch on origin has moved off it), under
22 the branch's request name: the branch with
23 each / replaced by -. a branch whose request name would
24 be c-<change id> is refused, since that name is the
25 change's.
26 approve first reads the evidence origin holds for that
27 head's tree, refs/the-valley/attestations/<tree>/*, byte
28 for byte. it judges each required nix check by the note
29 the integrator judges it by: the first, in ref order,
30 that attest verify accepts under the known-signers file
31 the host publishes. it reuses that note when it is pure
32 evidence for the check's name and flake attribute and
33 says it passed. VALLEY_KNOWN_SIGNERS, when set, must
34 accept it too: it can narrow what is reused, never widen
35 it. a required nix check whose judged note records a
36 failure refuses the approval, since the integrator
37 judges the check by that note. a command check is never
38 reused. a listing or a fetch of
39 origin's evidence that fails is refused, and nothing is
40 run.
41 a required nix check that origin holds no evidence for
42 does not stop the approval. approve files the request at
43 once, with the evidence origin holds, builds nothing,
44 and publishes no evidence for that check. required
45 command checks still run first, and a missing signing
46 key, a failed check, or a refused push still fails the
47 approval. approve says the approval is recorded and
48 how many checks it waits for. the integrator keeps the
49 request and considers it again when evidence is
50 published. landing still requires a clean apply and
51 acceptable evidence for every required check. an
52 enabled worker that serves the project attempts the nix
53 checks of a ready change's active version, but cannot
54 add checks to its own existing evidence ref for the
55 same tree, and a failed build publishes nothing. waiting
56 does not ensure the evidence will be published. no
57 worker builds a branch no record is on, or a version
58 that is not the active one, and approve says so and
59 offers --build-here. the
60 evidence of an approval that ran a command check
61 occupies this signer's ref for the tree, so use
62 --build-here on the initial approval.
63 --build-here build those nix checks on this
64 machine instead, and publish their
65 evidence with the request.
66 approve runs every command check, and every nix check
67 it builds, over a throwaway worktree of that head, signs
68 each result as an attestation, and publishes the new
69 evidence and the request ref to origin in ONE atomic
70 push. when every required check is reused, nothing
71 runs, no signing key is needed, and the push carries
72 the request alone.
73 this files the request; it does not wait for
74 integration or update your local checkout. use status to
75 read the result. the policy comes from the target's tip
76 and the owning valley's, as checks describes (valley help
77 checks), so your checkout can be on any branch. a change
78 the policy requires no check of is filed too, as a
79 request with no evidence, and says so. approving a
80 change already requested is how it is filed again: at a
81 head rebased onto a moved main it replaces the request
82 ref under a lease and names the head it replaced; at the
83 same head it leaves the ref alone and publishes only the
84 new evidence. origin already holding this signer's
85 evidence for that tree, without a check that still has
86 to run, is refused before anything runs: approve
87 publishes a signer's evidence for a tree once, as a
88 ref of the new notes alone, and origin keeps every
89 note the ref holds (bd-7b7d58f). every
90 write of the request ref
91 is leased, filing included, so an approval that lost a
92 race is refused rather than clobbering the one that won.
93 needs the attest helper whenever a check is required,
94 and VALLEY_ATTEST_KEY, the ed25519 key this host signs
95 with, whenever a check has to run here;
96 VALLEY_ATTEST_NAME is the name it signs under,
97 defaulting to this host's. approve never writes the
98 protected ref: the integrator does, having judged the
99 request.
100 approve refuses, before any check runs, a head that does
101 not fast-forward from main and would bring a version of
102 another change that has not landed: a layer above the
103 bottom of a stale stack. the refusal names the command
104 that rebases the stack, valley rebase <change>. this is
105 the project's choice, not a rule the integrator needs:
106 approved as it is, the stack would land as one commit
107 recorded against this request alone, so the changes
108 under it would have no landing record of their own, and
109 the checks would run over a head that has to be rebased
110 anyway. a stale head with no change under it, such as
111 the bottom layer of a stack or a change alone, is
112 approved as it is, and the integrator merges it onto
113 main.
114 approve ends in one verdict line: the change, whether
115 it was approved, and what happens next, with one
116 indented line under it only when you must act:
117 ✓ nqyw v3 approved · checks passed · landing on main
118 ◐ nqyw v3 approved · lands when 3 checks pass (1/4 passed)
119 ◇ nqyw v3 approved · waiting for 2 checks (no worker building)
120 run: valley approve --build-here nqyw
121 ⊘ nqyw v3 not approved · change is a draft
122 run: valley ready --change <id> <branch>
123 a refusal goes to stderr. checks built here show one
124 line of progress, and a failed check's log. the glyphs
125 are in colour on a terminal unless NO_COLOR is set.
126 -v, --verbose also print what approve read and
127 published: the checks it reuses and who
128 signed them, the tree's digest, the
129 evidence and request refs, and the
130 checks' own output and timings.
131 approve times each required check it runs, and
132 appends one JSON line per check to the timing log,
133 $XDG_STATE_HOME/valley/timings.jsonl (default
134 ~/.local/state/valley/timings.jsonl). the log stays on
135 this machine and is not evidence; a log that cannot be
136 written is a warning, and approving goes on.