A quarantine entry addressed only by a test path can become unrecognizable after a rename. Reusing a hash of the test body has a different problem: two copies of a test can have exactly the same body. The maintainer needs a way to carry a known flaky test’s history forward without silently assigning the quarantine to another test.
Separate identity from evidence
Give each quarantine record an explicit ID and owner. Store the baseline revision and test node ID alongside a fingerprint describing the test. One possible fingerprint includes the package scope, normalized assertion structure, fixture inputs and parameter values. Preserve the actual expected literals and the fixtures that affect execution. A display name for a parameter is insufficient when the value behind that name can change.
Encode the fields unambiguously and version the fingerprint format. A cryptographic digest is useful for exact equality, but the number of changed digest bits is not a meaningful measure of how similar two tests are. When a fingerprint changes, compare the underlying assertions, test inputs and version-control history.
Handle each transition explicitly
| Change between baseline and candidate | Proposed action |
|---|---|
| One old test disappears and exactly one equivalent candidate is found | Show the proposed mapping and retain the quarantine history after review. |
| The original remains and a second test has the same fingerprint | Record a potential copy. Keep the original mapping and review the newcomer separately. |
| The test moves to a different package or fixture family | Recheck dependencies and the observed failure before inheriting the quarantine. |
| An assertion or expected value changes | Show the source-level change and rerun the affected behavior; do not infer similarity from the digest. |
| The original has no candidate | Confirm it existed at base, is absent at head, and was intentionally removed. Close the record under the project’s owner policy. |
If several tests match, retain the unresolved record for its owner. A fingerprint collision here can mean perfectly ordinary duplication: the same inputs to a correct hash produce the same value. File positions and line numbers can disambiguate a display but make poor durable identities.
Test the mapping
Start with one synthetic frozen test. Rename its function, move it between packages, change an expected literal, reorder labeled parameter cases, and then duplicate it beside the original. Test each transformation separately against the same untouched base. The copied case should preserve two test nodes even when both fingerprints are identical; neither should disappear when the fingerprints are stored. A map with a single test per digest would lose that distinction.
The fingerprint suggests candidates for a maintainer. The owner, expiry date and check for a reproducible failure still determine whether the test should remain quarantined.
This article was created with AI assistance.
Top comments (0)