Skip to content

Quiz: Rules That Enforce Themselves

Test your understanding of enforcement over memory, linters and formatters, hooks and the opt-in hook gap, CI pipelines, regression guards and professional guardrails with these review questions.


1. What does "enforcement over memory" mean?

  1. Any rule worth keeping should be checked by a program that runs on its own and fails loudly, not left for a person or agent to remember
  2. Agents should be given larger memory so they forget fewer rules
  3. Rules should be written in capital letters in the instruction file
  4. Builders should review every diff by hand before it merges
Show Answer

The correct answer is A. A rule held only in memory will be forgotten, by a builder in six months or by an agent in a fresh session. A check that runs on every change doesn't forget. That's the hydraulic closer on the door instead of a bigger sign. A larger memory (B) and louder wording (C) are still signs. Reviewing every diff by hand (D) is exactly the work guardrails are meant to take off the builder.

Concept Tested: Enforcement Over Memory

See: A Rule That Has to Be Remembered Is Not a Rule


2. Why does a formatter make diffs easier to review?

  1. It removes comments so there is less to read
  2. It finds bugs in the changed lines
  3. With one fixed layout, a diff shows only changes in meaning, not hundreds of re-indented lines that hide them
  4. It sorts files alphabetically
Show Answer

The correct answer is C. If the agent fixes the "not checked" scoring rule and also re-indents the whole file, the one line that matters hides among hundreds that changed only their spaces. A formatter such as Prettier keeps every file in one layout, so the diff shows the real change. Run it in check mode in CI so an unformatted file fails. Finding bug patterns is the linter's job (B), not the formatter's.

Concept Tested: Formatter

See: Formatters


3. The dating-safety app had a pre-push hook that needed a one-time opt-in on each clone. Why wasn't that enough to enforce its checks?

  1. Hooks only run on Windows
  2. Hooks slow down every push
  3. Hooks can only run the linter
  4. Hooks live in a folder that isn't saved to GitHub, so fresh clones, cloud agents, web edits and --no-verify all skip them
Show Answer

The correct answer is D. This is the opt-in hook gap. Git keeps hooks in a hidden folder in each copy of the repository, so a new laptop, a contractor's clone or a cloud coding agent runs no hooks until someone switches them on, and --no-verify skips them anyway. The gap is invisible from the builder's own machine. Keep the hook as a fast warning, and enforce the same check in CI, which nobody can skip.

Concept Tested: Opt-In Hook Gap

See: The Opt-In Hook Gap


4. Your linter finds about 24 bare catch blocks on its first run. What should you tell your agent?

  1. "Turn the rule off, since 24 is too many to fix."
  2. "Set the rule to error, fix the existing ones in small batches starting with scoring, sign-in and payments, and let CI fail on any new one."
  3. "Add a comment inside each catch block so the rule stops flagging them."
  4. "Set the rule to warning so it doesn't block anything."
Show Answer

The correct answer is B. A rule set to "error" stops new bare catch blocks from arriving, and fixing the old ones in batches, by risk, makes the work manageable. Turning it off (A) or leaving it as a warning (D) keeps it a sign on the door. Filling blocks with comments (C) satisfies the linter while still swallowing every failure, which is why a custom rule should flag catch blocks that only print and move on.

Concept Tested: Linter

See: A Worked Lint Rule: Errors That Disappear


5. CI goes red on a pull request, but the builder can still click Merge. What setting turns the red mark into a stop?

  1. Branch protection on main that requires the CI checks to pass before merging
  2. A second CI pipeline that runs the same checks
  3. A rule in the instruction file asking the agent not to merge red changes
  4. An email alert when CI fails
Show Answer

The correct answer is A. A check that fails and can still be merged is a sign on the door. Branch protection makes GitHub refuse the merge until the required checks pass, for the builder and every agent alike. A second pipeline (B) is just another red mark. An instruction (C) depends on memory. An email (D) informs but doesn't stop anything. With continuous deployment, this gate is all that stands between a change and members.

Concept Tested: CI Pipeline

