feat: make strict HTTP behavior the default (#284) - #291
Merged
Conversation
Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
Mattsface
marked this pull request as ready for review
August 5, 2026 21:28
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.
Closes #284
Parent release issue: #282
Depends on: #283 (merged via #290 /
94d944f)Why the default changes
Version 1.0 makes strict HTTP the production default so
Mlb()andMlbDataAdapter()raiseMlbHttpErrorfor final non-404 4xx responses instead of returning historical empty results. Compatibility mode remains available via explicitstrict_http=False.Production files changed
mlbstatsapi/mlb_api.py—strict_http: bool = True(keyword-only); value still forwarded to_mlb_adapter_v1and_mlb_adapter_v1_1mlbstatsapi/mlb_dataadapter.py—strict_http: bool = True(keyword-only); response decision logic unchangedHow explicit compatibility mode is preserved
strict_http=Falsecontinues to:MlbResultfor final non-404 4xxMlbHttpCompatibilityWarningMlbHttpErrorfor final 5xxWarning text and stacklevel are intentionally unchanged (owned by #285).
Confirmation that 404 behavior remains unchanged
In both modes, 404 still returns an
MlbResultfor endpoint-level handling:get_person()→Noneget_teams()→[]get_player_stats()→{}A 404 does not become
MlbHttpError.The test-helper correction
tests/http_contract_support.standalone_adapter_for_version(and the local retry harness helper) now use a private_UNSETsentinel so omittedstrict_httptruly omits the constructor argument. ExplicitTrue/Falsestill pass through.Which #284 xfails were removed
Removed
XFAIL_PENDING_STRICT_DEFAULT/Pending #284from:test_mlb_default_matches_explicit_strict_mode_wiringtest_mlb_data_adapter_default_is_stricttest_default_adapter_raises_on_final_non_404_client_errortest_default_mlb_raises_on_final_non_404_client_errortest_final_429_raises_mlb_http_error_after_retry_exhaustion_default_adaptertest_final_429_raises_via_default_mlb_client_after_retry_exhaustionAlso updated constructor-default assertions and non-retryable client-error expectations for the new default.
Focused test results
299 passed, 1 xfailed
Full offline-suite results
432 passed, 1 xfailed
poetry checksucceeded (existing Poetry config deprecation warnings only).git diff --checkclean.Remaining xfails and their associated issues
XFAIL_PENDING_WARNING_CALL_SITE/Pending #285—test_compatibility_warning_points_to_public_mlb_endpoint_caller_lineRisk assessment
strict_http=Falserestores prior behavior; 404 / retries / Session ownership / timeouts unchanged.Intentionally left out