Repair tests that work badly
Fistron finds tests that work badly, proves it from its own records, proposes a repair as a pull or merge request, and checks on the request’s own CI that the repair holds. A person merges; a repair that fails is never merged by Fistron.
| Defect | Means | The repair must |
|---|---|---|
weak |
mutants survive on the lines it executes | kill those mutants |
no_assertion |
it asserts nothing | kill the mutants it executes |
flaky |
it passes and fails on the same revision | pass 20 repeated runs |
slow_without_contribution |
no unique coverage and no unique detected mutant | keep the suite’s coverage and detected mutants, and save time |
failing |
it fails by its own fault: the analysis of a failed build found the cause in the test | pass 3 repeated runs |
Before you start
- A licence with the feature
repair, and the closed core where the work runs. - Fistron’s records of the project: the CI history with targeted mutation runs, the Suite Health record and the flaky quarantine record (Review the health of your test suite, Handle flaky tests and quarantine).
- A model for the role
repairwhose data class allows the test’s code (Configure models (LLM endpoints)); without one, a repair is only described. - The configuration allows
propose-test-repair(levelproposeordecide) for the repository. - A job in the repository’s CI that runs what a repair request asks for (repair.md).
- In a control plane: the role Engineer to verify.
Find the bad tests and write their repairs
These steps run where the closed core is installed, for example in a CI job:
fistron repair find --project acme/shop --revision "$CI_COMMIT_SHA" \
--history ci-history.json --quarantine-record fistron-quarantine/quarantine.json \
--suite-health fistron-suite-health/suite-health.json --repository . --output fistron-repair
fistron repair write --record fistron-repair/found/<n>-<defect>-<test>/test-repair.json
find writes one record in the state found per bad test, with its proof.
A test that failed by its own fault comes from the analysis of the failed
build instead: fistron causes repairs <case> --repository . --output fistron-repair after fistron causes analyze
(repair.md).
write writes the change and checks it: only the test’s file, no
assertion removed, no skip, retry or expected failure added, and the patch
applies. Upload the records to the project with fistron upload
(admin-repositories.md).
Propose a repair
Start the operation propose-test-repair (on Work, in the local UI’s
Operations, or fistron propose test-repair) with a checked record and
the repository. Fistron opens one request per test on the branch
fistron/repair/<test>, with the proof, the change, the checks and what it
must pass. A change written by a model says so in its commit.
Verify and follow the repairs
- Open the project’s Repairs page. Above the table, the counts by state.
- Each test shows its newest record: Defect, State, Request, Verdict and Since. Click the test to open the record (proof, change, checks, what it must pass, verdict).
- After the request’s CI ran, click Verify the N open repairs, or Verify in one test’s row. The agent reads the newest finished run’s artifact, the closed core computes the verdict, and it is commented on the request.
- A repair that holds is merged by a person on the platform. One that fails says what failed.
| State | Means |
|---|---|
found |
the defect and its proof |
described |
no model may write it; a person writes it |
refused |
the change failed a check; never proposed |
checked |
passed every check; not proposed yet |
proposed |
its request is open |
holds, fails |
the verdict on the request’s CI |
merged, closed |
a person merged or closed the request |
Troubleshooting
| You see | Cause and fix |
|---|---|
| No repairs | No test_repair record was uploaded to the project yet. |
| “No agent has run it yet: the work waits in the project’s queue.” | No agent of the project answers (Install and register an agent). |
| “The agent found no open repair to verify.” | No repair is proposed, or no newer run finished since its last verdict. |
| A verification fails because a part is missing | The request’s CI job did not upload what the repair asks for (the artifact fistron-repair-runs, or the GitLab job fistron-repair). |
| The proposal is refused because the file changed | The default branch changed the test’s file: find and write the repair again. |
The repair stays described |
No endpoint for the role repair, or its data class does not allow the test’s code. |
Level merge is refused |
A person always merges a repair. |
Details: repair.md.