Skip to content
AlbertCode SWE

Module 06 · 12 min

The two gates

The plan and the diff: what each shows, every answer you can give, and how to answer them from a script.

By the end of this module you can

  • Read a plan and a result, and know what each one holds
  • Approve, revise, reject, accept or discard, in the terminal, the browser and VS Code
  • Answer both gates from a script, and know when a change can't be accepted

A governed change stops twice for you: at the plan, then at the diff. Your approval is the main safeguard against a wrong or harmful change, so these are the two moments to read carefully (Security).

Gate 1: the plan

The plan says what will change and why: the goal, the files and how each changes, the steps, the test plan, security points, how to roll it back, and the assumptions it made. Nothing has been written yet.

Where Your answers
Browser Approve and implement or Reject. Or type what should change and send it: a revised plan comes back
VS Code The plan opens in the editor: Approve plan, Ask for changes or Reject
Terminal interface a approve, e revise, r reject. d shows the whole plan

Rejecting discards the task. If the plan is wrong, say what to change before you approve it. That is cheaper than reviewing a wrong diff.

Gate 2: the diff

When the change has been built, tested and reviewed in its isolated copy, you see the outcome: the files changed, the checks that ran and their results, the reviews' findings, and the steps it took.

Where Your answers
Browser Review the diff, Accept into repository, Export evidence or Discard. Or say what is not right, and work continues in the same copy
VS Code Accept changes, Ask for changes or Roll back (discards the copy)
Terminal interface v shows the diff. a apply, e revise, x discard

Two things can stop you accepting:

  • A review blocked the change. Accepting is not offered. Say how to address the findings and Albert works on it again, or discard it.
  • You edited a file the change touches after the task started. Look at your edit, then run the request again.

The gate track

In the browser, each governed task shows its progress as a track. The work is circles and your two decisions are diamonds. A step that is done is green with a tick, the step under way is lit, a step waiting for you is amber, and the step where a task stopped is red. Direct and Ask only have no gates, so they have no track (Chat).

Gates from a script

Every step is also a subcommand:

  • albertcode approve <task> gives approval 1.
  • albertcode accept <task> gives approval 2.
  • albertcode reject <task> rejects the plan.
  • albertcode rollback <task> throws away a change you have not accepted.

albertcode run works in a new session. Without --approve, a governed change stops at its plan and the command exits with status 3, so that a person can read the plan and answer it. --approve takes plan, result, writes or all, separated by commas (Terminal).

Practise

Work both gates

A governed change, waiting for you as the browser shows it. Pick a request, read the plan and answer it, then decide on the diff. This runs in the page and touches no repository.

Illustration

  1. Plan

  2. Approve

  3. Build

  4. Verify

  5. Accept

Pick a request

Albert plans it, and stops. Nothing is built until you approve, and nothing lands until you accept.

Evidence ledger · 0 entriesevery step of a task is recorded, in order

Learn the gate letters

At a gate in the terminal interface, the arrows and Enter choose an answer, or its letter gives it at once. Match each letter to its answer.

Answer both gates from a script

Every step of a task is also a subcommand that prints JSON. This is the guide's own script; it needs jq.

  1. 1

    Create a task, and keep its id:

    TASK=$(albertcode create "Add tests for the billing module" --workspace ./repo | jq -r .id)
  2. 2

    Check its state until it says plan_ready:

    albertcode show "$TASK" | jq -r .state
  3. 3

    Give approval 1, the plan:

    albertcode approve "$TASK"
  4. 4

    When its state says completed, read the change:

    albertcode diff "$TASK"
  5. 5

    Give approval 2, and apply it:

    albertcode accept "$TASK"
  6. 6

    Run it once more and answer the plan with albertcode reject <task> instead: a rejected plan changes nothing.

Check your understanding

6 questions. Answer 5 correctly to complete the module. Checked here, in your browser.

  1. 01Which of these is not shown at approval 1, the plan?
  2. 02At a gate in the terminal interface, which key discards the change?
  3. 03A review blocked the change. What can you do?
  4. 04You reject a plan. What has been written to your files?
  5. 05In a script, which subcommand gives approval 2?
  6. 06On the gate track in the browser, what does an amber step mean?