Files
FabledGrimoire/plugin/skills/reviewing-tests/SKILL.md
T
bvandeusenandClaude Opus 5.5 7c7a1a7ab9
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Successful in 2m14s
CI & Build / integration (push) Successful in 2m28s
CI & Build / Build & push image (push) Successful in 35s
fix(8249): test groups come smallest first, and a big one is read as a feature area
A group is the set of tests reaching the same code from different files. A
test that drives a feature through its one entry point reaches exactly that
entry point whatever it checks, so the largest groups are a feature tested
from many files, not copies. Listing them first buried the two- and
three-test groups where one-for-one duplicates are. The readout, the tool and
the panel now list smallest first; each group says copies or area and how
many files it spans, and the panel tells an area to fold its scattered cases
into one file. Plugin 2026.12.01.0748.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 02:49:06 -05:00

98 lines
5.3 KiB
Markdown

---
name: reviewing-tests
description: Use when a test suite needs reviewing rather than growing — the operator asks to review, prune or tighten tests, CI is slow and the suite only ever grows, the coverage line counts test groups guarding the same thing or tests guarding nothing found, or a project's test standard asks for a review. Triggers on "review the tests", "prune the suite", "too many tests", "redundant tests", "CI is slow", "test standard". Gives each test one verdict, proves the survivors still fail, and lists every removal with its reason.
metadata:
moments: work.verify
---
# Reviewing a test suite
Every change adds tests and nothing removes them, so a suite left alone only
grows: each test costs every CI run, forever, whether or not it still
protects anything. A review is the subtraction pass. It gives every test one
verdict, keeps the ones that earn their place, and leaves a record good
enough that any removal can be argued back.
## The standard comes from the project, not from this skill
Look for the project's own test standard first: a family idea it has
adopted (`enter_project` lists ideas under `family`; `get_family_adoption`
reads the project's answer), a rule, or a note — `search` for "test
standard" in the project. Review against it, and use the test levels it
names (unit, database, web, …) for "move" below. With no standard recorded,
the verdicts below are the floor; agree the project's levels with the
operator before moving any test, and offer to record them so the next review
starts from them.
## Before: the numbers you will compare against
Write these into the review's task before touching anything:
- tests **collected**, from a real run's summary (not files, not a grep: a
file that fails to collect reads exactly like a pass);
- lines of test code;
- CI time, from the last few green runs on the main working branch;
- the coverage line's test figures: linked, guarding nothing found,
redundant, and the number of groups guarding the same thing.
## Area by area
Take one area at a time, the project's Systems or its test directories, and
finish it before starting the next. In each area:
1. **Read what the ledger already knows.** `list_shapes(path=<area>)` lists
the test cases; a `test` status means the refresh linked it to something
it guards, `unclassified` means it is linked to nothing. `test_guard_groups`
lists tests in different files that guard exactly the same thing, each
with its `signals`: `signature` (pins how code is declared), `mock-only`
(asserts only that mocks were called), `source-text` (reads source as
text). Signals point at what to read first; they never decide a verdict.
Groups come smallest first. A `copies` group (three tests or fewer) is
where one-for-one duplicates hide. An `area` group is one feature
tested from several files, since every test that drives a feature
through its entry point reaches the same code. Read it as one area: fold
the scattered cases into the feature's own file, and remove only what
another test already checks.
2. **Read every test** and give it one verdict:
- **keep** — it protects something a user or caller relies on, and
nothing else in the suite protects it;
- **merge** — it checks one case of a behaviour other tests also check:
fold them into one table of cases;
- **rewrite** — the subject is right and the check is weak: it pins a
name, a signature or a mock call where it should pin an outcome;
- **move** — it sits at a level the project's standard puts elsewhere;
- **remove** — another test checks everything it checks
(`redundant`, naming that test), or what it protects no longer matters
to anyone (`unused`).
3. **Record the verdicts where they are kept.** Removals go in the ledger:
`classify_shapes` with `status="redundant"` and `covered_by` {path,
symbol} for a test another covers, `status="unused"` for one nothing
needs, a reason on each. A group judged to be distinct behaviours goes to
`review_test_group` with what each test checks that the others don't. A
test linked to nothing and kept says what it guards in an `exempt` reason.
4. **Break what the survivors claim to protect.** Choose three to five
behaviours the kept tests guard, break each one deliberately in the
product code, and confirm the tests go red; then revert. Run them where
the project's own rules say tests run. A test that stays green while its
behaviour is broken protects nothing, whatever its name says: rewrite it
or remove it.
5. **Land the area as one change** that does nothing but this review, so it
can be reverted alone. Behaviour changes found on the way are their own
issues, never folded in.
## After
- Rerun the same numbers and put them beside the baseline in the review's
task.
- List every removed test with its verdict and reason, in that task's log.
The list is what lets someone argue one back.
- A test is never removed to make a red build green. A failing test is a
finding about the code until a reading says otherwise.
## Report
Lead with the numbers (tests, lines, CI time, before and after), then the
removals by area with their reasons, then what the deliberate breaks proved
and anything they caught. A test found guarding a real bug's absence that
nobody knew about is the most valuable line in the report; say so plainly.