Chapter 9: Backpressure

Types and lint rules mostly look at one place at a time. The shape of the whole project needs a check of its own.

Structural test

Also called Architecture test, Fitness function

A test about how the code is arranged and not what it computes: which folder may use which, where the database may be touched. It reads the imports (the lines where one file pulls in another) and fails if a forbidden one appears.

An agent takes the nearest route to a working change, and a forbidden import works perfectly well, so no ordinary test will complain. Once it is in, that shortcut is an example the next session can copy. AGENTS.md can state this rule. Only a test can hold it.

Say it to your agent

“Add tests/architecture.test.ts. The order is types, config, repo, service, runtime, ui, and a file may only import from its own layer or an earlier one. Only src/repo/ may import the database client. Parse imports with the TypeScript compiler API, not a regex. Each failure must name the file, the line and where the code should go. Show it failing on a forbidden import.”

The workshop

Name a word, or describe what you mean in everyday language.