fix(streaming): normalize finish_reason in get_result() per streaming… - #52
Merged
Conversation
…-contract:FinishReason:MUST:5 StreamingAccumulator.get_result() now applies the same finish_reason normalization as to_chat_response(): SDK uppercase values fold to lowercase, and tool_calls presence overrides the SDK-provided reason. Previously get_result() returned raw self.finish_reason, producing inconsistent values for callers on the get_result() path. Test suite: remove ~2,830 lines of structural and tautological tests across 7 deleted files (test_sdk_mocks, test_sdk_protection, test_sdk_protection_validation, test_protocol_compliance, test_sdk_boundary, test_session_factory, sdk_helpers). Migrate surviving contract coverage into behavioral tests: sdk-boundary:Membrane:MUST:5 and sdk-boundary:TypeTranslation:MUST:1,2 into test_sdk_boundary_contract; provider-protocol:mount:MUST:2,3 into test_contract_protocol. Add 34 new tests for deny-destroy contract clauses across 4 dedicated test modules. Restore 5 missing contract anchors (behaviors:ConfigLoading:MUST:6, provider-protocol:list_models:MUST:2, provider-protocol:name:MUST:2, sdk-boundary:TypeTranslation:MUST:1,2) with proper Contract: prefix so gate audit achieves 214/214 MUST clause coverage. ruff: 0 errors | pyright: 0 errors | pytest (win32/py3.13): 1,154 passed | pytest (linux/py3.14): 1,162 passed | coverage: 98%
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.
…-contract:FinishReason:MUST:5
StreamingAccumulator.get_result() now applies the same finish_reason normalization as to_chat_response(): SDK uppercase values fold to lowercase, and tool_calls presence overrides the SDK-provided reason. Previously get_result() returned raw self.finish_reason, producing inconsistent values for callers on the get_result() path.
Test suite: remove ~2,830 lines of structural and tautological tests across 7 deleted files (test_sdk_mocks, test_sdk_protection, test_sdk_protection_validation, test_protocol_compliance, test_sdk_boundary, test_session_factory, sdk_helpers). Migrate surviving contract coverage into behavioral tests: sdk-boundary:Membrane:MUST:5 and sdk-boundary:TypeTranslation:MUST:1,2 into test_sdk_boundary_contract; provider-protocol:mount:MUST:2,3 into test_contract_protocol. Add 34 new tests for deny-destroy contract clauses across 4 dedicated test modules. Restore 5 missing contract anchors (behaviors:ConfigLoading:MUST:6, provider-protocol:list_models:MUST:2, provider-protocol:name:MUST:2, sdk-boundary:TypeTranslation:MUST:1,2) with proper Contract: prefix so gate audit achieves 214/214 MUST clause coverage.
ruff: 0 errors | pyright: 0 errors | pytest (win32/py3.13): 1,154 passed | pytest (linux/py3.14): 1,162 passed | coverage: 98%