Replace magic numbers and repeated string literals with named constants
Unexplained numbers and repeated literals given names, so the next reader does not have to guess.
The ticket
Replace magic numbers and repeated string literals in one module with named constants.
Acceptance criteria
- Each value is named for what it means rather than what it is
- The constant is used at every site that had the literal
- Behaviour is unchanged
- Values that differ only by coincidence are not merged
What lands as proof
An unchanged test suite plus a diff where each literal became a name, not a shared name for unrelated values.
Why teams defer it
- Whoever wrote it knew what the number meant, and the cost lands on everybody after.
- Merging two values that happen to be equal creates a bug, so it needs care rather than a search and replace.
Questions
- What does the agent actually change?
- The ticket is scoped to one outcome: replace magic numbers and repeated string literals in one module with named constants. Work that serves that outcome is in scope, and anything outside it is left for a separate ticket, so the pull request stays reviewable.
- How do I know the work is done?
- The pull request carries the evidence, not only the diff. Here that means behaviour unchanged, the constant used at every site, so a reviewer can confirm the result without reproducing the work locally.
- How much oversight does this need?
- None is required before the run starts. Every claim this ticket makes can be checked by machine, so the agent works straight through and a person reviews the finished pull request like any other.