test: cover direct browser stream cancellation - #148
Conversation
|
Post-merge verification. Passes cleanly (24 tests in this file), no objection to it landing. Flagging that it guards less than the title suggests, so it is not counted as coverage we have when we do not. Two things I checked:
More to the point, there is no analogous defect available to regress. The whole routing surface is two hooks in If you want this to earn its name, the assertion that would actually bite is that cancellation reaches the transport, for example by asserting the mock transport observed the disconnect rather than that the mock's own bookkeeping flag was set. Nit: |
Sayan-
left a comment
There was a problem hiding this comment.
Verified post-merge: passes, no objection. Approving; see the note above on what it does and does not guard.
|
addressed in #151. The test now records |
summary
tests
pytest -q— 671 passedruff check .pyright --pythonpath /tmp/kernel-python-venv/bin/python tests/test_browser_routing.pyNote
Low Risk
Test-only addition with no runtime code changes; low risk beyond CI/test maintenance.
Overview
Adds
test_async_telemetry_stream_cancellation_survives_direct_routing, which exercisesAsyncKernelwhentelemetry/streamis allowlisted for direct browser VM routing.The test uses a mock
httpx.AsyncByteStreamthat blocks until the stream consumer is cancelled, then asserts the consumer raisesCancelledErrorand the underlying response read/teardown completes (viaread_stopped). It also pins that the request hits/browser/kernel/telemetry/streamon the cached browser route.No production or SDK behavior changes—only regression coverage for cancelling long-lived SSE reads on direct-routed telemetry streams.
Reviewed by Cursor Bugbot for commit b136c50. Bugbot is set up for automated code reviews on this repo. Configure here.