t27.aiРусский

Four phases: idea, build, test, ship

You will learn

Why work goes through four phases in order, and why a failed test sends it back to build and never forward to ship.

Every piece of work with an agent has the same four phases. Idea: you say in one sentence what you want. Build: the agent writes one small piece. Test: you run it and a test says yes or no. Ship: you save it and put it where it is used. The phases are not a straight line. When the test says no, the work goes back to build, not forward to ship, and the loop runs again. The spec of this lesson holds two tables: where each phase goes next when the tests pass, and where it goes when they fail. The player runs its 4 tests. Change one entry of the fail table so that a failed test goes on to ship, and exactly one test goes red.

Try it

Open the widget and walk an idea to ship with one failed test on the way; count the steps. Then in the spec find the entry of the fail table that sends a failed test back to build, change it to 3 and read which test goes red.

Open the interactive lesson →

Four phases: idea, build, test, ship ↗

Walk one idea through four phases. At the test phase press pass or fail: a pass ships it, a fail sends it back to build. Nothing ships past a red test.

specs/vibecoding/four_phases.t27

// SPDX-License-Identifier: Apache-2.0
; specs/vibecoding/four_phases.t27 -- vibecoding lesson: the four phases, idea, build, test, ship
; One idea: work moves through four phases in order, and a failed test sends it back to build,
; never forward to ship. A phase is a number: 0 idea, 1 build, 2 test, 3 ship. The two tables
; below say where each phase goes next, one when the tests pass and one when they fail.
; Run it in the player, then change FAIL_NEXT[2] from 1 to 3 (a failed test goes on to ship) and
; read which test goes red.
; ASCII only, English only.
; phi^2 + 1/phi^2 = 3 | TRINITY

module vibecoding_four_phases;

pub const PHASE_IDEA : u8 = 0;
pub const PHASE_BUILD : u8 = 1;
pub const PHASE_TEST : u8 = 2;
pub const PHASE_SHIP : u8 = 3;
pub const PHASE_COUNT : u8 = 4;

; Next phase, indexed by the phase you are in.
pub const PASS_NEXT : [4]u8 = [1, 2, 3, 3];
pub const FAIL_NEXT : [4]u8 = [1, 2, 1, 3];

test the_phases_run_in_order {
    assert PASS_NEXT[0] == PHASE_BUILD;
    assert PASS_NEXT[1] == PHASE_TEST;
    assert PASS_NEXT[2] == PHASE_SHIP;
}

test a_failed_test_goes_back_to_build {
    assert FAIL_NEXT[2] == PHASE_BUILD;
    assert FAIL_NEXT[2] != PHASE_SHIP;
}

test shipped_stays_shipped {
    assert PASS_NEXT[3] == PHASE_SHIP;
    assert FAIL_NEXT[3] == PHASE_SHIP;
}

test three_steps_from_idea_to_ship {
    assert PASS_NEXT[PASS_NEXT[PASS_NEXT[0]]] == PHASE_SHIP;
    assert PHASE_COUNT == PHASE_SHIP + 1;
}

Open the lesson's spec in the player ↗

All lessons