Add testing rules: assert an exception exists, filter after fixups #728
@@ -2,6 +2,7 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Testing principles now say that a test scanning rows for an exception asserts the exception exists, and that a data importer does not drop a row its own fixups complete.
|
||||
- task-bench leaves out of a fix a change Haiku makes to a Rust test module that stands in the file of the code it tests, and passes over a Rust mutant whose test modules it cannot tell apart.
|
||||
- loop-claude starts a chunk on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find, which failed three times and waited for the human.
|
||||
- larv-review's prose pass takes a second round after a fix that rewrites a claim a command or a source file can check, such as generated output, a number or a licence term.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 never drops a row the importer's own fixups complete. A fixup is a hand-written correction to one source row. Filter after applying the fixups, and exempt a row whose fixup leaves the field empty on purpose. 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("<a 600-character prompt sentence>", 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 the one row that breaks a pattern also asserts that the row exists, or it passes when the row is missing. BANNED: looping over every row and asserting that only the row named `X` has an empty cell. GOOD: collect the names of the rows with an empty cell, then `assertEqual(["X"], names)`.
|
||||
- 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.
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 543 | 0.16.0 | | | **Add to the testing principles that a test scanning rows for an exception asserts the exception exists, and that a data importer does not drop a row its own fixups complete.** | 1 | 2 | 3 | 4 | 2 | 1.1 by 3 | 1.2 |
|
||||
| 527 | 0.16.0 | | owner | **Plant bugs for `task-bench` in TypeScript, from the mutants Stryker kills.** | 3 | 2 | 1 | 4 | 4 | 1.1 by 1 | 0.3 |
|
||||
| 528 | 0.16.0 | | owner | **Plant bugs for `task-bench` in PHP, from the mutants Infection kills.** | 3 | 2 | 1 | 4 | 4 | 1.1 by 1 | 0.3 |
|
||||
| 525 | 0.16.0 | | owner | **Write fejkdata's first five source-data tasks for `task-bench`, each a seeded register for a made-up country, a spec, a checker and a reference patch, in the `bench-tasks` folder its config names.** | 3 | 2 | 1 | 4 | 7 | 1.1 by 3 | 0.3 |
|
||||
@@ -113,15 +112,6 @@
|
||||
|
||||
## Details
|
||||
|
||||
### 543. Add to the testing principles that a test scanning rows for an exception asserts the exception exists, and that a data importer does not drop a row its own fixups complete.
|
||||
|
||||
Two findings an outside reviewer raised on a data change that our review missed:
|
||||
|
||||
- A test scanned every row of a shipped table and asserted that exactly one named row held an empty cell. It passed when the table had no such row at all, since the loop never met it. A test that scans for an exception must also fail when the exception is absent.
|
||||
- An importer filtered source rows on a field before applying its fixups for that field, so a fixup that blanked the field on one row could not keep the row once the source left it empty. A filter on a field reads the value after the fixups, or exempts the fixed-up rows.
|
||||
|
||||
Put the first in `principles/technical-principles.md` under tests ("each test earns its keep"), and the second beside the rule on inputs that cannot disagree or in stability-reviewer's checks. Where a deterministic check can find the first, such as a mutant that deletes the exception's row, prefer that over prose.
|
||||
|
||||
### 527. Plant bugs for `task-bench` in TypeScript, from the mutants Stryker kills.
|
||||
|
||||
Stryker runs over the changed lines only today. Run it over the files that hold the seats' places, at the tree's top without git, and turn each killed mutant into the lines it changes, read from its JSON report. Tell Haiku the failure the project's test runner prints, without the test's name or file. Check the module against the tool's real output on a small project in a container, since this repo holds no TypeScript.
|
||||
|
||||
Reference in New Issue
Block a user