Sources of Non-Determinism
What you'll learn: You'll discover the most common culprits that make builds produce different outputs even from identical source code.
The Problem
A reproducible build means that given the same source code and build environment, you should get byte-for-byte identical output every time. But many builds fail this test because they accidentally introduce non-determinism—variability that makes each build slightly different.
Think of it like baking cookies: if you use the same recipe but one batch records today's date on each cookie, they'll never be identical to tomorrow's batch, even though the recipe hasn't changed.
Common Sources of Non-Determinism
Timestamps
Build tools often embed the current time into artifacts (compilation time, file modification dates, archive headers). Each build captures a different moment.
Build Paths
Absolute file paths on your machine (like /home/yourname/project/src/main.js) might get embedded in debug info or error messages. Different machines = different paths = different output.
File Ordering
When processing multiple files, the order might depend on filesystem listing order, which varies by OS or filesystem. Hash map iteration can also be non-deterministic.
Random Values
Some tools generate random IDs, session tokens, or salts during builds. Each run produces different random values.
Environment-Dependent Behavior
Builds might behave differently based on environment variables, system locale, timezone, or available system resources that weren't explicitly controlled.
Key Takeaway: Non-determinism in builds typically comes from timestamps, build paths, file ordering, random values, and unconstrained environment variables—understanding these sources is the first step to achieving reproducible builds.