Close the four earlier lessons and work from this brief. The workspace has
an executable case table but an unfinished run function. Complete the rule
before looking at the solution. Twenty-four minutes is a suggested first pass;
split the work across sessions if you need more time.
The brief
Before the deploy pipeline promotes a new build of the Review Queue, it asks a
release gate: may this build go to production? This isn't the readiness
probe from earlier today. Readiness is asked of every running instance, every
few seconds, and must answer from what that instance can see right now. The
release gate is asked once per deploy, by the pipeline, and can depend on
slower evidence gathered for that deploy:
schemaMatches: the database's schema version is the one this build expects
(the migration from today's lesson has run).
probePassed: a smoke test against the new build, on a staging copy, passed.
restoreVerified: the latest backup was restored somewhere and checked. A
backup that has never been restored is a hope, not a backup.
Return { release: true, blockedBy: [] } only when all three are exactly
true. Otherwise return release: false and list every failed check in
blockedBy, in the order "schema", "probe", "restore", so the pipeline
can tell the person deploying what to fix. A missing field is a failed check.
Keep the function deterministic and leave its input unchanged. In the real
project this rule would run in the pipeline script or a protected route
handler that the pipeline calls; the table is a contract harness, not a
substitute for testing that transport.
Add one case of your own to examples: the least convenient input you can
think of, such as an empty list, a missing field or a repeated value. Work out
its expected result before you run it. The table's Input kept column must
say yes on every row: the rule may not change what it was given.
Runs with real Next.js on your computer: unzip, then npm install and npm run dev.
Hint 1: the idea
release is derived from blockedBy, not computed separately: if the list of
failed checks is empty, the build may go. Computing both from one list means
they can't disagree.
Hint 2: a first step
Write the three checks as data: pairs of a name and an input field, in the
required order. Then keep the names whose field isn't exactly true.
Runs with real Next.js on your computer: unzip, then npm install and npm run dev.
The checks are a list of [name, field] pairs, so their order is the order of
blockedBy, and adding a fourth check is one line. input[field] !== true
treats false, a missing field and a truthy string like "yes" all as failed:
the gate opens only on evidence. filter and map build new arrays, so the
Input kept column says yes.
Before the next day
Which layer owns this decision, and which layer translates it for the reader?
What happens on the least convenient input, not only the happy path?
What would you test in a real browser or server that this pure function
cannot establish?
Completion is saved in this browser only. It does not measure mastery.