{{ message }}
fix(core): preserve default retry match when overriding retry options - #18295
Open
spokodev wants to merge 2 commits into
Open
fix(core): preserve default retry match when overriding retry options#18295spokodev wants to merge 2 commits into
spokodev wants to merge 2 commits into
Conversation
Contributor
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/test/unit/configuration.test.ts`:
- Around line 196-204: Add a separate regression test alongside the existing
explicit-match test using createSequelizeInstance with retry.match set to an
empty array, and assert localSequelize.options.retry equals { max: 5, match: []
}, confirming the empty match override is preserved.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 937e63d4-04e1-4e33-8c9d-bc6f478c4ad2
📒 Files selected for processing (2)
packages/core/src/sequelize-typescript.tspackages/core/test/unit/configuration.test.ts
spokodev
force-pushed
the
fix/retry-option-merge
branch
from
July 30, 2026 19:48
20a88dd to
7f6be4d
Compare
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.

Pull Request Checklist
Description of Changes
Closes #18259.
Sequelize's default retry policy is deliberately conservative:
Constructor options are shallow-merged, so supplying any
retryblock replaces the whole object. A config that only tunes backoff therefore loses the defaultmatch:In
retry-as-promised, an empty/absentmatchmeans retry on every error(
options.match.length === 0 || options.match.some(...)). So tuning backoff silently flips thepolicy from "retry one transient error" to "retry everything", including permanent ones: a losing
findOrCreatethat throwsUniqueConstraintErroris then retriedmaxtimes with full exponentialbackoff (the issue reports ~8s of wasted waiting and a pinned pooled connection) before failing,
where it should fail on the first attempt.
This merges the user's
retryonto the default instead of replacing it, so a partial override keepsthe default
matchwhile still letting callers override any field, includingmatch: []to opt intoretry-all explicitly. The merge is placed after the
...persistedSequelizeOptionsspread in theconstructor's option normalization (
packages/core/src/sequelize-typescript.ts).Tests (
packages/core/test/unit/configuration.test.ts, no DB): the default policy is kept when noretryis given; the defaultmatch(andmax) survive a partial override; an explicitmatchstill overrides. Failing before the change, passing after; the full
coreunit suite stays green(2263 passing).
List of Breaking Changes
None intended, but one observable difference is worth calling out: code that passed a partial
retryobject without
matchwas (likely unintentionally) getting retry-on-every-error; it now retains thedefault
match: ['SQLITE_BUSY: database is locked']. Callers who actually want to retry all errorsshould set
match: []explicitly.Summary by CodeRabbit