Skip to content

Commit 59755ea

Browse files
Drop ISSUE/cycle workflow refs and stale line numbers from comments
Six in-source workflow citations across the client / dbapi / SA-base ("ISSUE-39", "ISSUE-159", "ISSUE-198", "ISSUE-631", "ISSUE-696", "cycle-18") leaked from review notes into shipped source. The surrounding prose already explains the rationale; the bare token is a footnote-to-the-tracker that goes stale silently when issues are renumbered or moved. Also fix two stale line-number citations: protocol.py's heartbeat-cap comment cited line 82 / line 106 which now hold an unrelated helper's docstring and a parameter declaration; replace with function-name references that survive line drift. Update _check_in_use docstring to list all four guards (the cycle 20 fork-pid check was added but the docstring still listed three). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a558b94 commit 59755ea

5 files changed

Lines changed: 18 additions & 13 deletions

File tree

src/dqliteclient/cluster.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ def __init__(
136136
# share the in-flight discovery task instead of each launching
137137
# an independent per-node sweep — under a leader flip with N
138138
# waiting acquirers, this collapses N×M handshake attempts
139-
# against the failing ex-leader into M (one sweep). See
140-
# ISSUE-631 for the stampede shape this closes. Slots are
139+
# against the failing ex-leader into M (one sweep). Slots are
141140
# cleared on done-callback so a fresh probe re-runs after the
142141
# current task finishes; consecutive callers do NOT share a
143142
# cached failure.

src/dqliteclient/connection.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ async def _close_impl(self) -> None:
11921192
# failed-connect path already clears this in ``connect()``'s
11931193
# finally block, but the successful-close path was missing the
11941194
# symmetry. Mirrors the loop-reset done by the dbapi-async
1195-
# adapter on close (``done/ISSUE-159``).
1195+
# adapter on close.
11961196
self._bound_loop = None
11971197
if self._protocol is None:
11981198
return
@@ -1275,7 +1275,10 @@ def _ensure_connected(self) -> tuple[DqliteProtocol, int]:
12751275
return self._protocol, self._db_id
12761276

12771277
def _check_in_use(self) -> None:
1278-
"""Raise on misuse: wrong event loop, concurrent access, or use after pool release."""
1278+
"""Raise on misuse, in this order: cross-process (fork) use,
1279+
use after pool release, missing async context, wrong event
1280+
loop, concurrent operation, or transaction owned by another
1281+
task."""
12791282
if os.getpid() != self._creator_pid:
12801283
raise InterfaceError(
12811284
"Connection used after fork; reconstruct from configuration in the target process."
@@ -2136,7 +2139,7 @@ async def transaction(self) -> AsyncIterator[None]:
21362139
# server already auto-rolled-back. The connection
21372140
# is healthy; preserve it and re-raise the body
21382141
# exception. Mirrors the dbapi layer's
2139-
# _NO_TX_CODES whitelist (ISSUE-696).
2142+
# _NO_TX_CODES whitelist.
21402143
if _is_no_tx_rollback_error(roll_exc):
21412144
logger.debug(
21422145
"transaction(address=%s, id=%s): rollback "

src/dqliteclient/pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ async def acquire(self) -> AsyncIterator[DqliteConnection]:
10061006
# the user's original error. Narrow to
10071007
# ``RuntimeError`` so programming bugs
10081008
# (``AttributeError``, ``TypeError``, etc.)
1009-
# still surface — see done/ISSUE-198.
1009+
# still surface.
10101010
logger.debug(
10111011
"pool.acquire cleanup: conn.close(%r) raised RuntimeError",
10121012
getattr(conn, "_address", "?"),

src/dqliteclient/protocol.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@
5757
# sane operational tuning (``config.c`` defaults to 15 s; 300 s fits
5858
# 20× that with plenty of headroom) while still bounding the widening
5959
# to a known scale. Changes here must be reflected in the
60-
# ``trust_server_heartbeat`` docstrings at protocol.py:82 and :106,
61-
# connection.py:__init__ docstring, and the top-level ``connect`` /
62-
# ``create_pool`` docstrings in ``__init__.py``.
60+
# ``trust_server_heartbeat`` docstrings on ``DqliteProtocol.__init__``
61+
# and ``DqliteProtocol.handshake``, ``DqliteConnection.__init__``,
62+
# and the top-level ``connect`` / ``create_pool`` docstrings in
63+
# ``__init__.py``.
6364
_HEARTBEAT_READ_TIMEOUT_CAP_SECONDS: Final[float] = 300.0
6465

6566

tests/test_transaction_fork_diagnostic.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ async def test_transaction_after_fork_raises_fork_diagnostic_not_cross_task() ->
4040
fake_parent_pid = conn._creator_pid + 1
4141
conn._creator_pid = fake_parent_pid
4242

43-
with patch("dqliteclient.connection.os.getpid", return_value=fake_parent_pid + 1):
44-
with pytest.raises(InterfaceError, match="fork") as excinfo:
45-
async with conn.transaction():
46-
pass
43+
with (
44+
patch("dqliteclient.connection.os.getpid", return_value=fake_parent_pid + 1),
45+
pytest.raises(InterfaceError, match="fork") as excinfo,
46+
):
47+
async with conn.transaction():
48+
pass
4749

4850
# The diagnostic must be the fork message, not the cross-task one.
4951
msg = str(excinfo.value)

0 commit comments

Comments
 (0)