fix: atomic SQL increment for session.errors on ERROR events#126
Merged
Conversation
Replace read-modify-write pattern in _increment_session_error_count with a single SQL UPDATE ... SET errors = errors + N to avoid race conditions when concurrent events are added. Update tests to rely on auto-counting rather than manually seeding the errors field. Closes #124 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
New version (v2) of the codebase-to-course interactive HTML with 7 modules covering SDK tracing, event lifecycle, frontend mission control, safety systems, and architecture. Previous version preserved as docs/peaky-peek-course-v1.html. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_increment_session_error_countwith a single atomicUPDATE ... SET errors = errors + Nto eliminate race conditions when concurrent error events are added to the same sessiontest_issue_search_and_errors.pyto rely on auto-counting rather than manually seeding theerrorsfield at session creationTest plan
ruff check .— all checks passedpytest tests/test_issue_search_and_errors.py tests/test_issue_seed_data_quality.py— 15 passed, 1 xfailed (unrelated issue chore(deps): bump zustand from 4.5.7 to 5.0.12 in /frontend #6)test_failure_count_populated_for_sessions_with_errorsnow passes without xfail markerCloses #124
🤖 Generated with Claude Code