Document the v4 fire-and-forget breaking change - #71
Closed
freshlogic wants to merge 2 commits into
Closed
Conversation
In v3, fetch, fetchAndRefresh, and five semaphore methods defaulted a missing callback to a noop, so callback-less calls were legal and silently discarded errors. In v4 those calls return a promise, and an error that was previously swallowed becomes an unhandled promise rejection that terminates the process on Node.js 15+. The 4.0.0 changelog entry and README intro now say so. Also corrects CLAUDE.md's stale Mocha test commands and removes the async dependency dropped in v4. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Coverage Report for CI Build 30878693243Coverage remained the same at 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
An awaited callback-less call is correct v4 usage. The dangerous pattern is omitting the callback and discarding the returned promise — which every callback-less call written against v3 necessarily is, because these methods previously returned nothing to await. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
node:test, not Mocha) and removes theasyncdependency dropped in v4.Why
In v3, seven methods —
fetch,fetchAndRefresh, and thesemaphoremethodsconsumeLock,expand,releaseLock,reset, andretrieveOrCreate— defaulted a missing callback to a noop, so calling them without a callback was legal and silently discarded errors. In v4 those same calls return a promise, so an error that used to be swallowed becomes an unhandled promise rejection, which terminates the process on Node.js 15 and later.Verified side-by-side against a live Redis:
semaphore.releaseLock(missingKey, 0)with no callback exits cleanly on 3.7.0 and dies with an unhandled rejection on 4.0.0.The major version bump covers this under semver, but neither the changelog nor the README called it out, and it is exactly the kind of change consumers need to audit their call sites for before upgrading.
Docs only — no code changes.
🤖 Generated with Claude Code