From 4b51675596541713165da122910def6b32bc3a26 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 10:20:46 +0100 Subject: [PATCH] Add two testing rules: assert the exception exists, filter after fixups --- docs/reading-cost.md | 13 +++++++++++++ principles/technical-principles.md | 2 ++ 2 files changed, 15 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 9d7c2652..02047e31 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -3648,3 +3648,16 @@ Read most (opens and searches): - `bin/task_bench/plant.py` 2 - `bin/task_bench/runs.py` 2 - `docs/decisions.md` 2 + +## Reading cost, chunk d1dab3385426, finished 2026-11-26T09:20:19Z + +581672 new input tokens before the first commit. + +Read most (opens and searches): + +- `README.md` 5 +- `bin/project_config/main.py` 2 +- `bin/project_config/settings.py` 2 +- `bin/task_bench/bench_folder.py` 2 +- `bin/task_bench/feature_tasks.py` 2 +- `docs/decisions.md` 2 diff --git a/principles/technical-principles.md b/principles/technical-principles.md index 95e988a9..7a55e9b1 100644 --- a/principles/technical-principles.md +++ b/principles/technical-principles.md @@ -30,6 +30,7 @@ * Make invalid states unrepresentable. - Example: using a time-only type in the database when we actually want to store a time of day introduces risk for errors. - A function's inputs too: take only inputs that cannot disagree, instead of checking that they agree. BANNED: a test helper that takes a token and a message, and checks that the message holds the token. GOOD: the helper makes the token and builds the message. When a review finds a second edge case in a check, change the signature so the input can't occur. + - A data importer's filter on a field reads the value after the importer's fixups for that field, or exempts the rows they fix. BANNED: dropping source rows with an empty `population` before a fixup fills in `population` for one of them. GOOD: apply the fixups, then filter. * Always store timestamps as full ISO datetime in UTC. - Always communicate timestamps as full ISO datetime in UTC from APIs with database access. * Always grant explicit access to data, both read and write. @@ -55,6 +56,7 @@ - Pin wording only where the wording is the contract: a message a consumer parses, a published format. For prompts, help and error text, assert the facts the text must carry — an item ID, a model argument, an error code — not the sentence. BANNED: `assertIn("", prompt)`. GOOD: `assertIn("model opus, effort high", prompt)`. - One behaviour per test, named for it, tested once, at the lowest level that reproduces it. No loops or branches in a test body; parametrize the cases. - A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing. BANNED: `test.skip(created.every((count) => count === 0))` after the payroll run under test, since a broken payroll also creates zero rows. GOOD: before running the payroll, check each precondition and fail naming the one that is missing; after it, `expect(created).toEqual([1, 2, 1])`. + - A test that scans rows for an exception also asserts that the exception exists, or it passes when the exception is missing. BANNED: looping over every row and asserting that only the row named `X` has an empty cell, which passes when the table has no row `X`. GOOD: collect the rows with an empty cell, then `assertEqual(["X"], collected)`. - Every escaped bug becomes a test that fails without its fix. - Write no test that no real bug could fail: a constant's value, a list's length, the framework's own behaviour. - A test neither sleeps nor asserts on the wall clock, and seeds any randomness.