Skip to content

Fix concurrent transactions on the same connection - #77

Open
devkral wants to merge 9 commits into
mainfrom
devkral/fixes/concurrent_transactions
Open

Fix concurrent transactions on the same connection#77
devkral wants to merge 9 commits into
mainfrom
devkral/fixes/concurrent_transactions

Conversation

@devkral

@devkral devkral commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Changes:

  • refactor code, add glue component BoundTransaction
  • Fix concurrent transactions on the same connection
  • Fix non-keyword timeout parameters
  • bump version

Review in cubic

@devkral
devkral force-pushed the devkral/fixes/concurrent_transactions branch from f5768dc to aa1bf52 Compare August 17, 2026 04:19

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread databasez/core/transaction.py Outdated
Comment thread databasez/core/connection.py Outdated
Comment thread databasez/core/transaction.py Outdated
Comment thread databasez/core/transaction.py Outdated
Comment thread databasez/core/transaction.py Outdated
Comment thread databasez/interfaces.py
Comment thread tests/test_transactions.py

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.

Re-trigger cubic

Comment thread databasez/core/connection.py

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread databasez/core/transaction.py Outdated
Comment thread databasez/core/transaction.py Outdated
@devkral
devkral force-pushed the devkral/fixes/concurrent_transactions branch from 31537dd to da9a5cd Compare August 19, 2026 07:00

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="databasez/core/transaction.py">

<violation number="1" location="databasez/core/transaction.py:130">
P2: When an outer transaction waits for a long-lived inner transaction, this zero-duration polling loop consumes CPU for the entire wait. Wait on the transaction condition and notify all finalization waiters when the stack changes, or use a positive bounded polling interval.</violation>

<violation number="2" location="databasez/core/transaction.py:415">
P2: Adding keyword-only markers to the public transaction controls breaks callers that pass the existing timeout argument positionally. Preserve the positional signatures, or introduce this API change deliberately with a compatibility plan.</violation>
</file>

<file name="databasez/core/connection.py">

<violation number="1" location="databasez/core/connection.py:76">
P2: When a full-isolation connection is re-entered during the previous isolation thread's shutdown, this guard raises instead of waiting for the running thread lock. The existing `with _connection_thread_running_lock` already serializes startup; remove the pre-check or retry startup after the old thread releases the lock.</violation>

<violation number="2" location="databasez/core/connection.py:437">
P2: The new keyword-only separator breaks existing callers that pass `timeout` positionally on a `Connection`. Preserve positional compatibility while still extracting positional timeouts for multiloop proxying, or provide a compatibility signature before making this parameter keyword-only.</violation>
</file>

<file name="databasez/core/database.py">

<violation number="1" location="databasez/core/database.py:789">
P2: Existing callers that pass the optional timeout positionally, such as `database.connection(5)` or `await database.fetch_all(query, values, 5)`, now fail with `TypeError` before executing. Preserve the existing positional-compatible signatures or add a compatibility path for positional `timeout`.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread databasez/core/transaction.py Outdated
Comment thread databasez/core/transaction.py
Comment thread databasez/core/connection.py
Comment thread databasez/core/connection.py Outdated
Comment thread databasez/core/database.py
Changes:
- expose threading prefix
- timeout is now kwargs only (requirement of multiloop_protector)
- same change for database for alignment
@devkral
devkral force-pushed the devkral/fixes/concurrent_transactions branch from f2edebb to a52f99c Compare August 19, 2026 23:44

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread databasez/core/connection.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant