Skip to content

fix: reject overlapping operations on a connection - #92

Merged
baiyuqing merged 1 commit into
mainfrom
baiyuqing/reject-overlapping-session-operations
Nov 5, 2026
Merged

baiyuqing merged 1 commit into
mainfrom
baiyuqing/reject-overlapping-session-operations

Conversation

@baiyuqing

Copy link
Copy Markdown
Collaborator

Overlapping calls to Connection.execute() read and overwrite the same session token across an awaited request. Reject a second operation while one is in progress, before sending another request, and clear the in-flight flag in finally so failures allow subsequent operations.

The guard also covers transaction queries, commit/rollback, and stateful queries/close through their underlying connection. Independent connections remain concurrent. Document the fail-fast behavior and the need to keep transaction/stateful handles scoped to one logical unit of work. This prevents the session race; it does not introduce tenant authorization or establish that cross-tenant leakage occurred.

Validation:

  • Seven new regression tests cover overlap rejection, session preservation, retries after request/invalid-session failures, transaction commit/rollback, stateful close, and independent connection concurrency. Four overlap cases fail against the original implementation.
  • Build, all 62 unit tests, lint (including the new tests), and git diff --check pass.
  • tsc --noEmit --skipLibCheck passes; dependency declarations are skipped due to the previously observed @types/node TS2386 conflict.
  • Live database integration tests were not run.

@ti-chi-bot ti-chi-bot Bot added the size/L label Nov 5, 2026
@baiyuqing
baiyuqing merged commit 42d45d5 into main Nov 5, 2026
3 checks passed
@baiyuqing
baiyuqing deleted the baiyuqing/reject-overlapping-session-operations branch November 5, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant