Skip to content

fix(breaker): make snapshots atomic - #89

Merged
bagowix merged 1 commit into
mainfrom
fix/80-atomic-snapshot
Jul 30, 2026
Merged

fix(breaker): make snapshots atomic#89
bagowix merged 1 commit into
mainfrom
fix/80-atomic-snapshot

Conversation

@bagowix

@bagowix bagowix commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Serialize CircuitBreaker.snapshot() with call settlement using the existing engine lock.
  • Add a deterministic concurrency test proving snapshots cannot observe partially updated window counters.
  • Keep window implementations lock-free and preserve O(1) count-based snapshots.
  • Document the concurrency guarantee and update the changelog.

Checklist

  • Tests added or updated (suite stays at 100% coverage)
  • uv run ruff format --check and uv run ruff check pass
  • uv run mypy and uv run pyright pass
  • Docs updated (docs/) for user-facing changes
  • CHANGELOG.md [Unreleased] updated
  • Commits follow Conventional Commits

Related issues

Closes #80

@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  interlock
  _engine.py
  _state_machine.py
Project Total  

This report was generated by python-coverage-comment-action

@bagowix
bagowix merged commit bb17daf into main Jul 30, 2026
10 of 11 checks passed
@bagowix
bagowix deleted the fix/80-atomic-snapshot branch July 30, 2026 21:00
@bagowix bagowix mentioned this pull request Jul 30, 2026
7 tasks
bagowix added a commit that referenced this pull request Jul 30, 2026
## Summary

Prepare the `2.1.3` patch release.

- bump the package version from `2.1.2` to `2.1.3`
- move the current changelog entries from `[Unreleased]` into `2.1.3`
- update changelog comparison links
- update the release version in the comparison page
- regenerate `docs/llms-full.txt`

This release includes fixes for atomic circuit-breaker snapshots and
local manual controls in coordinated mode.

## Checklist

- [x] Test suite passes with 100% coverage
- [x] `uv run ruff format --check` and `uv run ruff check` pass
- [x] `uv run mypy` and `uv run pyright` pass
- [x] Documentation updated
- [x] `CHANGELOG.md` updated
- [x] Release artifacts build successfully
- [x] Commits follow Conventional Commits

## Related issues

- Includes changes from #88
- Includes changes from #89
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.

Make CircuitBreaker.snapshot() atomic under concurrent calls

1 participant