Skip to content

Fix closing after a failed logout and changing base_url - #166

Merged
RazerM merged 2 commits into
mainfrom
feature/session-state
Aug 23, 2026
Merged

Fix closing after a failed logout and changing base_url#166
RazerM merged 2 commits into
mainfrom
feature/session-state

Conversation

@RazerM

@RazerM RazerM commented Aug 22, 2026

Copy link
Copy Markdown
Member

close() now closes the underlying HTTPX client even when the logout request fails. Setting base_url now resets the authentication state and the cached predicates, which belong to the previous host.

@RazerM RazerM changed the title feature/session state Fix closing after a failed logout and changing base_url Aug 22, 2026
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.48%. Comparing base (168de31) to head (50d3098).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #166      +/-   ##
==========================================
+ Coverage   96.33%   96.48%   +0.15%     
==========================================
  Files           7        7              
  Lines        1147     1168      +21     
  Branches      129      129              
==========================================
+ Hits         1105     1127      +22     
+ Misses         25       24       -1     
  Partials       17       17              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RazerM
RazerM force-pushed the feature/session-state branch 3 times, most recently from 5940b5f to 0deb513 Compare August 23, 2026 13:08
RazerM added 2 commits August 23, 2026 15:45
close() detached the finalizer and then performed the logout network
round-trip before closing the HTTPX client, so a failing logout leaked
the connection pool, with the ResourceWarning already suppressed by the
detach. Wrap logout in try/finally in both clients.
The setter swapped hosts without clearing _authenticated or the
in-memory predicate cache, whose key does not include the base URL
(unlike the on-disk cache, which hashes it). The new host then received
unauthenticated requests validated against the old host's predicates.
@RazerM
RazerM force-pushed the feature/session-state branch from 0deb513 to 50d3098 Compare August 23, 2026 13:45
@RazerM
RazerM merged commit 8f3b5a4 into main Aug 23, 2026
11 checks passed
@RazerM
RazerM deleted the feature/session-state branch August 23, 2026 13:56
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