On Tuesday a clean install produced one dependency tree. On Friday the same manifest, untouched, produced another. Nothing in the build was misconfigured; the range simply permitted a new patch, and that patch changed a package two levels down. The bug report said it worked on one machine and not another. The cause was duller than that: a version range states an intention, and the resolver reads it as permission.
What a range actually says
Semantic Versioning 2.0.0 defines a version as X.Y.Z. A MAJOR bump signals incompatible API changes, MINOR adds backward-compatible functionality, and PATCH covers backward-compatible fixes. Once a version is published, its contents must not be modified; a correction has to ship as a new version. The spec reserves 0.y.z for initial development, where the public API should not be treated as stable, and marks 1.0.0 as the point where that API is defined. Prerelease forms rank below their associated release, and build metadata is ignored when precedence is compared.
The specification says version numbers exist to communicate intentions to the users of software. Two lines later it concedes that the real world is a messy place, and that downstream verification is still required. That concession is the whole story. A range is a maintainer's claim about compatibility; whether the code that arrives on a machine behaves that way is still an open question.
The lockfile is the actual answer
The npm CLI documentation for v12 calls package-lock.json a manifestation of the manifest. It describes the exact tree that was produced, so a later install regenerates the same tree regardless of intermediate dependency updates. Since npm v7 the lockfile carries the full package tree. The same document says it is intended to be committed into source repositories, which lets teammates, deployments, and CI install identical dependencies, makes it possible to walk back node_modules without committing that directory, exposes tree changes in a readable version-control diff, and skips repeated metadata resolution.
lockfileVersion is tied to npm releases: 1 corresponds to npm v5 and v6, 2 to npm v7 and v8 with backward compatibility for 1, and 3 to npm v9 and above. From npm v12 onward npm no longer reads or writes npm-shrinkwrap.json; projects that relied on it are told to rename the file. All of this is npm's own guidance for the npm ecosystem, not a universal rule for every package manager, and any cross-version claim needs the version attached. A lockfile also is not an SBOM and not build provenance — it records a resolved tree, not where the artifacts came from or what they contain beyond names and versions.
| Layer | Question it settles | What still escapes |
|---|---|---|
| Range in the manifest | What compatibility the maintainer intends | Which exact bytes land in a fresh install |
| Committed lockfile | One reproducible tree, including transitive versions | Packages outside that package manager's view |
| Automated update flow | When drift is noticed | Whether a bump is safe without tests |
Small steps beat an annual migration
Chapter 21 of Software Engineering at Google, written by Titus Winters and edited by Lisa Carey, calls the version value a maintainer's estimate and self-attestation. Building a SAT solver on top of it amounts to treating estimates and self-attestation as absolute. The chapter devotes sections to SemVer Might Overconstrain and SemVer Might Overpromise: a range can be too tight or too loose. Its diamond dependency example puts liba and libb on incompatible versions of libbase, owned by different organizations, leaving libuser with no general way to assemble the graph. Direct and indirect dependencies accumulate over time, so postponing upgrades tends to end in one expensive and difficult jump.
The chapter's Live at Head idea means continuously tracking current versions, with tests and CI experimentally validating visible downstreams instead of relying on a maintainer's judgment about safety. Smaller steps forward in dependency updates are safer than pouring a year of work into a single commit. The same chapter states plainly that Live at Head is largely unproven at scale. That is a Google engineering position and an open experiment; calling it a settled industry default would misread the source.
Start automating on day one
The OWASP Vulnerable Dependency Management Cheat Sheet recommends automating dependency analysis from the moment a project begins. Deferring it to the middle or end accumulates work and can block the project outright. When a vulnerability sits in a transitive dependency, the response should act on the direct dependency: editing transitive packages by hand tends to damage stability and requires understanding the whole chain. Its first case upgrades the version in a test environment and only pushes to production after tests pass. The page describes its own advice as not a silver bullet and centers on vulnerability response, so it should not be recast as a rule about committing lockfiles.
The rhythm that holds
The three pieces fit together. The manifest declares what compatibility is intended. The lockfile fixes one tree for everyone who installs from the repository. Automation keeps the distance between declared intent and installed reality small enough that a change arrives as one reviewable diff. CI then runs that locked tree, so a passing build means the same set of bytes that will be deployed. When an upgrade fails, the rollback is one version rather than a quarter of accumulated debt, and the investigation starts from a diff a human can read.
A quarterly cleanup feels responsible and behaves like a lottery. Cross Mini App folds dependency governance into the everyday work around its shared runtime so the subject stays visible long after a project launches.