Policy lab 45 bonus XP

Gate production deploys in the pipeline

Objectives

The pipeline already has a policy step, and the release engineer insists it works: "nothing ships without approval". Last week a deploy went out approved by the person who wrote it, and another shipped with the test stage skipped.

Extend the gate so production deploys are denied when they lack an approval, when the approver is the author, or when tests did not run, while leaving staging and clean production deploys alone.

Deploy events the gate will see

#  env      approved  approver_is_author  tests     signed
A  prod     false     false               passed    true
B  prod     true      true                passed    true
C  prod     true      false               skipped   true
D  prod     true      false               passed    true
E  staging  false     false               skipped   false

A, B and C must be denied. D and E must ship.
Fields arrive on input with exactly the names above.

Checks the server runs (5)

  • Rules parse as deny blocks
  • Unapproved production deploys are denied
  • Self-approved deploys are denied
  • Deploys with skipped tests are denied
  • Clean prod and staging deploys still ship

Check names are all you see here: the expectations that decide pass or fail, and the reference solution, stay on the server.

Step-by-step hints

The guided walkthrough, in full. It is free: no XP cost, and it does not touch the paid hint ladder or the reveal gate.

  1. Step 1

    Re-read the brief and name the trap

    "Nothing ships without approval" was true of the one shape the gate already knows. Two other shapes reach production with an approval field set to true and are still uncontrolled.

  2. Step 2

    Read the fixture as a truth table

    Five events, three denials, two that must survive. For each denied event, find the single field that distinguishes it from event D: that field is the body of its block.

    Event E is the over-denial trap: almost everything about it looks bad, and none of it is this gate's business.

    Rules parse as deny blocks

  3. Step 3

    Keep every block environment-scoped

    The starter block already carries the environment condition. Ask why: without it, a staging deploy with the same shape would fail the pipeline for a rule that only governs production.

    Carry that condition into every block you add.

    Clean prod and staging deploys still ship

  4. Step 4

    The two new denial shapes

    One event has an approval that came from the change's own author: a single boolean field records that, and it is not the approval flag.

    The other reached the deploy stage with the test stage in a state other than the one that means they ran and passed. Compare against that expected state rather than enumerating the bad ones.

    Give each block a message naming its own reason, since that string is what the engineer sees when the build stops.

    Unapproved production deploys are deniedSelf-approved deploys are deniedDeploys with skipped tests are denied

  5. Step 5

    Run and read the failures

    If the scope check fails you either dropped the environment condition or added a condition about signing, which no event in the brief asks you to enforce.

Rules summary

  • XP on pass

    45 bonus XP the first time every check goes green.

  • Paid hints

    2 available. Each costs 25% of the lab XP (about 11 XP).

  • Reveal solution

    Scores 0 XP and unlocks only after 3 check runs.

  • Attempt cap

    60 check runs per learner. The runner warns you in the last 10.

  • Drafts

    Your editor content is saved in this browser, so a reload will not lose work.

  • Walkthrough

    Always free and never penalised: use it before spending a hint.