Repository navigation
test(bearer): per-bearer integration scenarios + recv buffering bug fix - #274
Merged
Merged
Conversation
…v bug fix
Adds two integration scenarios that exercise SshBearer end-to-end against
a real paired SSH listener — the safety net Joel asked for before the
monitor cutover (Phase 2b). Each future bearer kind (gh, local, ...)
gets parallel scenarios in the same shape: prove the transport works
in isolation BEFORE flipping production callers through it.
New scenarios
bearer_ssh_send:
- spawn host + paired joiner
- read host_target / remote_home / identity_key from joiner config
- pipe a signed envelope through `bearer_cli send`
- assert outcome.kind == "delivered"
- assert payload appears in host's messages.jsonl
bearer_ssh_recv:
- spawn host + paired joiner
- background a Python recv_stream driver
- sleep 3s for ssh to connect (tail -n 0 only sees lines after this)
- append a unique marker to host's log
- assert recv_stream yields the marker within 12s
- assert liveness reports a fresh ts after the recv
Bug surfaced + fixed
SshBearer.recv_stream() used bufsize=0 with text=False, which gives
a raw FileIO (not BufferedReader). Iterating yields chunks, not lines
— readline isn't even available on the raw object the way I called
it, and the old `for line in proc.stdout` would split on chunk
boundaries instead of newlines. Result: in production, ssh+tail
could be producing line-paced output and the bearer would block
forever waiting for a multi-KB chunk.
Fix: use Popen's default buffering (BufferedReader) + explicit
readline() in a while-loop. readline() blocks until \\n, and
BufferedReader knows how to read up to that delimiter.
Mock test was happy because the mock returned an iterator of pre-
split lines — no buffering involved. The integration test caught
it on real SSH+tail traffic. Exactly the per-bearer integration
test rationale.
Tests (36 unit + 2 integration scenarios)
- All 35 prior unit tests still pass (mock updated to use readline()
on a side_effect-driven Mock)
- bearer_ssh_send: 6/6 assertions pass
- bearer_ssh_recv: 4/4 assertions pass
Refs #270 (mesh observability — reliable per-bearer traffic is the
foundation for bearer-attested liveness in airc peers / airc status)
Refs #273 (Phase 2a — recv_stream + liveness skeleton; this PR proves
they work against real SSH and fixes the binary-mode buffering bug)
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds end-to-end integration coverage for the SSH bearer (send + recv) and fixes a real-world buffering/iteration issue in SshBearer.recv_stream that mocked tests did not detect, helping de-risk the upcoming Phase 2b monitor cutover.
Changes:
- Fix
SshBearer.recv_streamto use default buffering and explicitreadline()instead of iteratingproc.stdout. - Update Python unit test mocks to match the new
readline()-driven recv loop. - Add two new integration scenarios (
bearer_ssh_send,bearer_ssh_recv) and include them in the integration suite dispatch.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lib/airc_core/bearer_ssh.py |
Adjusts SSH tail subprocess reading to be line-correct in bytes mode (readline loop) and removes ineffective bufsize=1. |
test/test_bearer.py |
Updates recv_stream subprocess mock to provide stdout.readline() semantics + EOF signaling. |
test/integration.sh |
Adds real paired-SSH integration scenarios for bearer send/recv and wires them into all + CLI dispatch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2504
to
+2513
| local outcome | ||
| outcome=$(printf '%s' "$payload" | PYTHONPATH="$_lib_dir" python3 -m airc_core.bearer_cli send \ | ||
| "alpha" "general" \ | ||
| --host-target "$host_target" \ | ||
| --identity-key "$ikey" \ | ||
| --remote-home "$rhome" 2>/dev/null) | ||
|
|
||
| echo "$outcome" | grep -qE '"kind"[[:space:]]*:[[:space:]]*"delivered"' \ | ||
| && pass "bearer_cli reports delivered" \ | ||
| || fail "bearer_cli outcome unexpected: $outcome" |
Comment on lines
+2599
to
+2605
| # Give ssh ~3s to connect and start tailing. | ||
| sleep 3 | ||
| echo "$probe" >> "$hstate/messages.jsonl" | ||
|
|
||
| # Wait up to 12s for the recv driver to find the marker. | ||
| local i | ||
| for i in 1 2 3 4 5 6 7 8 9 10 11 12; do |
Comment on lines
+316
to
+322
| # Use BufferedReader (default bufsize) + explicit readline() | ||
| # rather than iter(proc.stdout). bufsize=0 with text=False | ||
| # gives a raw FileIO that doesn't yield lines on iteration; | ||
| # bufsize=1 (line-buffered) is text-mode only and falls back | ||
| # to 8KB buffering for bytes, delaying delivery by seconds. | ||
| # readline() blocks until \n arrives — which is immediately | ||
| # since ssh+tail flushes line-paced. Surfaced by |
joelteply
added a commit
that referenced
this pull request
Apr 29, 2026
* hotfix(install.sh): two Windows fresh-install regressions (#249) (#265)
* fix(install.sh): two Windows fresh-install regressions (#249)
Caught by continuum-b69f's wipe-and-reinstall test for the #249
release-readiness matrix (Windows Git Bash + PowerShell rows).
## Bug 1: install-elevated.ps1 staged in $CLONE_DIR before git clone
`_ensure_sshd_running` runs from `ensure_prereqs` (line 747/789),
which mkdir's $CLONE_DIR and writes install-elevated.ps1 to it BEFORE
the git clone step (line 872). Result on a fresh-install user (no
existing ~/.airc-src):
fatal: destination path 'C:/Users/green/.airc-src' already exists
and is not an empty directory.
Hostile error, no recovery hint. Workaround was AIRC_SKIP_PREREQS=1.
Fix: stage the .ps1 in $TMPDIR instead. The .ps1 is consumed by the
elevated PowerShell process (which reads from $env:TEMP via the
log-write Path); its location during install is irrelevant.
## Bug 2: airc.cmd + airc.ps1 forwarders not placed on PATH
install.sh's symlink step (line 881-884) only ln -sf'd the bash
`airc`, leaving airc.cmd and airc.ps1 in $CLONE_DIR but not on PATH.
Result: native PowerShell `airc` resolves to the bash script, which
PowerShell can't execute:
PS> airc version
Cannot run a document in the middle of a pipeline:
C:\Users\green\.local\bin\airc.
PR #262's collapse of airc.ps1 to a thin forwarder is moot if the
forwarder isn't reachable.
Fix: on MINGW*/MSYS*/CYGWIN*, `cp -f` airc.cmd + airc.ps1 to $BIN_DIR.
cp not ln -sf — Windows symlinks need elevation, copying is universal
and the forwarders are tiny.
* ci: retrigger policy check after retarget to canary
* feat(bearer): Phase 0 — abstract bearer seam, no behavior change (#271)
Introduces lib/airc_core/bearer.py + bearer_resolver.py + bearer_ssh.py
as the seam between airc and any message transport. Phase 0 is
scaffolding only: the ABC compiles, the resolver picks correctly, and
the SshBearer skeleton documents what Phase 1+ will fill in. Existing
SSH delivery in cmd_send.sh / cmd_connect.sh / monitor is untouched.
Why a separate Phase 0:
Phase 1 will thread cmd_send through bearer_cli, which is meaningful
surgery. Landing the seam definition first makes that surgery
reviewable in isolation — the abstraction either holds up under test
here, or it gets revised before any callers depend on it.
Modularity invariants codified in bearer.py docstring:
- The ABC speaks only in peer-id / channel / opaque bytes / lifecycle.
No SSH, gh, addresses, ports, hosts, signatures, or identities.
- Concrete bearers are imported by bearer_resolver.py and NOWHERE ELSE.
- Per-transport adapter rule: ALL Tailscale-specific code lives in
bearer_tailscale.py (when/if it exists); ALL gh-as-transport code
lives in bearer_gh.py. After the rewrite completes, grepping the
codebase for "tailscale" / "ssh" should match only that transport's
bearer module + its tests.
- gh has TWO roles in airc: identity/registry (control plane,
cmd_rooms + gistparse) AND transport (data plane, future
bearer_gh.py). The bearer abstraction encapsulates only the
transport role.
Bearer ABC shape:
- KIND class attribute (the transport's short name)
- can_serve(peer_meta) classmethod — pure, no IO
- open(peer_id) / send / recv_stream / liveness / close lifecycle
- ReceivedMessage + LivenessResult dataclasses (frozen, immutable)
- PeerUnreachable for fall-through-to-next-bearer signaling
Resolver:
- Ordered _REGISTRY of bearer types (preference order)
- resolve(peer_meta) → cheap-construct first candidate that says yes
- Raises PeerUnreachable when no bearer can serve
Tests (15 unit tests, runs as scenario_python_units in integration.sh):
- ABC enforcement: cannot instantiate abstract / partial subclasses
- Resolver picks SshBearer for peers with host_target
- Resolver raises PeerUnreachable for empty peer_meta
- SshBearer cheap-construct invariant (no IO on __init__)
- SshBearer open/close lifecycle, post-close operations raise
- Skeleton methods raise NotImplementedError with phase-pointer
guidance so debuggers know where the missing work belongs
Phase 1 (next PR): cmd_send.sh's SSH delivery primitive moves into
SshBearer.send(). cmd_send.sh shrinks to "build envelope, sign, hand
to bearer."
Phase 2: GhBearer added to the registry behind SshBearer.
Phase 3: cutover; SshBearer + Tailscale paths removed wholesale.
Refs #270 (mesh silent-degradation, root-caused as missing modularity)
Refs #269 (gh-bearer RFC; this is the foundation that makes #269
implementable as a one-file change)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* feat(bearer): Phase 1 — cmd_send through bearer seam, SSH knowledge consolidated (#272)
feat(bearer): Phase 1 — cmd_send goes through bearer seam, all SSH knowledge consolidates in bearer_ssh
cmd_send.sh's SSH delivery primitive (relay_ssh invocation, __APPENDED__
confirmation, Tailscale-CGNAT offline fast-path, auth-vs-transient error
classification) is now in lib/airc_core/bearer_ssh.py. cmd_send.sh shrinks
to "build envelope, hand to bearer, branch on SendOutcome.kind."
Adding a new transport (gh, Reticulum, anything) no longer touches
cmd_send.sh — the resolver registers it, the SendOutcome contract gets
honored, done. This is the modularity payoff that #270 root-caused as
missing.
What moved
airc:510 is_peer_offline_in_tailnet (40 lines)
→ lib/airc_core/bearer_ssh.py:_is_peer_offline_in_tailnet
Same CGNAT regex, same `tailscale status` parse, same user@ strip
(issue #78 root-cause defense). Phase 3 deletes both in one edit
when Tailscale leaves the codebase.
cmd_send.sh:228 relay_ssh "$host_target" "cat >> ... && echo __APPENDED__"
→ lib/airc_core/bearer_ssh.py:SshBearer.send()
Same ssh option set (-o StrictHostKeyChecking=accept-new -o ConnectTimeout=10
-o ServerAliveInterval=30), same identity-key handling, same
__APPENDED__ marker check.
cmd_send.sh:247-258 auth-failure stderr classification
→ lib/airc_core/bearer_ssh.py:_classify_ssh_failure
Same markers (Permission denied, publickey, Authentication failed).
How cmd_send invokes it
Builds the signed JSON envelope (unchanged), then:
payload | python -m airc_core.bearer_cli send <peer> <channel> \
--host-target ... --identity-key ... --remote-home ...
Outcome JSON: {"kind": "<delivered|queued_unreachable|auth_failure|transient_failure>", "detail": "..."}
Bash branches on .kind via case statement. queued_unreachable + transient_failure
go to pending.jsonl + a [QUEUED] marker; auth_failure surfaces loudly + dies;
delivered is the success path.
New SendOutcome contract (lib/airc_core/bearer.py)
Bearers return a structured SendOutcome instead of raising on normal
failure modes. Kinds are bearer-agnostic: any future bearer (gh,
Reticulum, etc.) populates the same set so callers never branch on
transport. The contract is enumerated and frozen — adding a new kind
requires updating callers, by design.
Tests (25 unit tests, +10 over Phase 0)
- send() returns "delivered" on __APPENDED__ in stdout
- send() returns "queued_unreachable" when tailscale reports offline
- send() returns "auth_failure" on Permission denied stderr
- send() returns "transient_failure" on Connection refused / timeout
- SSH argv built correctly: -i key, -p port, -o options, target last
- CGNAT regex accepts 100.64–100.127, rejects everything else
- user@ prefix stripped before CGNAT check (#78 defense preserved)
- SendOutcome immutability (frozen dataclass)
- Resolver threads peer_meta to bearer __init__
Behavior preservation
All paths in cmd_send.sh produce the same user-visible result as before:
- Successful send: nothing extra logged, last_sent updated
- Tailnet-offline peer: [QUEUED ... peer offline ...] in $MESSAGES,
payload to pending.jsonl, return 0
- Auth failure: [AUTH FAILED ...] in $MESSAGES, die with re-pair message
- Transient failure: [QUEUED ... network error ...] in $MESSAGES,
payload to pending.jsonl, stderr surfaced
Phases ahead
Phase 2: monitor's SSH-tail recv path → SshBearer.recv_stream()
heartbeat read → SshBearer.liveness()
Other relay_ssh callers (cmd_status, cmd_identity, cmd_rooms,
cmd_connect) thread through the bearer.
Phase 3: GhBearer + LocalBearer added; resolver flips defaults;
SshBearer + all Tailscale code deleted in one PR per the
"transport is just an adapter" rule (#269).
Refs #270 (mesh silent-degradation, root-caused as missing modularity)
Refs #269 (gh-bearer RFC; this is the seam #269 plugs into)
Refs #271 (Phase 0 — abstract bearer seam, scaffolding)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* feat(bearer): Phase 2a — SshBearer.recv_stream + liveness functional (#273)
Implements the recv side of the bearer abstraction. SshBearer now owns:
- SSH-tail subprocess lifecycle (Popen, reap, terminate-on-close)
- Tail-position computation from persisted offset (mirrors monitor's
rules: empty/0/non-numeric → -n 0; positive N → -n +N+1)
- Per-line JSON envelope parsing (drops malformed lines silently,
matches prior formatter behavior)
- Reconnection on SSH death (3s backoff, internal loop)
- Offset persistence on each received event so reconnect resumes past
the last yielded line
- Liveness signal via _last_recv_ts bumped on each line — natural for
this bearer (stream activity), parallel signal for future bearers
(gh: gist last-modified; local: socket activity)
Watchdog and any UX response to extended silence stay CALLER concerns
per the bearer.py contract — the bearer's job is to keep producing
events and answer liveness() honestly.
Phase 2a deliberately does NOT refactor the monitor in airc top-level
to use recv_stream(). That is Phase 2b's surgery: the existing
ssh|monitor_formatter pipeline keeps working, recv_stream is unit-
tested but unused. Splitting the implementation from the cutover
makes each PR small and revertible.
Tests (35 total, +10 in this phase)
- recv_stream raises with no host_target (programming error path)
- _parse_envelope drops non-JSON, empty, array, missing-from cases
- _parse_envelope accepts well-formed envelopes, preserves payload
+ populates bearer_metadata.envelope
- _compute_tail_position on missing/empty/0/non-numeric/negative
files all return -n 0
- _compute_tail_position resumes correctly past saved line
- recv_stream yields ReceivedMessage events for each valid line
- recv_stream silently skips malformed lines mid-stream
- liveness reports None pre-stream, fresh ts post-event
- close() terminates active recv subprocess (mock proc.terminate
asserted called)
- offset_file gets the right line count after recv events flow
Refs #270 (mesh observability — liveness through bearer is the
foundation for the airc-peers/airc-status fix in Phase 2b/2c)
Refs #272 (Phase 1 — cmd_send through bearer; this completes the
outbound+inbound data-plane consolidation in bearer_ssh.py)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* test(bearer): per-bearer integration scenarios + recv buffering bug fix (#274)
test(bearer): per-bearer integration scenarios + bufsize=0/binary recv bug fix
Adds two integration scenarios that exercise SshBearer end-to-end against
a real paired SSH listener — the safety net Joel asked for before the
monitor cutover (Phase 2b). Each future bearer kind (gh, local, ...)
gets parallel scenarios in the same shape: prove the transport works
in isolation BEFORE flipping production callers through it.
New scenarios
bearer_ssh_send:
- spawn host + paired joiner
- read host_target / remote_home / identity_key from joiner config
- pipe a signed envelope through `bearer_cli send`
- assert outcome.kind == "delivered"
- assert payload appears in host's messages.jsonl
bearer_ssh_recv:
- spawn host + paired joiner
- background a Python recv_stream driver
- sleep 3s for ssh to connect (tail -n 0 only sees lines after this)
- append a unique marker to host's log
- assert recv_stream yields the marker within 12s
- assert liveness reports a fresh ts after the recv
Bug surfaced + fixed
SshBearer.recv_stream() used bufsize=0 with text=False, which gives
a raw FileIO (not BufferedReader). Iterating yields chunks, not lines
— readline isn't even available on the raw object the way I called
it, and the old `for line in proc.stdout` would split on chunk
boundaries instead of newlines. Result: in production, ssh+tail
could be producing line-paced output and the bearer would block
forever waiting for a multi-KB chunk.
Fix: use Popen's default buffering (BufferedReader) + explicit
readline() in a while-loop. readline() blocks until \\n, and
BufferedReader knows how to read up to that delimiter.
Mock test was happy because the mock returned an iterator of pre-
split lines — no buffering involved. The integration test caught
it on real SSH+tail traffic. Exactly the per-bearer integration
test rationale.
Tests (36 unit + 2 integration scenarios)
- All 35 prior unit tests still pass (mock updated to use readline()
on a side_effect-driven Mock)
- bearer_ssh_send: 6/6 assertions pass
- bearer_ssh_recv: 4/4 assertions pass
Refs #270 (mesh observability — reliable per-bearer traffic is the
foundation for bearer-attested liveness in airc peers / airc status)
Refs #273 (Phase 2a — recv_stream + liveness skeleton; this PR proves
they work against real SSH and fixes the binary-mode buffering bug)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* feat(bearer): Phase 2b — monitor consumes bearer.recv_stream() via bearer_cli (#275)
The inbound-tail seam in airc's monitor() flips from inline ssh-tail
to `python -m airc_core.bearer_cli recv` piped into monitor_formatter.
The bearer (lib/airc_core/bearer_ssh.py) now owns transport-level
reconnects, line-buffering, and offset resume across SSH drops; the
bash loop owns ONLY higher-level policy: watchdog detection
(fmt_exit=2), idle-vs-dead probe, escalation counter → exit 99 →
daemon respawn.
Why this matters for #269 prep: with this seam in place, swapping
SshBearer for GhBearer or LocalBearer in Phase 3 changes nothing
in the bash monitor — the watchdog policy applies to any transport.
Changes:
- lib/airc_core/bearer_cli.py: new `recv` subcommand. Reads peer_meta
via the same flags as `send` plus --offset-file. Streams one line
per ReceivedMessage envelope (raw payload bytes + \n). Handles
BrokenPipeError gracefully so the bash watchdog can observe the
cycle end and reconnect us. Resolver errors surface to stderr (per
CLAUDE.md "never swallow errors") and return code 2.
- airc:1216-1227: replace `ssh ... "tail -F messages.jsonl"` with
bearer_cli recv. Stale-offset probe stays in bash (one-shot at
startup); the recurring tail_pos recompute is gone since the
bearer reads offset_file directly on each internal reconnect.
- test/test_bearer.py: BearerCliRecvTests — 6 tests covering envelope
emission, offset_file passthrough, None-meta drop, resolver-error
surfacing, BrokenPipe graceful exit, and parser registration.
- test/integration.sh: scenario_bearer_cli_recv — exercises the new
CLI on a real paired host. 4 assertions: marker emitted + JSONL-
parseable output. Wired into `all` and the case-dispatch.
Verified locally:
- python_units (test_bearer): 41/41 pass
- bearer_cli_recv: 4/4 pass
- bearer_ssh_send: 6/6 pass
- bearer_ssh_recv: 4/4 pass
- tabs (full bidirectional monitor flow): 19/19 pass
- events: 5/5 pass
- reconnect (host-down/up cycle): 7/7 pass
- resilience (stale pidfile + dead pidfile + malformed peer): 5/5 pass
- send_dead_monitor_dies (no-silent-success): 8/8 pass
- status (liveness + queue + last-activity): 7/7 pass
Phase 2c next: airc peers / airc status read membership and liveness
through bearer state to fix #270 observability lies.
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* feat(bearer): Phase 2c — bearer-attested observability replaces #270 lies (#276)
The previous airc status / airc peers surfaces lied during the 30+ minute
mesh outage in #270: "monitor running, last recv 2687s ago" while the
bearer was actually wedged. The fix replaces the messages.jsonl-mirror-
derived "last recv" with the bearer's own attestation, written cross-
process via a state file.
Mechanism:
- bearer_cli recv now accepts --state-file and writes per-event JSON
state: kind, peer_id, last_recv_ts, last_sender, events_total, diag.
Atomic write via tmp + os.replace so a reader never sees a partial.
Initialized on launch with last_recv_ts=null so "bearer up but quiet"
is distinguishable from "no bearer at all."
- airc:1223 wires --state-file "$AIRC_WRITE_DIR/bearer_state.json" so
the live monitor populates the surface.
- cmd_status reads bearer_state.json instead of parsing messages.jsonl.
Output: "bearer: Ns ago via ssh (N events; <bearer_diag>)" — truth
comes from the bearer that actually saw the wire.
- cmd_peers scans messages.jsonl once per invocation, computes last-
seen ts per from-field, renders "last seen Ns ago" with a (silent)
flag for >1h gaps. Disk records persist regardless of liveness;
this annotation makes silence visible.
The bearer.liveness() signal was already in place from Phase 2a — this
phase just bridges it across processes via the state file.
Tests:
- BearerCliStateFileTests (4 new): init-on-launch, per-event update,
no-state-file = no writes, atomic replace verified.
- scenario_bearer_observability (new, 7 assertions): state file
appears on first event; ts is fresh (<30s); kind=='ssh';
airc status reports "Ns ago via ssh"; airc peers shows last-seen.
- scenario_status (existing): +2 assertions for the new bearer line on
both host (n/a) and joiner (awaiting first event / Ns ago).
Verified:
- python_units (test_bearer): 45/45 pass (4 new state-file tests)
- bearer_observability (new): 7/7 pass
- status (with new bearer-line): 9/9 pass
- tabs (full bidirectional flow + peers regression): 19/19 pass
- whois: 5/5 pass; kick: 12/12 pass
Phase 3 next: GhBearer + LocalBearer + wholesale Tailscale removal
(closes #269). The seam is now load-bearing — swapping bearers will
flip "via ssh" to "via gh" with no other code changes.
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* feat(bearer): Phase 3a — LocalBearer for same-machine peers (#277)
Adds the second registered bearer kind. LocalBearer serves peers whose
host_target is a loopback alias AND whose remote_home is a writable
local directory — i.e. two airc tabs running on the same machine. They
currently SSH to 127.0.0.1 to talk to each other; LocalBearer skips
that entirely and uses direct filesystem reads/writes.
Why this matters before Phase 3b/3c:
- Validates the seam works for "any" transport with a second bearer in
the registry. Phase 3b's GhBearer plugs in the same way.
- Same-machine 2-tab sessions stop burning SSH crypto cycles. Hot path
for development workflows where you spawn multiple AI agents on one
laptop.
- Resolver-order test (LocalBearer first) is now a guarded contract.
Reversing it would silently regress all same-machine traffic to SSH.
Mechanism:
- lib/airc_core/bearer_local.py: pure-Python tail-F loop with rotation
detection, atomic O_APPEND send, per-event offset persistence, and
the same envelope-parse contract as SshBearer (so monitor_formatter
doesn't need to know which beare
Summary
Adds end-to-end integration tests for `SshBearer` against a real paired SSH listener — the safety net before the Phase 2b monitor cutover. Surfaces and fixes a real production bug in `recv_stream` that mocked unit tests couldn't catch.
The bug the integration test caught
`SshBearer.recv_stream` was calling `Popen(..., bufsize=0, text=False)` and iterating with `for line in proc.stdout`. With binary mode, `bufsize=0` produces a raw `FileIO`, not a `BufferedReader` — iterating yields chunks, not lines. In production, ssh+tail could be producing line-paced output and the bearer would block forever waiting for a chunk to fill.
Mock test passed because the mock returned an iterator of pre-split lines — no buffering involved. The integration test caught it on real SSH+tail traffic. Exactly the per-bearer integration test rationale.
Fix: use Popen's default buffering (BufferedReader) + explicit `readline()` in a while-loop. Blocks until `\n`, BufferedReader handles the delimiter.
New scenarios
The pattern: each future bearer kind (gh, local, anything) gets parallel scenarios in the same shape. Adding a new transport now means writing one bearer module + two integration scenarios. Removing one is the same cost in reverse.
Tests
Phase plan
Test plan
🤖 Generated with Claude Code