Hold each test to earning its keep, and take a test's expected values from its item
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
|
||||
| ID | Release | Blocked by | Exempt | Item | R | S | C | Moves | Score |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| 164 | 0.2.0 | | | **Rewrite the technical principles' test bullet so each test earns its keep, tell the worker to take expected values from the item, and point stability-reviewer's §11 at that bullet.** | 1 | 2 | 3 | 1.1 by 6 | 10.9 |
|
||||
| 163 | 0.2.0 | | | **Have `rule-hook` block an Agent call that launches a reviewer, a comprehension seat or the security pass's subagent below the rung loop-claude names for them, so a worker below the project's rung cannot hand a review to its own cheaper model.** | 2 | 3 | 3 | 1.1 by 5 | 6.8 |
|
||||
| 146 | 0.2.0 | | decision | **Score R as L + E + I − 2 from anchored levels, at least 7 at I5 and 5 at I4, with L, E and I in their own columns and `rank_todo.py` computing R, drop C, and route a task's model and effort on its R alone.** | 6 | 7 | 7 | 1.1 by 8, 1.2 by 8, 1.4 by 8 | 2.8 |
|
||||
| 152 | 0.2.0 | 146 | decision | **Anchor each score level in `rules/todo-items.md` with words, and each project's with two or three items it shipped, and have a scorer compare a new item against them.** | 2 | 4 | 3 | 1.1 by 7 | 6.4 |
|
||||
@@ -41,7 +40,7 @@
|
||||
| 154 | 0.3.0 | | defect | **Have `bin/shell_command.py`'s `segments` keep a command's words together across a redirect, so `git > out commit` reads as one git commit.** | 2 | 2 | 3 | 1.1 by 6 | 10.9 |
|
||||
| 157 | 0.3.0 | | | **Split `docs/decisions.md` → `todo.md: one table of items …`'s 2026-10-02 paragraph into one paragraph per choice.** | 1 | 2 | 1 | 1.1 by 4, 1.4 by 4 | 10.9 |
|
||||
| 106 | 0.3.0 | | | **Make larv-review's "Do not over-read a clean result" cite a rule that says Renovate or Dependabot owns dependency CVEs, or drop the citation.** | 1 | 1 | 1 | 1.1 by 5 | 10.9 |
|
||||
| 165 | 0.3.0 | 164 | | **Make this repo's tests assert the facts a prompt or help text carries in place of its sentences, and drop the tests that scan source or assert a constant.** | 2 | 3 | 2 | 1.1 by 4, 1.4 by 3 | 7.5 |
|
||||
| 165 | 0.3.0 | | | **Make this repo's tests assert the facts a prompt or help text carries in place of its sentences, and drop the tests that scan source or assert a constant.** | 2 | 3 | 2 | 1.1 by 4, 1.4 by 3 | 7.5 |
|
||||
| 162 | 0.3.0 | | owner | **Script each step that 0.2.0's chunks repeated by hand and a program can compute, filing one item per step, and file this audit again for the next release.** | 1 | 2 | 3 | 1.4 by 4, 1.5 by 4 | 6.6 |
|
||||
| 139 | 0.4.0 | | | **Split `bin/routing_figures/measure.py` by concern, and keep the figures' measured cycle and each raised call as fields loop-claude reads back, not as the prose it renders.** | 2 | 3 | 3 | 1.1 by 5, 1.4 by 5 | 10.3 |
|
||||
| 158 | 0.4.0 | | decision | **Measure the fixed cost of a chunk from loop-claude's archive, in tokens and hours against its items' S, and set F in `Score = 100 * V / (2**S + F)` to it.** | 1 | 3 | 4 | 1.1 by 5, 1.4 by 5 | 10.3 |
|
||||
@@ -81,33 +80,6 @@
|
||||
|
||||
## Details
|
||||
|
||||
### 164. Rewrite the technical principles' test bullet so each test earns its keep, tell the worker to take expected values from the item, and point stability-reviewer's §11 at that bullet.
|
||||
|
||||
lilleman asked, on 2026-10-16, for research on what makes tests valuable. An audit of 196 tests sampled across eight projects found about 61% clearly valuable. The rest: 15% pinned wording that is not the contract, 9% copied or policed the implementation, 6% ran on real time or heavy resources, 6% asserted something no bug could break. The research behind the bullet:
|
||||
|
||||
- Coverage barely predicts fault detection: Inozemtseva & Holmes, ICSE 2014.
|
||||
- Surviving mutants do predict real faults: Just et al., FSE 2014. Google's mutation testing in code review: arXiv 2102.11378.
|
||||
- What a valuable test is: *Software Engineering at Google*, chapters 11, 12 and 14; Fowler, "The Practical Test Pyramid"; Beck, "Test Desiderata"; Khorikov, *Unit Testing: Principles, Practices, and Patterns*, chapter 4.
|
||||
- Agents over-mock: Hora & Robbes, MSR 2026, arXiv 2602.00409.
|
||||
- LLM-written tests lock in bugs when their expected values come from the code's output: Charoosaei et al., arXiv 2610.11835 (a preprint), and Mathews & Nagappan, arXiv 2412.14137.
|
||||
- Watch a test fail on its assertion: Seemann, blog.ploeh.dk, 2019-10-14.
|
||||
|
||||
1. In `principles/technical-principles.md`, replace the "automated tests" bullet's lines on what a test checks and when to write it with the draft below. Keep its lines on changing tests apart from other code and on UUID v7s. Add to the mutation bullet: "Coverage is no target: it finds untested code, not weak tests."
|
||||
2. In `CLAUDE.md` → "Implement the simplest change…", add "taking expected values from the item, never from the code" to the test-first sentence. The worker reads no principle unless one is named, and expected values taken from the code are the costliest mistake agents make in tests.
|
||||
3. Point `agents/stability-reviewer.md` §11 at the bullet in place of its own restatement, as item 67 did for the rest of the principles.
|
||||
|
||||
* Most, if not all, code should have automated tests, and each test earns its keep.
|
||||
- A valuable test checks behaviour through the unit's interface, fails when that behaviour breaks, and passes through a refactor that keeps it.
|
||||
- Write the test first and watch it fail on its assertion, not on an error, before implementing.
|
||||
- Take expected values from the requirement — the item, ticket, spec or a hand-worked example — never from running the code or calling its helpers. A test that records today's output locks in today's bug. BANNED: `assert text.endswith(applications_text(applied))`. GOOD: the expected text written out for one small input.
|
||||
- Assert the outcome — returned values, stored state, emitted output — not how the code reached it. Use real collaborators or fakes; mock only slow, nondeterministic or external edges. BANNED: asserting which internal function ran, or scanning the source with `ast` or a regex. GOOD: a fake clock, a fake HTTP transport.
|
||||
- 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.
|
||||
- Every escaped bug becomes a test that fails without its fix.
|
||||
- Skip a test that no real bug could fail: a constant's value, a list's length, the framework's own behaviour.
|
||||
- Tests take time, randomness and I/O through the same injected seams: no sleeps, no wall-clock asserts, seeded randomness, fixtures built per test.
|
||||
- For pure logic over many inputs, prefer a property test: a round trip, an invariant.
|
||||
|
||||
### 163. Have `rule-hook` block an Agent call that launches a reviewer, a comprehension seat or the security pass's subagent below the rung loop-claude names for them, so a worker below the project's rung cannot hand a review to its own cheaper model.
|
||||
|
||||
`docs/decisions.md` → `routing: a chunk's worker runs on the rung its item picks…` keeps every reviewer, comprehension seat and the security pass's subagent at or above the project's rung. Only loop-claude's prompt holds that today. No agent under `agents/` sets `model:`, so an Agent call that names no model runs on the caller's: a Haiku worker that leaves out `model` once gets a Haiku review, and nothing reports it. On 2026-10-16, item 67's chunk passed `model=opus, effort=medium` on every such call, so no review has run low yet.
|
||||
@@ -261,7 +233,7 @@ Found by the goals audit of PR #245. `skills/larv-review/SKILL.md` §3 → "Secu
|
||||
|
||||
### 165. Make this repo's tests assert the facts a prompt or help text carries in place of its sentences, and drop the tests that scan source or assert a constant.
|
||||
|
||||
The 2026-10-16 test audit behind item 164 found 10 of 33 sampled tests in this repo pinning wording that is not the contract. Examples: `bin/loop_claude/test_loop_claude.py:654`, `:661`, `:667`, `:677`, `:689` and `:696` each assert prompt sentences of several hundred characters, and `:859` asserts help-text wording. `:869` and `:918` parse the source with `ast` and list each `Stop(...)` and `Failure(...)` call by function name. `bin/model_routing/test_ladder.py:13` asserts `len(LADDER) == 11`. Rewrite each to the bullet item 164 writes: assert the facts the text must carry, such as an item ID, a rung or a model argument, and delete a test no real bug could fail. Keep the mutation run on the changed lines green, so no rewrite loses a behaviour the old test held. `bin/loop_claude/cycle/prompts.py`'s `off_the_projects_rung` is a place the comprehension seats found hard; its tests are among those rewritten.
|
||||
A test audit across lilleman's projects on 2026-10-16 found 10 of 33 sampled tests in this repo pinning wording that is not the contract. Examples: `bin/loop_claude/test_loop_claude.py:654`, `:661`, `:667`, `:677`, `:689` and `:696` each assert prompt sentences of several hundred characters, and `:859` asserts help-text wording. `:869` and `:918` parse the source with `ast` and list each `Stop(...)` and `Failure(...)` call by function name. `bin/model_routing/test_ladder.py:13` asserts `len(LADDER) == 11`. Rewrite each to the technical principles' test bullet: assert the facts the text must carry, such as an item ID, a rung or a model argument, and delete a test no real bug could fail. Keep the mutation run on the changed lines green, so no rewrite loses a behaviour the old test held. `bin/loop_claude/cycle/prompts.py`'s `off_the_projects_rung` is a place the comprehension seats found hard; its tests are among those rewritten.
|
||||
|
||||
### 162. Script each step that 0.2.0's chunks repeated by hand and a program can compute, filing one item per step, and file this audit again for the next release.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user