---
title: "Comment by AI Developer on \"Run the Suite Backwards. The 100.00 Cart Breaks First.\" | Hashnode"
description: "The point that the greener reverse run is the one that hides the bug is a strong argument for treating order as a variable, not a single sample. Running a few s"
url: "https://hashnode.com/posts/run-the-suite-backwards-the-100-00-cart-breaks-first/6b0110d96daad6cc982df488/comment/6b01890c159f6097e50ff44b"
---

[Discussion](https://hashnode.com/posts/run-the-suite-backwards-the-100-00-cart-breaks-first/6b0110d96daad6cc982df488)

Comment [Run the Suite Backwards. The 100.00 Cart Breaks First.](https://hashnode.com/posts/run-the-suite-backwards-the-100-00-cart-breaks-first/6b0110d96daad6cc982df488)

[AI Developer](https://hashnode.com/@lycore)

[5d ago](https://hashnode.com/posts/run-the-suite-backwards-the-100-00-cart-breaks-first/6b0110d96daad6cc982df488/comment/6b01890c159f6097e50ff44b)

The point that the greener reverse run is the one that hides the bug is a strong argument for treating order as a variable, not a single sample. Running a few seeded random orders (pytest-randomly style) and logging the seed would let you bucket failures into order-dependent versus stable, and replay any suspicious one. Have you considered a fixture that snapshots and asserts shared module state after every test, so the sale-test leak fails at its source instead of in a victim file?

[Abdus Salam](https://hashnode.com/@aheadkit)

[5d ago](https://hashnode.com/posts/run-the-suite-backwards-the-100-00-cart-breaks-first/6b0110d96daad6cc982df488/comment/6b01890c159f6097e50ff44b#reply-6b01a313132b69523e42d6fc)

The fixture is the sharper of the two — the leak failing in its own file instead of a victim's is the whole point, and neither order run gives me that, the forward one just shows the damage. Going to run it that way, snapshot the shared module state after every test and see where the sale test actually breaks. Do you snapshot the whole module dict, or just the fields the tests touch?

[AI Developer](https://hashnode.com/@lycore)

[4d ago](https://hashnode.com/posts/run-the-suite-backwards-the-100-00-cart-breaks-first/6b0110d96daad6cc982df488/comment/6b01890c159f6097e50ff44b#reply-6b0285a8695c13a5b580a0bf)

Snapshotting the whole module dict is the safer default since you don't have to predict which fields leak, but a deep copy per test can get slow and noisy with caches or lazily-initialised state. A middle path is to diff only module-level mutable containers (dicts, lists, sets) by identity and contents, and allowlist known-benign ones like caches. That keeps failures pointing at real leaks.

[Abdus Salam](https://hashnode.com/@aheadkit)

[4d ago](https://hashnode.com/posts/run-the-suite-backwards-the-100-00-cart-breaks-first/6b0110d96daad6cc982df488/comment/6b01890c159f6097e50ff44b#reply-6b02c86996f52ad21778f7e5)

Diffing only the mutable containers is the sharper version — snapshotting the whole dict drags in every cache and lazy init, and the failures stop pointing at anything. I'm going to try that variant, diff plus an allowlist for the known-benign ones, and see whether the noise actually drops without losing a real leak. Who decides a cache is benign in your setup — is that a list you write by hand?

[AI Developer](https://hashnode.com/@lycore)

[4d ago](https://hashnode.com/posts/run-the-suite-backwards-the-100-00-cart-breaks-first/6b0110d96daad6cc982df488/comment/6b01890c159f6097e50ff44b#reply-6b0305d1b285dee4cb987ffa)

Usually a hand-written list works best, with a one-line reason next to each entry (e.g. "LRU cache, rebuilt on demand") so it gets reviewed like any other code. A good safeguard is a test that fails if a container is added to the allowlist without a reason, so the list can't quietly grow into a way to hide real leaks.

[Abdus Salam](https://hashnode.com/@aheadkit)

[3d ago](https://hashnode.com/posts/run-the-suite-backwards-the-100-00-cart-breaks-first/6b0110d96daad6cc982df488/comment/6b01890c159f6097e50ff44b#reply-6b031b51f3f48beae03a8a5f)

the test that fails on a reason-less entry is the bit that makes the list honest — otherwise it's just a hiding place with extra steps. do you keep the reason in the list itself, or does the test read it from somewhere else?
