fix: close Hyperdrive client after query failures - #290
Draft
kaijakagi-sys wants to merge 4 commits into
Draft
Conversation
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.
Problem
A failed Hyperdrive query skips
sql.end()in the base implementation. Moving cleanup intofinallyfixes that leak, but an awaited cleanup rejection can then hide the original query rejection.Change
undefinedrejection reason.executionContext.waitUntil().Verification
Base:
bb227352135051a0dd50190d67c3e82b03f8e485. Updated head:958168e4086f5b1b0f0dbe75400193eb06c5c93a.bec45944ec3464ec1e2364a143c213f659bf4ed7: 2 failed, 8 passed.vitest run src/operation.hyperdrive.test.ts src/operation.test.ts: 21 passed.git diff --checkpass.These are local Node 22.23.2 / Vitest 2.1.8 tests; no live Hyperdrive deployment was tested. The repository CI uses Node 20, which was not tested locally.
Short demonstration
Recorded local regression results, not a deployment recording:
hyperdrive-regression.mp4
Scope
Related to #71. This is a narrow regression contribution, not completion of the repository-wide 75% coverage goal. #153 covers successful Hyperdrive cleanup; this change covers query-rejection cleanup and simultaneous failures. No reward has been agreed for this slice; keeping this draft pending scope/eligibility confirmation.