Workbench / Volume 2 Companion: The Web Frontend
V2·33
Frontend Projects
Companion to Volume 2, chapter 33, the volume's projects: how the eight projects build one product in layers; new angles (a portfolio as a lab notebook, a definition of done as a pilot's checklist, a canary as a food taster); what the chapter simplifies, measured on the build's stage 33: a release 300 ms slower to respond that passed on LCP, the same code measuring 64 to 76 ms at p75 across runs, and a gate that has to say "not enough data"; the theory behind deciding from samples; how Lighthouse CI aggregates runs and why its default forgives; four debugging drills from shipping the volume; interview questions on presenting project work.
Understanding it better
Concept map
Chapter 33 is Volume 2's projects: the working method (one product built up in layers, definitions of done), the eight projects (an accessible static menu site, an interactive cart in plain JavaScript, the ordering SPA, an offline-first PWA, a server-rendered storefront with a performance budget, a small design system, live order tracking, the production pipeline) and tracking progress (a portfolio checklist, mapping to mastery levels).
The links worth remembering:
- The projects are one product. Each adds a layer to the same food-ordering system, so each later project inherits the earlier ones' decisions and debts. That's what makes them closer to real work than eight separate exercises, and it's why the TiffinBox build could map all eight onto its stages (stage 33's table).
- Every project has a test that would fail if it were wrong. The chapter's P1–P8 are each a harness for one project's hardest property: layout and accessibility, money, races, offline, budgets, the design system, resume, the pipeline.
- Done means evidence. A README, tests, a budget, an accessibility pass, a live URL and a written decision: the portfolio is the evidence, not the code alone.
Explain it differently
1. A portfolio is a lab notebook, not a gallery. A gallery shows finished pictures. A lab notebook shows what you tried, what you measured, what surprised you and what you changed: that's what an interviewer or a reviewer can judge.
2. A definition of done is a pilot's pre-flight checklist. Pilots know how to fly; the checklist exists because experts skip steps when they're confident. "It works on my machine" is the confident skip.
3. Building in layers is building a house floor by floor. Each floor must carry the next. A shortcut in the foundation (no contract, no tests) becomes visible three floors up, when changing it means lifting the house.
4. A canary is a food taster. The taster eats first, and the king eats only if the taster is well after a while. Too short a wait, or a taster who only checks one thing (the colour of the food: LCP), and the poison gets through.
5. Noise is the scale's wobble. Weigh the same bag five times and get five slightly different numbers. Until you know how much the scale wobbles, you can't say whether the bag got heavier.
6. "Hold" is a referee waiting for the replay. Not "goal", not "no goal": "we don't know yet". Making the call without the replay is how wrong calls happen.
7. A second stack is a translation. Rebuilding a project in another framework (the chapter's C2) shows which parts were the problem and which were the framework, as translating a text shows which meaning belonged to the language.
Gaps and misconceptions
What the chapter oversimplifies
All outputs are real, from Chromium 153 headless and the build's stage 33 (exp/33-*), unless stated.
1. A budget on LCP doesn't protect a server-rendered page's responsiveness. Project 5's definition of done is a performance budget, usually on LCP and bundle size. Stage 33's canary released a version with 300 ms of extra start-up work in the kitchen script. Its first gate, on LCP, INP and errors, promoted it:
51bcafd6c6 /kitchen/kN count longtasks 25 1.0 1.0 1.0
51bcafd6c6 /kitchen/kN vital LCP 25 56.0 64.0 108.0
c21b4acf7f /kitchen/kN count longtasks 25 0.0 0.0 0.0
c21b4acf7f /kitchen/kN vital LCP 25 68.0 76.0 88.0
(the first run's summary). The server renders the first screen into the HTML, so the browser paints the largest element before the script starts its work; LCP was even slightly better. For 300 ms after that paint the page couldn't respond to a tap. INP would show it only if someone tapped in that window; the long-task count showed it on every view. In a second run the slow release's p95 LCP was 376 ms (sometimes the paint did wait): a regression that appears in one run's tail and not another's median is exactly what a single LCP budget misses. Budget start-up work (long tasks, or Total Blocking Time in the lab) as well as paint.
2. The same code doesn't measure the same twice. The chapter's projects set budgets as fixed numbers. The baseline release, unchanged code, across three canary runs:
c21b4acf7f /kitchen/kN vital LCP 25 68.0 76.0 88.0
c21b4acf7f /kitchen/kN vital LCP 25 64.0 72.0 84.0
c21b4acf7f /kitchen/kN vital LCP 25 60.0 64.0 80.0
p75 from 64 to 76 ms: about ±9% for identical code, on one machine, in a headless browser with no network variation. In the third run, the harmless release (a CSS comment) measured p75 72 ms against the baseline's 64: 12.5% "worse". A threshold tighter than the noise turns every release into a regression. Stage 33's gate allows 1.2× and 50 ms, needs 20 samples per side, and the long-task rule compares counts, which are far less noisy than timings (0 and 1 in every run).
3. Too early, the only honest answer is "don't know". Gated straight after release, before any page views, both candidates got:
too early: 51bcafd6c6 against c21b4acf7f: hold
errors: 0 candidate beacons (need 20)
A pipeline that treats "no evidence of a problem" as "pass" promotes everything that's checked too soon. And the first version of the canary, which gated as soon as its browser had navigated away, read the summary before the last beacons had arrived: it held when it should have decided. A gate needs a defined amount of evidence, and the pipeline must wait for it.
Common misconceptions
| Misconception | What's actually true | Where it's shown |
|---|---|---|
| "A good LCP means a fast page." | A server-rendered page painted on time and then blocked for 300 ms. | Gaps 1 |
| "Set the budget at the current value." | The same code varied ±9% between runs. | Gaps 2 |
| "No errors reported means no problem." | No reports can mean no data yet. | Gaps 3 |
| "Lighthouse CI fails a build when a run is slow." | Its default (optimistic) uses the best run. |
Code walkthrough |
| "Projects are done when the features work." | Done includes tests, budgets, a11y, docs and a deploy. | Explain it differently 2 |
| "Eight projects means eight repositories." | They're one product in layers. | Concept map |
| "A canary needs real users." | Synthetic views drove it here; real users are better, but the gate logic is the same. | Stage 33 |
Theoretical gaps: the ideas behind the chapter
1. Hypothesis testing for releases. "Is the candidate worse?" is a one-sided test. A threshold on percentiles without samples ignores both kinds of error: false alarms (blocking good releases) and misses (shipping bad ones). Mann-Whitney U, which compares two samples' distributions without assuming a shape, is what Netflix's Kayenta uses for canary analysis.
2. Sequential testing. Checking a running experiment repeatedly and stopping at the first "significant" result inflates false positives. Sequential methods (SPRT, alpha spending) let you look often without that cost; the minimum sample rule is a crude guard.
3. Proxy metrics and Goodhart's law. LCP is a proxy for "the page feels ready". Optimising or gating on one proxy invites changes that improve the proxy but not the thing; pairing complementary metrics (paint and blocking) limits that.
4. Deliberate practice. Projects build skill when they're slightly beyond current ability, have clear goals and get feedback (Ericsson). The chapter's definitions of done and harnesses are the feedback; choosing which projects to do (S3) is choosing the difficulty.
5. Technical debt as interest. Each layer's shortcuts cost more in later layers (Cunningham's metaphor): the order of the projects makes that cost visible within one volume.
Applying it
Code walkthrough
Project 5 and stage 27 set budgets in the lab; Lighthouse CI is the most used tool for that. How it turns several runs into one number decides what fails. Excerpts from @lhci/utils 0.15.1, src/assertions.js, installed from npm.
Many runs, one value
function getValueForAggregationMethod(values, aggregationMethod, assertionType) {
if (aggregationMethod === 'median') {
const medianIndex = Math.floor((values.length - 1) / 2);
const sorted = values.slice().sort((a, b) => a - b);
if (values.length % 2 === 1) return sorted[medianIndex];
return (sorted[medianIndex] + sorted[medianIndex + 1]) / 2;
}
const useMin =
(aggregationMethod === 'optimistic' && assertionType.startsWith('max')) ||
(aggregationMethod === 'pessimistic' && assertionType.startsWith('min'));
return useMin ? Math.min(...values) : Math.max(...values);
}
With optimistic, a "must be at most" assertion (maxNumericValue, for a timing) uses the smallest of the runs: the build passes if any run was fast enough. With pessimistic, the largest: every run must be. median is in between.
And the default is…
const {minScore, maxLength, maxNumericValue, aggregationMethod = 'optimistic'} = options;
…optimistic. That's a deliberate choice for noisy CI machines: a slow run is more often the machine than the code, so the tool forgives. The cost is the one Gaps 1 measured: a regression that shows up only sometimes passes. Stage 27's budgets compare the median of three runs; stage 33's gate uses p75 over 25 field samples, which can't be satisfied by one lucky run.
When a run produced nothing
if (
(!filteredValues.length && aggregationMethod !== 'pessimistic') ||
(filteredValues.length !== values.length && aggregationMethod === 'pessimistic')
) {
If no run produced a number (or, when pessimistic, any run failed to), the assertion fails with a message rather than passing silently. That's the same principle as stage 33's "hold": missing evidence is reported, never treated as success.
Debugging drills
D1. The gate promotes everything
Every release, including one with a deliberate 300 ms start-up delay, is promoted.
D2. The gate holds forever at night
Releases deployed after 10 p.m. stay on "hold" until morning.
D3. The release check fails before it starts
On a fresh machine, release-check.sh fails in its first step with a hundred cannot find symbol: assertEquals errors.
D4. A harmless release is flagged as slower
A release that only changed a comment in the CSS shows p75 LCP 12.5% higher than the baseline.
Career-oriented
Interview prep
Mid-level 1: walk me through a project
Question. "Tell me about a frontend project you built."
How to get there. Problem, your decisions, evidence, what you'd change: not a feature list.
Mid-level 2: what does "done" mean to you?
Question. "When is a feature done?"
How to get there. A checklist with reasons, and how you'd adapt it.
Senior 1: design a release gate
Question. "Design an automated gate that decides whether a frontend release stays."
How to get there. Metrics, comparison, sample size, verdicts and how you know it works.
Senior 2: which projects would you skip?
Question. "You have six weeks to grow from mid to senior on the frontend. Which of these eight projects do you do?"
How to get there. Your current gaps, the projects' overlap, and the evidence each produces.
Staff 1: turn projects into a team programme
Question. "How would you use these projects to raise a team of eight frontend engineers' level?"
How to get there. Goals, structure, feedback, and how you'd know it worked.
Staff 2: what would make 0.2.0 safe for real kitchens?
Question. "TiffinBox 0.2.0 passes its release check. What's missing before real restaurants depend on it?"
How to get there. Go through users, security, operations and failure, and rank.