Skip to content

Step 18: transport robustness, typing cleanup, and coverage polish#13

Merged
whitewalls86 merged 3 commits into
masterfrom
step-18-robustness-polish
Jun 13, 2026
Merged

Step 18: transport robustness, typing cleanup, and coverage polish#13
whitewalls86 merged 3 commits into
masterfrom
step-18-robustness-polish

Conversation

@whitewalls86

Copy link
Copy Markdown
Owner

Summary

  • Malformed 2xx JSON: _handle_response() now wraps response.json() parse failures in VisorTransportError instead of leaking a raw JSONDecodeError from the success path
  • Non-object 2xx JSON: Added an isinstance(data, dict) guard that raises VisorTransportError for successful responses that are not JSON objects (e.g. arrays), enforcing the transport contract at runtime without cast()
  • Typing cleanup: Replaced bare dict return annotations with dict[str, Any] across _transport.py; removed all type: ignore suppressions
  • Retry-After coverage: Added tests for HTTP-date header (valid future date → non-negative int) and invalid non-date/non-integer header (→ None); _transport.py now at 100% coverage
  • Filter serialization coverage: Added tests for snapshot_date ISO serialization, include comma-joining, and empty-list param omission
  • Validator comment: Documented the unreachable sold_within_days + snapshot_date mutual-exclusion branch in _base.py

Test plan

  • pytest --cov=visor --cov-report=term-missing — 243 passed, _transport.py 100%
  • ruff check src/ tests/ — clean
  • ruff format --check src/ tests/ — clean
  • mypy src/ — clean
  • python -m build + twine check dist/* — both passed
  • visor/py.typed present in wheel
  • Design Docs/ and FIXES absent from sdist

🤖 Generated with Claude Code

whitewalls86 and others added 3 commits June 13, 2026 12:43
- Wrap 2xx malformed JSON in VisorTransportError instead of leaking
  a raw JSONDecodeError from the success path
- Replace bare `dict` return annotations with `dict[str, Any]` in
  _transport.py; drop type: ignore[type-arg] and type: ignore[no-any-return]
- Add Retry-After HTTP-date and invalid-value tests (async + sync);
  _transport.py now at 100% coverage
- Add snapshot_date serialization, include serialization, and empty-list
  omission tests in test_filter_model.py
- Document unreachable sold_within_days+snapshot_date mutual-exclusion
  branch with an explanatory comment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Capture response.json() as Any, then cast to dict[str, Any] before
returning, eliminating the suppression comment added in step 18.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace cast(dict[str, Any], data) with an isinstance check that raises
VisorTransportError for successful responses that are not JSON objects.
Removes cast import. Adds sync and async tests for the new guard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@whitewalls86
whitewalls86 merged commit 79913bc into master Jun 13, 2026
12 checks passed
@whitewalls86
whitewalls86 deleted the step-18-robustness-polish branch June 13, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant