Why break your own app
Your tests give you confidence. Is that confidence justified?
There is one way to find out. Introduce a bug on purpose and see whether anything catches
it. If nothing does, you have found a place where you are trusting the agent blindly.
Set up
git status # must be clean
git log --oneline # note your latest commit
After each sabotage, run npm test, record what happened, then:
git restore .
The five sabotages
Make each change by hand, one at a time.
Sabotage 1 — change the multiplier.
In nextGap, change 2.5 to 2.6.
Sabotage 2 — remove the upper limit.
Delete the code that caps the gap at 365.
Sabotage 3 — bring back the overdue bug.
Change the due-cards query from <= back to =.
Sabotage 4 — break the empty case.
Delete the “Nothing to review, well done” message.
Sabotage 5 — round the wrong way.
Change rounding down to rounding to the nearest whole number.
Record what happened
| Sabotage | Did npm test fail? |
Would you have noticed by using the app? |
|---|---|---|
| 1. Multiplier 2.5 → 2.6 | ||
| 2. No 365 limit | ||
| 3. Overdue cards hidden | ||
| 4. Empty message gone | ||
| 5. Rounds to nearest |
What the results mean
Caught by a test. Good. That rule is protected. If somebody changes it later — you, an
agent, anyone — the project says no.
Not caught, but you would notice while using the app. Acceptable, but it depends on you
remembering to look.
Not caught, and you would not notice. This is the important one. Sabotage 3 is usually
in this group, and it is the most damaging bug in the whole project.
Close the gaps
For every row where the test did not fail, add a test now. Give the agent your case, exactly
as in Lesson 5.2:
Add a test: a card with next_review three days in the past must appear
in the due list.
Add a test: nextGap(200, "easy") must return 365, not more.
Add a test: with no cards due, the review page shows
"Nothing to review, well done".
Then run the five sabotages again. This time they should all go red.
Commit
npm test
git add -A
git commit -m "Tests covering every rule in the plan"
The point of this lab
You now know something most people never learn about their own projects: exactly which
rules are protected and which are not.
That knowledge is what lets you hand work to an agent and sleep. Not trust. Coverage.
Before Module 6
- Complete the table honestly, including the rows where nothing caught the bug.
- Add a test for every gap, then re-run all five sabotages.
- Count your tests. How many came from your plan? That number is the real measure of how
well Module 2 went.