Skip to content

fix(CSVLogManager): write rotation-stop marker once and header on open - #112

Merged
DonLakeFlyer merged 1 commit into
sync-upstream-masterfrom
fix/csv-log-header-and-stop-marker
Sep 5, 2026
Merged

fix(CSVLogManager): write rotation-stop marker once and header on open#112
DonLakeFlyer merged 1 commit into
sync-upstream-masterfrom
fix/csv-log-header-and-stop-marker

Conversation

@DonLakeFlyer

Copy link
Copy Markdown
Owner

Summary

Two related fixes in CSVLogManager:

  1. Duplicate rotation-stop marker. rotationIsEnding() called csvLogRotationStop() and then csvStopRotationPulseLog(), which itself called csvLogRotationStop() again. Every rotation end wrote two COMMAND_ID_STOP_ROTATION rows to the full pulse log. The nested call is removed so the marker is written exactly once, paired with the unconditional START written by startRotation().

  2. CSV header written on open. The header is now written immediately after each log file is opened (_csvWritePulseHeader) instead of lazily on the first pulse guarded by size() == 0. Files are opened WriteOnly (truncating), so the header is still written exactly once.

Behavior changes

  • Full pulse log: one STOP marker per rotation instead of two.
  • Runs that receive no pulses now produce a header-only CSV instead of a zero-byte file.

Notes

  • No tests exist for the custom/ tree yet; adding CSVLogManager coverage (start/stop/reopen, header-once, empty-run) is a follow-up.

rotationIsEnding() called csvLogRotationStop() and then
csvStopRotationPulseLog(), which itself called csvLogRotationStop()
again, so every rotation end wrote two COMMAND_ID_STOP_ROTATION rows to
the full pulse log. Drop the nested call so the marker is written once,
paired with the unconditional START written by startRotation().

Also write the CSV header immediately after opening each log file instead
of lazily on the first pulse. The files are opened WriteOnly (truncating),
so the header is still written exactly once; runs that receive no pulses
now produce a header-only file instead of an empty one.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused changes correctly implement both documented fixes without introducing unresolved issues.

Pull request overview

Ensures CSV logs receive headers on creation and prevents duplicate rotation-stop records.

Changes:

  • Writes pulse headers immediately after successful file opening.
  • Removes the redundant STOP marker emitted while closing rotation logs.
File summaries
File Description
custom/src/CSVLogManager.h Declares the header-writing helper.
custom/src/CSVLogManager.cc Writes headers on open and eliminates duplicate STOP logging.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@DonLakeFlyer
DonLakeFlyer merged commit 4876e40 into sync-upstream-master Sep 5, 2026
3 checks passed
@DonLakeFlyer
DonLakeFlyer deleted the fix/csv-log-header-and-stop-marker branch September 5, 2026 04:01
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.

2 participants