Delivery: A Repeatable Release · 25 min · free lesson

Make Checks Block Delivery

Require all declared release checks.

Core idea

An absent or failed required check cannot be treated as a green release.

Diagram for Make Checks Block Delivery: a Rust code example flows to the lesson rule and the key observation.
The worked implementation exercises require all declared release checks. Its tests demonstrate the stated finite contract.

Understand it

A reproducible release pipeline connects source checks to a specific revision. Formatting, compilation and tests answer different questions. A successful build does not establish that tests ran, and a test job from an older revision does not approve newer source.

The release policy requires fmt, test and build exactly once with successful results; extra unrelated checks may be present. Duplicate required records are ambiguous and should refuse delivery rather than choosing whichever result looks better. This lab models gate aggregation, while the companion workflow runs the actual commands in a clean checkout with Cargo.lock retained. The iOS terminal runs its supported Cargo profile; the desktop CI workflow exercises the server target, SQL migrations and integration requests. Keep those receipts separate instead of claiming one target qualifies the other.

The route project is Task Ledger: first keep a reproducible source history, then expose its data through a CLI and HTTP boundary, persist it in SQL, diagnose failures and prepare a release. This lesson owns one contract in that project. Run the worked example before changing the starter and explain which input makes the tempting shortcut fail.

Terminal practice: Run cargo fmt --check, cargo test and cargo build. Inspect the companion GitHub workflow for desktop integration checks.

The compiler lab is independent of the reading question. Edit solution.rs; the app supplies a separate caller with normal, empty and adversarial inputs. A successful unchanged demonstration does not prove your implementation. After the lab, apply the same contract to the route companion project. Its README separates the on-device adapter from the desktop Cargo/TCP profile.

Read the code

pub fn release_ready(checks: &[(&str, bool)]) -> bool {
    ["fmt", "test", "build"].iter().all(|required| {
        let rows: Vec<_> = checks
            .iter()
            .filter(|(name, _)| name == required)
            .collect();
        rows.len() == 1 && rows[0].1
    })
}

fn main() {
    assert_eq!(
        release_ready(&[
            ("fmt", true),
            ("test", true),
            ("build", true)
        ]),
        true,
        "case 1"
    );
    assert_eq!(release_ready(&[]), false, "case 2");
    assert_eq!(
        release_ready(&[
            ("fmt", true),
            ("test", false),
            ("build", true)
        ]),
        false,
        "case 3"
    );
    assert_eq!(
        release_ready(&[
            ("fmt", true),
            ("test", true),
            ("build", true),
            ("test", true)
        ]),
        false,
        "case 4"
    );
    assert_eq!(
        release_ready(&[
            ("fmt", true),
            ("test", true),
            ("build", true),
            ("docs", false)
        ]),
        true,
        "case 5"
    );
    println!("worked example passed");
}

The worked implementation exercises require all declared release checks. Its tests demonstrate the stated finite contract.

Practice starter

pub fn release_ready(checks: &[(&str,bool)]) -> bool {
    todo!("implement the contract")
}

Open local example in Playground ↗

Try it

Require exactly one successful result for each of fmt,test,build. Missing, failed or duplicate required results refuse release; unrelated checks do not affect this contract. Keep the public signature. Open the compiler lab and edit solution.rs; do not edit the private verification caller.

What success looks like: The separate caller accepts the changed solution and rejects unchanged TODO, a wrong implementation and a printed success message.

Check your understanding

Does a successful build prove that the test job ran?

Reveal the answer
  1. Yes, building automatically runs every test
  2. A missing check should default to success
  3. No, it is a separate required observation

Compilation success and independently executed tests provide different evidence.

Go deeper

Common misconception: Yes, building automatically runs every test

An absent or failed required check cannot be treated as a green release.

  1. Identify the boundary: Require all declared release checks. Write down its accepted inputs and observable output.
  2. Exercise the failure: Compilation success and independently executed tests provide different evidence.
  3. Check the independent caller: Require exactly one successful result for each of fmt,test,build. Missing, failed or duplicate required results refuse release; unrelated checks do not affect this contract.

Transfer challenge: Apply this contract to Task Ledger, introduce the failure described in the lesson, and show the failing check before fixing it.

Connections

  • Bound the Retry Budget: Retry transient failures within attempt and time limits
  • Validate Before Starting the Service: Reject invalid deployment configuration