Skip to content

refactor: Wire up ResilientSession for all API calls#8

Open
dshkol wants to merge 5 commits intomainfrom
refactor/resilient-session-integration
Open

refactor: Wire up ResilientSession for all API calls#8
dshkol wants to merge 5 commits intomainfrom
refactor/resilient-session-integration

Conversation

@dshkol
Copy link
Owner

@dshkol dshkol commented Jan 18, 2026

Summary

Replace direct requests.get/post calls with get_session().get/post to leverage the existing resilience infrastructure.

Changes

  • core.py: 3 requests.postget_session().post
  • datasets.py: 1 requests.getget_session().get
  • vectors.py: 1 requests.getget_session().get
  • regions.py: 1 requests.getget_session().get
  • intersect_geometry.py: 1 requests.postget_session().post (kept 60s timeout)
  • Removed redundant raise_for_status() calls (ResilientSession handles this)
  • Updated test mocks to patch get_session instead of requests

Why

The ResilientSession class was built but never wired up. It provides:

  • Connection pooling: Reuses TCP connections for performance
  • Automatic retries: Exponential backoff on transient failures
  • Rate limiting: 100ms minimum between requests to respect API
  • Consistent error handling: All HTTP errors handled uniformly

Test plan

  • All existing tests pass
  • Added test_resilient_session_is_used to verify session is called
  • Test mocks updated to verify new code path

🤖 Generated with Claude Code

dshkol and others added 5 commits January 17, 2026 17:01
Replace direct requests.get/post calls with get_session().get/post
to leverage the existing resilience infrastructure that provides:
- Connection pooling for improved performance
- Automatic retries with exponential backoff
- Rate limiting (100ms minimum between requests)
- Consistent error handling

Changes:
- core.py: 3 requests.post calls → get_session().post
- datasets.py: 1 requests.get call → get_session().get
- vectors.py: 1 requests.get call → get_session().get
- regions.py: 1 requests.get call → get_session().get
- intersect_geometry.py: 1 requests.post call → get_session().post
  (kept 60s timeout for geometry operations)

Removed redundant raise_for_status() calls since ResilientSession
handles HTTP errors internally.

Updated test mocks to patch get_session instead of requests module.
Added test_resilient_session_is_used to verify the session is called.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The validate workflow references this file but it was in .gitignore
and never committed. This adds the file to the repo and fixes the
rpy2 DeprecationWarning issue for newer rpy2 versions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix get_census() test to include vector (API requires at least one)
- Update workflow to fail only on actual test failures, not skipped tests
- When R is unavailable, tests are skipped but CI should pass if no failures

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add pull-requests: write permission to allow commenting
- Add continue-on-error: true so comment failure doesn't fail workflow

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

🧪 R Equivalence Validation Results

VALIDATION SUMMARY
======================================================================

See full validation report in artifacts.

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