Why this matters
A green check mark means nothing if it only passes on one developer's laptop or hides skipped checks. For a founder, the risk is making hiring, marketing or launch decisions on top of test counts that collapse the moment someone else clones the code. That happened here at the end of Wave 44: the log recorded 8,810 of 8,810 verified checks, yet on a clean Linux clone two static gates and 22 root security tests failed for portability reasons, and GitHub Actions had never run. Waves 45 through 48 rebuilt the engineering workflow around one shared verification command, clean-machine CI, isolated agent worktrees and independent reviews. Once you know how this workflow operates, you can read any pull request, re-run the checks yourself on Windows and tell real evidence from an unverified claim.
The ideas
Commits, branches, merges and worktrees
Think of Git as a bound accounting ledger where pages are never torn out. Each saved step is a commit identified by a unique hash (such as 957bb99) that links back to the commit before it. Because even a one-character change produces a completely different hash, naming the commit next to a test result binds that result to exact file bytes.
To keep unfinished work from breaking the shared baseline (main), every task runs on its own branch. When several builders work in parallel on one machine, checking out different branches inside one folder would constantly overwrite each other's files. A Git worktree solves that by creating a separate folder linked to the same repository history, each checked out to its own branch:
repository (.git object history shared once)
├── main checkout -> branch: main
├── worktree A -> branch: wave48/a-dispatch
├── worktree B -> branch: wave48/b-executor
└── worktree lessons -> branch: wave49/lessons-and-dictionaryWhen a branch finishes, a merge joins its commits back into the target branch. If two branches edited the same lines differently, Git pauses with a merge conflict and asks a person to choose. The subtler trap is a conflict-free merge that breaks the program anyway: if branch A removes an import because it moved the last caller, while branch B adds a brand-new caller on another line, Git merges both files with zero textual conflicts and produces broken code that nobody wrote or reviewed. That is why typecheck and tests must always run again after every merge.
Two quiet file rules keep Windows and Linux checkouts identical across every worktree:
- Line endings: Windows defaults to CRLF while Linux expects LF. Pinning
eol=lfin .gitattributes stops shell scripts and file hashes from breaking across operating systems. - Dependencies: committing a lockfile (
pnpm-lock.yaml) and installing with--frozen-lockfileensures every workstation and CI runner installs the exact same dependency versions.
Pull requests, stacked pull requests and review
A pull request is the review gate where one branch proposes to merge into another on GitHub. It puts four things on one screen: the line-by-line diff, the automated CI status checks, reviewer comments and the author's evidence block.
Sometimes a new wave depends directly on code from a previous branch that has not merged yet. Instead of piling ten thousand lines into one unreadable review, engineers use a stacked pull request: PR 2 branches from PR 1 so reviewers inspect only PR 2's own diff, and PR 2 merges into main right after PR 1 lands.
Automated tests check what computers can verify, while code review and independent review check what tests miss: whether the design matches the brief, whether an authorization check was forgotten, or whether a test assertion was quietly weakened just to turn green. A common mistake is letting the author act as sole reviewer; here, read-only reviewers inspect every workstream before integration.
Three layers of tests: what each proves
No single test style catches every bug. Running one fast test layer alone gives false confidence, while running only slow browser suites makes daily editing crawl. This repository stacks three complementary test layers:
| Layer | Real example in this repo | Speed | What it proves | What it cannot prove |
|---|---|---|---|---|
| Unit test | packages/approvals/test/intent-binding.test.ts | Milliseconds | Pure rules: budget step math, hash binding, tax kuruş rounding, validator edge cases | SQL triggers, row-level security, browser cookies or CORS headers |
| Real-database test | packages/db/test/ suites | Seconds | Actual PostgreSQL 18 FORCE ROW LEVEL SECURITY, triggers, role grants and migration parity | Browser rendering, CSP headers or frontend-to-API wiring |
| Browser journey | tests/browser/sign-in-journey-e2e.mjs | Tens of seconds | Real Chromium walking sign-in, cookies, CORS, API, PostgreSQL and screen state end to end | Live third-party provider approvals (uses a local fake provider) |
Three discipline habits keep those tests honest:
- Failing test first: when fixing a bug, write a test that reproduces the defect and watch it fail red before writing the fix.
- Self-test: every custom static checking tool tests itself on built-in good and bad fixtures (
--self-test) before scanning the real repository. - Negative control: include deliberate must-fail cases (such as an intentionally slow cubic workload in the scaling helper) so you know the checker still catches faults.
What "green" means, what it does not, and continuous integration
A green build means every check that executed passed on that commit in that environment. It never proves anything about a check that did not execute, a feature that has no test yet or a live server that has not been provisioned.
That is why this repository enforces one strict rule: every step prints passed, failed or not run with its exact reason, and a not run step is never counted as passed. A trustworthy receipt always records four items: the commit hash, the exact command run, the machine or CI environment and the exact passed/failed/not-run totals.
Running checks from your laptop is fast, yet laptops accumulate hidden local state. Continuous integration runs the exact same checks automatically on clean Linux servers hosted by GitHub Actions whenever code is pushed or a pull request opens. From a user's seat, you run bash tools/verify locally and GitHub Actions runs the matching CI workflow (.github/workflows/verify.yml). Lesson 13 examines the manifest internals, deployment checks and incident runbooks in depth.
How a wave runs: briefs, parallel agents, reports and depth-first rules
Building with parallel AI coding agents looks chaotic unless roles and handoffs are crystal clear. Every wave follows the same seven-step pipeline:
1. Briefs Integrator writes wave README + disjoint WS briefs + shared contracts
|
2. Parallel build Each coding agent works on its own branch inside its own worktree
|
3. Reports Each agent commits locally and writes docs/waveNN/reports/<WS>-REPORT.md
|
4. Review Independent read-only reviewers audit diffs against briefs and rules
|
5. Wiring Closing wiring workstream connects parts and proves them in Chromium
|
6. Integration Integrator merges branches, fixes merge seams, runs bash tools/verify
|
7. Pull request PR opens with receipts, CI runs green, LOG.md records verified outcomeUnderstanding four artifacts lets you inspect any wave in five minutes:
- How to read a workstream brief: start at the file ownership list, the exact problem statement and the required tests. If a builder touched files outside that list, ask why.
- How to read an agent report: skip past marketing summaries and look straight at four sections—exact commands with pass/fail/not-run counts, any pre-existing test changed with its reason, explicit deviations from the brief, and open risks.
- Why wiring is its own workstream: separate branches for storage, API and UI routinely pass alone and fail where they meet. Giving wiring its own owner and browser journey catches seam bugs before merge.
- Why smaller verified beats larger unverified: owner decision
OD-18established depth-first building—finishing one verifiable slice a customer can actually complete beats adding ten half-wired screens. Every closed wave is recorded honestly in the project log (LOG.md).
Two governance mechanisms keep both the product and these lessons aligned over time. First, whenever builders hit a business, legal or product trade-off they cannot decide alone, they log options in docs/OWNER-DECISIONS.md and pause for the founders' answer rather than guessing silently. Second, these lessons and dictionary entries stay tied to live code through the drift gate: if a later wave renames or deletes a file cited by a lesson, node tools/learning/build.mjs --check fails in CI until the lesson is corrected and its verified date updated.
How this repository does it
Every part of this workflow is backed by concrete files and scripts on this branch today:
- One manifest, local and CI identical:
tools/verifycallstools/run-gates.mjs, which reads all 70 ordered steps fromtools/gates.manifest.jsonacross eight groups (core,static,suites,postgres,deploy,scanners,build,browser)..github/workflows/verify.ymlruns the exact same commands on GitHub Actions, andtools/check-gate-parity.mjsfails CI if the manifest and workflow ever drift apart. Removing gate parity would let local checks and CI silently diverge again. - Portable line endings and PostgreSQL discovery:
.gitattributeslocks pure LF endings across operating systems.tools/lib/pg-local.mjsis the single helper that finds PostgreSQL 18 server binaries (viaPG_BIN_DIR,PATHor default install folders) and checks the actual server version rather than the client binary;tools/check-pg-discovery-single-helper.mjsfails if any test file re-introduces a private copy. - Machine-independent performance checks:
tools/lib/linear-time.mjsmeasures how runtime scales between 1/8 input size and full input size across interleaved runs (failing at 24x growth, with a confirmation retry on noise and a built-in cubic negative control), replacing 214 flaky millisecond ceilings. - Invariants instead of growth-only counts:
tools/check-surface-invariants.mjsenforces structural invariants after Wave 46 D retired 141 minimum-count assertions underOD-18. - Wave records and pull requests:
docs/wave46/README.md,docs/wave47/README.md,docs/wave48/README.mdanddocs/wave49/README.mdorganize every workstream brief and report alongsidedocs/wave49/briefs/COMMON.md,.github/PULL_REQUEST_TEMPLATE.md,docs/VERIFICATION.mdandLOG.md. - The learning drift gate:
tools/learning/build.mjsvalidates lesson syntax, exact-case repo paths, bidirectional dictionary links, tone rules and generated outputs (check_learning_sourcesintools/gates.manifest.json). Removing it would let lessons quietly drift out of sync with the code, just as earlier ADRs did.
Not built yet
What went wrong once
The headline number that only passed on one laptop
- What happened: The Wave 44 log reported
8,810 / 8,810verified checks. When re-run from a clean Linux clone, two of 38 static gates and 22 of 1,626 root security tests failed, 108 of 168 API suites died without PostgreSQL 18 binaries, and roughly 1,750 tests were not wired into CI at all. - How it was noticed: The independent review in
docs/INDEPENDENT-REVIEW-2026-12-02.mdcloned the repository cleanly on Linux and ran every check before changing a line. - Cause in plain words: "Verified" meant verified on one authoring Windows machine; one gate hashed Windows CRLF bytes, another followed links outside the repository, and growth-only gates rewarded adding files while CI had never run.
- Fix: Wave 45 E built the shared manifest (
tools/gates.manifest.json) andbash tools/verify, pinned LF in.gitattributesand recorded the correction openly inLOG.md. Wave 46 D enabled CI on push (OD-17) and retired 141 growth-only count assertions (OD-18). - General lesson: A big check count is not proof; a result only counts as verified when a clean clone can reproduce it from one documented command.
The import dropped in a clean Git merge
- What happened: After merging Wave 48 workstream B (Meta budget executor) and workstream A (dispatch process),
apps/api/src/server.tscallednew KekKeyring(...)while its import line only importedzeroizeBufferfrom@{product}/vault. - How it was noticed: Immediately after the merge (fixed two minutes later in commit
957bb99). - Cause in plain words: Workstream A moved token refresh out of
server.tsand removed the now-unusedKekKeyringimport; workstream B left the import untouched and added a newKekKeyringcall for budget execution. Git merged both branches with zero conflicts by taking A's shorter import line and B's new call. - Fix: Restored
KekKeyringto the import line inserver.tsand re-ran typecheck and tests. - General lesson: Zero merge conflicts means the text lines did not collide—not that the combined program compiles. Always run
pnpm typecheckand tests after every merge.
The test that pointed at the owners' live Windows database folder
- What happened: A Wave 45 test for the dev-stack launcher set
TMPDIRto isolate its temporary PostgreSQL folder. On Windows, Node'sos.tmpdir()ignoresTMPDIRand readsTEMPandTMP, so the test resolved its data directory straight to the owners' live development cluster folder and attemptedpg_ctl startagainst it. Because that cluster was already running, the start failed without changing or stopping anything. - How it was noticed: Three Wave 46 agents hit six failing tests on Windows; one agent verified read-only (PID file, port, server log) that the owners' server was untouched, and agent E isolated the cause with a one-line
os.tmpdir()check (docs/wave46/reports/E-REPORT.md). - Cause in plain words: A Linux-only isolation variable (
TMPDIR) silently did nothing on Windows. - Fix: The test now sets
TEMP,TMPandTMPDIRand asserts before touching disk thatos.tmpdir()points inside its disposable directory; browser journeys also explicitly refuse ports 3000, 4000, 5432 and any live dev-cluster path. - General lesson: Tests must prove they are isolated before acting, and when anything unexpected points near real data, stop retrying and verify read-only first.
Duplicate PostgreSQL helpers and flaky wall-clock ceilings
- What happened: Two hidden test-infrastructure faults built up across earlier waves. First, 184 test files carried 20 slightly different copy-pasted PostgreSQL discovery snippets; 14 of them silently accepted PostgreSQL 17 instead of PostgreSQL 18. Second, 214 timing assertions checked hard millisecond ceilings (such as under 250 ms), failing under CPU contention on CI while letting two real quadratic regular expressions hide on a fast laptop.
- How it was noticed: The independent review flagged duplicated helpers and timing flakes; Wave 46 D and Wave 48 D audited every call site (
docs/wave46/reports/D-REPORT.md,docs/wave48/reports/D-REPORT.md). - Cause in plain words: Test helpers were copy-pasted instead of shared, and wall-clock time measured machine speed instead of algorithmic growth.
- Fix: Wave 48 D replaced 181 private helpers with one import of
tools/lib/pg-local.mjs(plustools/check-pg-discovery-single-helper.mjsso duplicates cannot return). Wave 46 D replaced 214 wall-clock budgets withtools/lib/linear-time.mjs, which immediately exposed and drove fixes for two real quadratic regex defects. - General lesson: Test the real property you care about (server version 18, linear scaling), share one helper and add a gate so copy-paste drift cannot return.
Try it yourself
All four commands below are read-only and safe on Windows. None start servers, none touch ports 3000, 4000 or 5432, and none modify tracked files.
Step 1: read recent commits and see the exact hashes in PowerShell
git log --oneline -n 8You should see eight short lines, each starting with a seven-character commit hash followed by its scoped commit message. Notice how every verification receipt cites that exact short hash.
Step 2: print the full verification manifest plan in Git Bash
bash tools/verify --listGit Bash lists all 70 verification steps grouped into core, static, suites, postgres, deploy, scanners, build and browser, showing each step's exact command and prerequisites (needs) without executing any of them.
Step 3: verify that local verify and GitHub Actions CI match 1:1 in PowerShell
node tools/check-gate-parity.mjsYou should see a clean passing summary confirming that every entry in tools/gates.manifest.json matches .github/workflows/verify.yml in both directions.
Step 4: run the learning drift gate on this very lesson in PowerShell
node tools/learning/build.mjs --check-file docs/lessons/02-how-we-build.mdThe command validates this file's front matter, section order, links, exact-case repository paths, tone rules and dictionary sync, printing PASS when every rule holds.
Check yourself
0 / 6Two branches merge cleanly with zero Git merge conflicts. Why must you still run typecheck and tests before trusting the merge?
A developer reports "All checks green locally" after running bash tools/verify, and the summary shows 65 passed, 0 failed, 5 not run (pg18 missing). How should you read that report?
Which test layer catches a missing CORS header that stops the browser from sending a custom request header on a POST request?
Why did Wave 46 replace 214 absolute millisecond ceilings (such as "under 250 ms") with growth-ratio checks in tools/lib/linear-time.mjs?
Why did the founders retire 141 growth-only minimum-count assertions under owner decision OD-18?
A bug is reported in an approval ceiling check. What is the safest order of steps when fixing it?
Words to know
36Go deeper
- Verification contract, manifest and wave history:
docs/VERIFICATION.md,tools/gates.manifest.json,.github/workflows/verify.yml,LOG.mdanddocs/INDEPENDENT-REVIEW-2026-12-02.md. - Wave briefs and reports:
docs/wave46/README.md,docs/wave47/README.md,docs/wave48/README.md,docs/wave49/README.mdanddocs/wave49/briefs/COMMON.md. - Lesson authoring and drift gate rules:
AUTHORING.mdandtools/learning/build.mjs. - Archived lessons this lesson replaces (historical only, not a source of current facts):
archived lesson 11,archived lesson 13,archived lesson 16,archived lesson 17,archived lesson 23andthe archive index. - Official external documentation: Git documentation, git-worktree reference, GitHub Actions documentation, Vitest documentation, Playwright documentation and pnpm documentation.