See: Making a Red Mark Mean Stop


6. The agent fixed the scheduler bug where <= marked too many rows as sent. Following "lesson to rule," what goes in the same commit?

  1. A note in the README describing the bug
  2. A reminder in the instruction file to use = for IDs
  3. A regression guard: a test with three unsent rows that sends the middle one, checks only it changed, and names the bug in its message
  4. A new branch for future scheduler work
Show Answer

The correct answer is C. Lesson to rule means finding the root cause, picking the cheapest check that would have failed, and adding it in the same commit as the fix, then showing it fail on the old code. Here a fifteen-line test with neighboring rows catches the wrong comparison if any future rewrite brings it back. A README note (A) or an instruction (B) depends on someone reading it at the right moment.

Concept Tested: Regression Guard

See: Regression Guards


7. The dating-safety app changed its schema through both migration files and startup SQL. Why does a schema drift check in CI keep the one-path fix from slipping?

  1. It deletes the startup SQL each time CI runs
  2. It runs the migrations on production every night
  3. It blocks any pull request that adds a migration
  4. It builds an empty database from the migrations alone and fails if the result doesn't match the schema in code
Show Answer

The correct answer is D. If anyone changes the schema outside the migration files again, through startup SQL or push, the database built from migrations won't match the Drizzle schema, and CI fails. Chapter 11 fixed the cause by choosing one path, and this check makes the choice enforce itself. It doesn't delete code (A), touch production (B) or block migrations (C). Those are the job of the migration tool and the review.

Concept Tested: Schema Drift Check

See: The Schema Drift Check


8. "Ask before adding a paid vendor" can't easily be checked by a program. Where should the lesson go?

  1. Nowhere, since only checkable rules count
  2. In the project instruction file, and anywhere else it belongs, as part of reflect and capture
  3. In a code comment in one adapter
  4. In the builder's memory only
Show Answer

The correct answer is B. Reflect and capture records each lesson in every place it belongs: a check if a program can enforce it, the project instruction file if it guides the agent's judgment, and docs or memory for the reasons. Checks come first and memory last. A rule that can't be a check still needs a home the agent reads every session. A comment in one file (C) won't be seen when the agent adds a new adapter.

Concept Tested: Reflect and Capture

See: Reflect and Capture


9. A builder says, "We have CI, so let's turn on continuous deployment today." CI runs only unit tests, with no type check, audit, lint or auth tests, and red can still be merged. How should you judge this?

  1. Ready, since any CI is enough for continuous deployment
  2. Ready, as long as deploys happen during working hours
  3. Not ready: continuous deployment is only as safe as its gate, so add the one-line gate and auth tests and make red block the merge first
  4. Never ready: continuous deployment is unsafe for any small app
Show Answer

The correct answer is C. With continuous deployment, every merged change goes straight to members, so the CI gate is the last check. Here the gate misses type errors, known package flaws, lint rules and access checks, and a red result doesn't even stop the merge. Working hours (B) don't add a check. Continuous deployment can suit a small app (D) once branch protection, the one-line gate and tests on the money and auth paths are in place.

Concept Tested: Continuous Deployment

See: Continuous Deployment


10. You want a guardrail so no future change can bring back an address in a report. Which design enforces the no-locate rule best?

  1. A test that feeds fake people-search responses holding an address, a city and a workplace through the scan code, inspects everything sent to the member, and runs in CI behind branch protection
  2. A bold line in the instruction file that says "NEVER SHOW ADDRESSES"
  3. A manual check of five random reports before each release
  4. A pre-commit hook on the builder's laptop that greps for the word "address"
Show Answer

The correct answer is A. The check looks at what the app sends back, applies the rule, and fails on its own, and CI with branch protection means nobody can skip it. It's about twenty lines. An instruction line (B) is a sign on the door. Five random reports (C) can miss the one that leaks. A laptop hook (D) falls into the opt-in hook gap and would only catch the word, not an address under a field like work_location.

Concept Tested: Automated Check

See: A Worked Check: No Location in the Output