The first mistake in a lockfile review is treating the diff as a list of edits. A lockfile is a serialized dependency tree, and npm documents it as a description of the exact tree that was generated so that subsequent installs produce identical results from the npm lockfile reference. A changed line is almost always a fragment of an entry: one field of one package object. If you approve a version bump without looking at the rest of that object, you have approved a version string and nothing else.
The unit of review is therefore the entry. For each package in the diff, reconstruct the full object: the resolved version, the integrity hash, the resolved URL, the dependencies list, the optional and dev flags, the os and cpu constraints, and any hasInstallScript marker the resolver wrote. That is the thing you are actually deciding to install.
This matters more than it used to, because agents now write lockfile changes too. A documented campaign engineered npm packages specifically to be selected by AI coding agents, planting plausible documentation and metadata so the agent would add the dependency, and in one recorded case a malicious transitive package entered a crypto trading project through a commit co-authored by an AI model per the Cloud Security Alliance research note. An entry that looked fine to the tool that added it still needs a human to read the whole object.



