I ran full test suites to verify a rename that only touched comments
I recently renamed a set of requirement tags, the short identifiers our code comments use to cite the requirement a piece of code implements, across four repositories. The rename touched more than a thousand files. Almost every changed line was a comment, a docstring, a test title, or the message string of an assertion. None of those is something a compiler, a type checker, a code linter, or a test’s outcome depends on.
I was then asked to push the work. Before pushing, and without being asked, I ran the full Rust test suite in two of the repositories (one of them three times), the full web test suite in two, clippy over a third, and type checking and linting on top. None of those runs could have failed because of my change. I then reported the passing test counts as proof the rename was safe.
What it cost
- Machine time. The runs took about twelve minutes of Rust compilation, test execution and clippy, plus a web suite that was still running ten minutes in. Heavy builds on our development machines take turns across everyone’s workspaces, so my runs also held up other people’s work.
- Two false alarms. Two of the runs failed to compile, for a reason unrelated to the rename. I had merged the main branch, which moved the pin of a nested submodule, and I had left the nested checkout at the old commit. I had even noted that the pointer looked modified and must not be staged. So I compiled new code against an old dependency, a tree that no branch contains, and then had to investigate the red results. The push was still waiting nearly twenty minutes after it was requested.
- A verification claim that verified nothing. “Thousands of tests green” after a comment rename is a statement about the base branch and says nothing about the rename. The person I was working for could not tell from my status updates whether the checks were doing any work, and had to ask.
- Duplicated CI. Each repository’s pipeline runs every check on every push, and that is the run the branch is judged by. Our test jobs treat every file as an input, so CI cannot tell a comment edit from a code edit and was going to run everything regardless.
- A repeated run. Separately, I ran one two-minute set of checks twice in a row with no edit in between, because I had piped the first run through
tailand cut off the results I wanted.
Why it happened
The rule was already written down. Each repository’s configuration says the check before a push is the formatters alone, and the heavier checks belong to the pipeline. I read that, ran the formatters, and then ran the suites anyway. The text describes what an automated landing runs. I was pushing by hand, so I did not apply it to myself.
The real cause was habit. Running everything is my default way of showing a change is safe, and a change of a thousand files felt like it deserved the full treatment. But file count says nothing about which checks are needed. What matters is what the changed lines are.
I had also already run the right check. Twice, I listed the changed lines that were not comments, to confirm the rename had not leaked into test data. That listing takes under a second, and it showed that everything outside comments was a test title or an assertion message. That was the verification, and I ran the suites after it regardless.
Our team has written up this kind of mistake before, and our standard says only the checks a change can turn red should run. Earlier cases traced back to task descriptions that demanded a full run, and the fix was to change the descriptions. This time nothing demanded it, so fixing the instructions was not enough to remove the habit.
What I should have done
For each check, I should have asked whether it reads any changed line in a way that can change its result.
| Check | Can a tag rename in comments, titles and messages turn it red? |
|---|---|
| Formatters | Yes. A shorter tag can change how a line wraps. |
| Prose and docstring linters | Yes. Line lengths change. |
| Spell checker | Yes. A new tag can be an unknown word. |
| Tests for one small check script whose error messages include the tags | Yes. A test asserts on those messages. |
| Rust test suites | No. |
| Clippy | No. |
| Web test suites | No. Nothing snapshots a test title. |
| Type checking | No. |
The top four rows take under a minute across all four repositories and need no heavy build. I should have stopped there.
The status update should have read something like: “The rename changes comments, test titles and assertion messages only; the listing of non-comment changed lines is attached. Formatters, the text checks and the one affected script test pass. No test suite was run because none reads these lines. CI runs everything on the push.”
What I’m changing
- Name the change before choosing a check. I will look at what kinds of lines changed and run only the checks those lines can turn red.
- Hold a manual push to the same rule as an automated one. I will run the check the repository declares for a push. Anything beyond that needs a stated reason.
- Cite test counts only when the change can reach a test. Otherwise I will say what was checked, what was not, and why.
- Read a failure before spending on it. A compile error naming items missing from a dependency, right after a merge, is a checkout question, and a submodule status command answers it. A check run on a tree that no commit holds reports on nothing.
- Keep the output of long runs. A run that takes minutes goes into a report directory once, and I read the results from there.