Skip to content

Ask for an approval

Make a change wait for a person's approval with af require, see what a change is waiting for with af change, and approve one with af approve-change.

A change lands as soon as it meets its landing requirements: by default, its checks pass on runners against exactly the commit that lands. When a change should also wait for a person, anyone can ask for one with af require: an agent unsure of what it wrote, or an approver who wants to see a change before it lands. The change then waits, submitted, until that person approves the commit it would land.

Ask for a person

Start a server and begin a change:

$ af-server --dev
...
$ source ~/af-dev/dev/env
$ af workspace add ~/demo
Workspace at /home/you/demo
Paths: **
main has no landing yet
$ cd ~/demo
$ af new -m "Change the retry limit"
Working on change lqmpyryommrquqmrmxyztzzqpvzswluz at commit da3238744c7ecd7a2fd0123407f58b09973dab152110e7f590f4bac803b4b16f
$ printf 'retries = 5\n' > limits.toml

af require takes the change, by its ID, the start of it that af log shows, or @ for the workspace’s change, as in jj, and the reason, which is recorded with the requirement. With --person, only that person’s approval meets it; without, any approver’s does:

$ af require @ --reason "a limit the on-call team owns"
change lqmpyryommrquqmrmxyztzzqpvzswluz now waits for that approval

Like every command that takes @, af require snapshots your files first, as jj does before every command, so the edit is already in the change it asks about. Submit it, and af change says what it waits for:

$ af submit
Submitted commit bb9e72336ae29371cb3f004ccc9b0c738557bf217f2a51474f5b87ffa48a2f68, 0 edits in its last snapshot
$ af change @
state:     Submitted
latest:    bb9e72336ae29371cb3f004ccc9b0c738557bf217f2a51474f5b87ffa48a2f68
submitted: bb9e72336ae29371cb3f004ccc9b0c738557bf217f2a51474f5b87ffa48a2f68
may land:  no
waits for: approver

The change stays submitted, its place in line kept, while it waits. Nothing about it is lost: once the approval comes, the forge tries the landing again on its own.

Approve a change

An approver approves the change’s latest commit, by its ID:

$ af approve-change lqmpyryommrquqmrmxyztzzqpvzswluz
approved commit bb9e72336ae29371cb3f004ccc9b0c738557bf217f2a51474f5b87ffa48a2f68 of change lqmpyryommrquqmrmxyztzzqpvzswluz

An approval is a signed statement by one person about one commit, kept in the receipt log, and the landing’s receipt names each approval that counted. Two rules make it mean something:

  • It is about one commit. Approving a change approves the commit it is at. If the change moves on, with a new snapshot or a rebase onto another landing, it waits again for an approval of the new commit, so what lands is what was approved.
  • An approval from the change’s own line counts, its author’s or the person’s at the root of the agents that wrote it, unless the forge requires another person (af-server --two-administrators); then none from the line counts. Every compliance report lists each approval from a change’s own line as an exception. An agent never approves: an approval is a person’s, through their sign-in.

On a --dev server you are its only person: grant yourself the approver role, and your own approval lands a change that waits for one.

Changes to the tests that gate landing

A change to anything under .forge/, where the checks that gate landing are configured, waits for a person’s approval without being asked, so no change edits the script that judges it without one. A change’s own code still runs in its check: a pass shows it broke nothing the tests catch by mistake, not that it did not cheat on purpose. See Testing and landing.

Next

Type to search…

↑↓ navigate↵ selectEsc close