unsorted-dict-iteration
Dictionary iteration without a canonical sort order
Applies to: Go, Python, Ruby
Why this matters
In Go, map iteration order is deliberately randomized every run. In Python (3.7+) and Ruby (1.9+), dict/hash iteration follows insertion order — deterministic within a run, but it changes whenever insertion order changes, so hashed/serialized/diffed output built from the loop isn't canonical across code changes. Sorting gives a canonical order in every language.
Catch it before it ships
pip install stablestack # or: npx stablestackstablestack # scans your project, DET001 includedstablestack explain DET001DET001 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.
False positive in your codebase? Suppress a single line with # noqa: DET001
More Determinism checks
unsorted-set-iteration
Set iteration without sorting can produce unpredictable order
DET003missing-sort-tiebreaker
Sorting by a single field without tiebreaker can produce unstable order
DET004list-set-dedup
Using list(set(...)) for deduplication scrambles element order
DET005random-without-seed
Random values without seed cause non-reproducible behavior
DET006datetime-now-usage
datetime.now() makes code non-deterministic and hard to test
DET007unsorted-directory-listing
Directory listings have no guaranteed order across systems
DET008hash-unsorted-collection
Hashing dicts/sets without sorting produces inconsistent cache keys
DET009uncached-llm-call
LLM API call without @cache decorator wastes money on duplicate requests