feat(0.9.0): remove per-process coverage counters; add nullrun.shutdown()#44
Merged
Conversation
…wn() Server-derived coverage replaces the in-process counter dicts. Counter-bump helpers (_safe_bump_coverage, _bump_streaming_skipped) are gone; every llm_call span now carries metadata.tracked and metadata.streaming_skipped flags so the backend's coverage_pct query can compute coverage from span metadata alone. BREAKING CHANGES - NullRunRuntime.coverage_report() removed. - NullRunRuntime._coverage_seen / _coverage_tracked / _coverage_streaming_skipped instance attributes removed. - NullRunRuntime.start_coverage_reporter() daemon thread removed (no longer called from init()). - _safe_bump_coverage / _bump_streaming_skipped helpers removed from nullrun.instrumentation.auto. - tests/test_coverage_report.py and tests/test_coverage_seen_httpx.py deleted — coverage is no longer an SDK-side concept. - llm_call wire shape: metadata.tracked: bool and metadata.streaming_skipped: bool are now authoritative; the separate coverage_report event is dropped. NEW API - nullrun.shutdown(timeout=2.0): sends a clean WebSocket close frame and drains in-flight events. Long-running scripts that exited via sys.exit() previously let the kernel RST the TCP socket, which the backend logged as WARN 'Connection reset without closing handshake'. Registering nullrun.shutdown in an atexit handler eliminates the noisy log. No-op if init() was never called. WIRE TEST - tests/test_llm_call_metadata_flags.py pins the new contract: every llm_call span carries metadata.tracked or metadata.streaming_skipped (the latter for streaming/oversize responses that the SDK deliberately does not buffer). Existing tests updated to match — no public API beyond the additions listed above is renamed or removed.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
maltsev-dev
added a commit
that referenced
this pull request
Jun 29, 2026
…45) Version bump after PR #44: server-derived coverage replaces the in-process counter dicts (every llm_call span now carries metadata.tracked / metadata.streaming_skipped flags), and nullrun.shutdown() is the new public API for graceful WS close on script exit. CHANGELOG entry added above 0.8.3. The breaking-change list (coverage_report() removed, daemon thread gone, helper functions removed, two coverage tests deleted) is fully documented.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Server-derived coverage replaces the in-process counter dicts. Counter-bump helpers (
_safe_bump_coverage,_bump_streaming_skipped) are gone; everyllm_callspan now carriesmetadata.trackedandmetadata.streaming_skippedflags so the backend'scoverage_pctquery can compute coverage from span metadata alone.BREAKING CHANGES
NullRunRuntime.coverage_report()removed.NullRunRuntime._coverage_seen/_coverage_tracked/_coverage_streaming_skippedinstance attributes removed.NullRunRuntime.start_coverage_reporter()daemon thread removed (no longer called frominit())._safe_bump_coverage/_bump_streaming_skippedhelpers removed fromnullrun.instrumentation.auto.tests/test_coverage_report.pyandtests/test_coverage_seen_httpx.pydeleted — coverage is no longer an SDK-side concept.llm_callwire shape:metadata.tracked: boolandmetadata.streaming_skipped: boolare now authoritative; the separatecoverage_reportevent is dropped.NEW API
nullrun.shutdown(timeout=2.0): sends a clean WebSocket close frame and drains in-flight events. Long-running scripts that exited viasys.exit()previously let the kernel RST the TCP socket, which the backend logged as WARN "Connection reset without closing handshake". Registeringnullrun.shutdownin anatexithandler eliminates the noisy log. No-op ifinit()was never called.WIRE TEST
tests/test_llm_call_metadata_flags.pypins the new contract: everyllm_callspan carriesmetadata.trackedormetadata.streaming_skipped(the latter for streaming/oversize responses that the SDK deliberately does not buffer).Existing tests updated to match — no public API beyond the additions listed above is renamed or removed.
Branch base:
master@f36befd(after 0.8.3 release via PR #43).