fix: enhance connection state checks#2137
Conversation
PR Review: fix: enhance connection state checksSummaryThis PR fixes a state synchronization bug in Core Fix —
|
|
PR Review posted via Claude Code - see below for full review. |
|
Critical: Broken test in test_connection_state_sync.py The test calls extension._handle_audio_frame() and asserts on extension.buffered_frames, but neither attribute exists on BytedanceASRLLMExtension (they appear in soniox_asr_python, not this extension). The assertion also expects log_debug with message 'send_frame: service not connected.' but the actual send_audio code calls log_warn('Not connected to ASR service, attempting to reconnect...'). This test will fail when run as-is. Minor: Misleading test name test_send_audio_does_not_suppress_other_stop_phase_errors implies non-disconnect errors are NOT suppressed during stop phase, but the assertions verify they ARE suppressed (log.assert_not_called(), send_asr_error.assert_not_awaited()). Name and contract are inverted. Suggested rename: test_send_audio_suppresses_all_errors_during_stop_phase. Minor: Silent suppression of all exception types during stop The new guard silently drops every exception type (including ValueError, AttributeError, etc.) not just expected disconnect errors. Consider either restricting to known disconnect types, or adding a log_debug call so there is still a trace: self.ten_env.log_debug(f'Suppressed error during stop: {e}'). Minor: Commented-out dead code in is_connected() The finalize grace period block has been commented out for some time. Per AGENTS.md KISS: delete it rather than leave dead code. Minor: Duplicated test boilerplate Both new test files contain identical ~20-line module-injection setup. A shared conftest.py in tests/ would eliminate the duplication. Nit: Version jump manifest.json goes from 0.3.18 to 0.3.20, skipping 0.3.19. Worth confirming this is intentional. What looks good
|
No description provided.