Long Scenario: Your Package Broke and You Changed Nothing
Illustrative only; the packages and timings are invented. "Package M" is a command-line formatter maintained by a volunteer, Maintainer C. Package M depends on "Package N", which in turn depends on "Package O". One morning Package M's issue tracker fills up, although its last release was months ago. This walkthrough follows Maintainer C through the decisions that follow.
The chain
package-m 2.1.0
└── package-n ^3.2.0
└── package-o ^1.4.0 (1.5.0 published last night)
Package O 1.5.0 changed a function to return a promise instead of a value. Its authors considered it a minor improvement. Package N calls that function synchronously, so it now receives a promise object where it expected a string. Package M's users see output that reads [object Promise]. Nobody in the chain except O's authors made a change, and each user's lockfile, if they had one, protected them until it was regenerated.
Decision 1: confirm where the fault is
Maintainer C reproduces the bug in a clean directory and runs npm ls package-o to see the resolved version. Installing with the previous lockfile works; a fresh install fails. That isolates the cause to a newly resolved transitive version within a few minutes. What if C skipped this and started patching Package M's code? They might paper over the symptom, for example by awaiting a value that should never be a promise, and leave the real incompatibility in place.
Decision 2: who should fix it?
The proper fix lives upstream: either O restores the old behaviour in 1.5.1 and moves the change to 2.0.0, or N adapts. C opens a concise issue on O's tracker with a minimal reproduction and a link to the semver.org definition of a minor release, and notifies N. Being polite matters here; O's maintainers are probably volunteers too.
Decision 3: what to do while waiting
Users need relief today. The options, from least to most invasive:
| Option | How | Downside |
|---|---|---|
| Advise users to pin | "overrides": { "package-o": "1.4.x" } in their package.json (npm 8.3+) | Every user must act; easy to forget to remove |
| Add a direct dependency pin in M | Declare package-o: "~1.4.0" in M so the resolver may dedupe | Not guaranteed to change N's resolution; can install two copies |
| Publish M 2.1.1 with a guard | Detect a promise and await it, with a comment linking the upstream issue | Adds code that must be removed later |
Maintainer C chooses to post the overrides snippet in a pinned issue immediately, since it helps everyone within minutes, and holds off on code changes for a day to see whether O responds.
Decision 4: after the upstream fix
Suppose O publishes 1.5.1 that reverts the change. Fresh installs heal automatically. C updates the pinned issue telling users to delete their override, then closes duplicates with a link. What if O declines to revert? Then N needs a release that handles the new return type, and M may need to raise its range on N. That is a slower path, and the overrides workaround stays in use longer.
Prevention for next time
- Run a scheduled CI job that installs without a lockfile, so upstream breakage is caught before users report it.
- Keep a lockfile in the repository for development, while remembering it does not protect users who install the library; see dependency range practices.
- Keep the dependency tree shallow where a small helper can be written in place.