Skip to content

fix: restore contexts after exceptions#227

Merged
xelandernt merged 1 commit into
mainfrom
state-leak
Jul 13, 2026
Merged

fix: restore contexts after exceptions#227
xelandernt merged 1 commit into
mainfrom
state-leak

Conversation

@xelandernt

@xelandernt xelandernt commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Restore State and async ContextResource cleanup after exceptional exits.

Changes

  • Reset state context tokens in finally.
  • Tear down async resources and restore their tokens in finally.
  • Added nested and exceptional-context regressions.

Checklist

  • Lint and format pass (ruff)
  • Type check passes (mypy and pyrefly)
  • Tests pass and new behavior is covered
  • Build succeeds (uv build) if packaging or build config changed
  • Docs updated if behavior or public API changed
  • Repo metadata stays consistent across the three surfaces (GitHub description, pyproject description, profile blurb) if this touches packaging

@xelandernt xelandernt self-assigned this Jul 13, 2026
@xelandernt xelandernt added the bug Something isn't working label Jul 13, 2026
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tests/providers/test_context_resources.py 100.00% <100.00%> (ø)
tests/providers/test_state.py 100.00% <100.00%> (ø)
that_depends/providers/context_resources.py 100.00% <100.00%> (ø)
that_depends/providers/state.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xelandernt

Copy link
Copy Markdown
Collaborator Author

@lesnik512 Can you please remove the Type check passes (ty) from the PR checklist? It is not relevant for this repo.

@lesnik512

Copy link
Copy Markdown
Member

#234

@xelandernt xelandernt merged commit 5969ef8 into main Jul 13, 2026
12 checks passed
@xelandernt xelandernt deleted the state-leak branch July 13, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants