Skip to content

docs(decisions): record conn:AsyncConnection|None union as deliberate#142

Merged
lesnik512 merged 1 commit into
mainfrom
docs/decision-conn-union-deliberate
Jul 17, 2026
Merged

docs(decisions): record conn:AsyncConnection|None union as deliberate#142
lesnik512 merged 1 commit into
mainfrom
docs/decision-conn-union-deliberate

Conversation

@lesnik512

Copy link
Copy Markdown
Member

What

Records a design decision (no code change) in response to architecture-review candidate #5, which flagged the conn: AsyncConnection | None parameter on AbstractOutboxClient as a "type lie."

On close inspection it is a deliberate, documented widening (client.py:69-74), not an accidental lie, and the review's proposed narrowing doesn't hold:

  • conn is None ⟺ engine is None ⟺ fake client. The subscriber genuinely produces None on the fake path (_open_worker_resources yields writer_conn=None when engine is None); the real client always gets a live connection.
  • Narrowing the fake's signature alone changes nothing — the caller still hands None in. A cast(AsyncConnection, None) would replace an honest union with a cast that lies at runtime.
  • The only honest fix (move connection-acquisition behind the seam via an acquire_writer()/acquire_reader() handle) is a sizable refactor of the worker loop, fetch loop, both adapters, and the lease-token write path — disproportionate today.

The decision file captures this with a revisit trigger (a third adapter, or moving the connection lifecycle behind the seam for another reason) so future reviews don't re-litigate it.

Verification

  • just check-planningplanning: OK (decision indexed)

🤖 Generated with Claude Code

Architecture review candidate #5 flagged the `conn: AsyncConnection | None`
parameter on AbstractOutboxClient as a "type lie". On inspection it is a
documented, deliberate widening: `conn is None` iff the client is the fake
(no engine), the subscriber genuinely produces None on that path, and the
real client guards with TypeError. The proposed narrowing is unsound (a cast
would lie harder); the only honest fix is moving connection-acquisition behind
the seam, a sizable refactor not justified today.

Record the rationale + a revisit trigger so future reviews don't re-flag it.
No code change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512
lesnik512 merged commit 9a57d57 into main Jul 17, 2026
7 checks passed
@lesnik512
lesnik512 deleted the docs/decision-conn-union-deliberate branch July 17, 2026 08:13
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