Consolidate shouldFallbackToLocalRegistry into src/utils.js - #633
Merged
Abdulazeem-code merged 1 commit intoAug 29, 2026
Merged
Conversation
The Prisma-connection fallback check was copy-pasted, byte-identical apart from whitespace, in webhookRoutes.js and webhookWorker.js. Both now import the canonical implementation from src/utils.js, which server.js, userRoutes.js and statsService.js already use. No behaviour change. Also drops a dead `let userRecord = null` initializer in webhookRoutes.js that eslint's no-useless-assignment flags as an error; the pre-commit hook lints the whole file.
|
@Tijesunimi004 is attempting to deploy a commit to the Abdulazeem's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Tijesunimi004 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #587.
What changed
shouldFallbackToLocalRegistry— the check that decides whether a Prisma error means "database unreachable, use the local registry fallback" — was copy-pasted intosrc/routes/v1/webhookRoutes.jsandsrc/webhookWorker.js. The three copies (those two plus the canonical one insrc/utils.js) were byte-identical apart from a blank line.shouldFallbackToLocalRegistryfromsrc/utils.js, the same sourceserver.js,src/routes/v1/userRoutes.js, andsrc/services/statsService.jsalready use.src/utils.jshas no imports of its own, so this introduces no dependency cycle.No behaviour change — the consolidated implementation is identical to what each file was already running.
Incidental
Dropped a dead
let userRecord = nullinitializer inwebhookRoutes.js(userRecordis reassigned on every path before it is read). eslint'sno-useless-assignmentflags it as an error, and the pre-commit hook lints the whole staged file, so the line had to go for the commit to land.Acceptance criteria
src/utils.jssrc/utils.jsgrep -rn 'const shouldFallbackToLocalRegistry =' src server.js→ onlysrc/utils.js)--runInBand: 671/671)Note on the parallel test run
Running
npm testwith the default parallel workers,sql-injection.test.jsintermittently fails two cases (#35 Injection safety — GET /federation). This reproduces identically on a cleanupstream/maincheckout, passes in isolation (32/32) and under--runInBand(671/671), and is green on CI. It is a pre-existing cross-file test-isolation flake, unrelated to this change.