Skip to content

Preserve history and exports with isolated buffered file replacement - #40

Merged
ProtonDev-sys merged 2 commits into
mainfrom
fix/history-atomic-save
Oct 12, 2026
Merged

ProtonDev-sys merged 2 commits into
mainfrom
fix/history-atomic-save

Conversation

@ProtonDev-sys

@ProtonDev-sys ProtonDev-sys commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Why

History saves used a fixed history.tsv.tmp neighbor. A successful save could consume a pre-existing file at that path, and a failed save could delete it. Two running instances also shared the staging file. CSV staging appended a GUID to the full destination filename, causing otherwise valid long filenames to exceed Windows' component limit.

Changes

  • Share an owned, buffered atomic-file writer between history and CSV export. Each attempt creates an exclusive, short .taskmgr-{GUID}.tmp sibling.
  • Stream history fields through a bounded 64 KiB buffer, preserving the existing UTF-8 escaping, LF records and full unsigned timestamp range.
  • Check writes, flush and close before replacing the destination. Preserve the first error and clean up only a staging file this attempt successfully created.
  • Keep large CSV writes bounded without copying an entire large field through the small buffer.

Verification

The previous history writer was extracted and reproduced consuming a sentinel neighbor on both successful and failed saves. The replacement passes local strict-warning GCC/UBSan checks: 31 history fixture checks and 15 atomic-file boundary/failure checks. Independent review covered ownership, destruction order, write failure handling and exact history serialization.

New native fixtures exercise pre-existing neighbors, locked destinations, directory and missing-parent failures, abandoned staging cleanup, two simultaneous staging files, concurrent complete-snapshot saves, full-width unsigned timestamps and a valid long CSV filename. Concurrent saves preserve one complete winning snapshot; this does not add history merging between instances.

The corrected head passed Windows verification run 38209554455: 12/12 CTests, all 21 suite cases, Python tests on both platforms, release guards, production checks and packaging. The initial diagnostic-only shadowing warning was corrected without relaxing /WX.

The retained artifact matches GitHub SHA-256 02fd1620c36853d68fa7c95ebdd49068e6c582080668f46b629b9a4881280047. All 31 diagnostic JSON reports pass. All 25 UI reports (7 CTest and 18 suite) have sortingPassed=true and an empty failure field; the history and CSV fixtures run unconditionally in that gate. This verifies the long filename, complete concurrent snapshots, exact serialized bytes, destination preservation and cleanup on Windows. Individual successful fixture-assertion counts are not emitted, so the source labels are not presented as additional independent runtime test counts.

This patch is based on the fully verified combined source merged in #39; the paired performance experiment was not repeated for this persistence-only change.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4ea2f834-7b9d-444c-b1f7-f552d6bbe04c

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ProtonDev-sys
ProtonDev-sys merged commit 137b633 into main Oct 12, 2026
6 checks passed
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