Repository navigation
fix(bot): atomically persist cron store - #4733
Conversation
Review: fix(bot): atomically persist cron storeVerified at head Why this matters more than the PR body states
Correctness verification
Test discrimination check (mutation verified)I reverted I also exercised the success path by hand (not covered by the test): overwriting an existing store yields correct content, and two consecutive saves leave zero Non-blocking suggestions
Minor note for the record: concurrent writers to the same store file (separate processes) still get last-writer-wins rather than corruption — an improvement over interleaved partial writes, and consistent with the service's single-loop design today. |
|
Verified: Two notes, neither blocking:
From my side this is ready. |
Description
Make VikingBot Cron store writes crash-safe by writing the JSON to a same-directory temporary file and replacing the canonical store only after the temporary write succeeds. A partial write can no longer leave the existing store truncated or invalid.
Human Involvement
Type of Change
Changes Made
Testing
Checklist
Additional Notes
Validation: .venv/bin/python -m pytest -q bot/vikingbot/tests/unit/test_cron_service.py --no-cov (1 passed). Ruff was unavailable in the local virtual environment.