fix(digest): preserve earlier digest when re-run scans zero sessions#4
Merged
Conversation
A mid-day re-run that finds only already-processed sessions would overwrite the morning's populated digest with an empty one, because the in-memory signal lists only contain THIS run's findings — not the prior run's. Skip the write when sessions_scanned == 0 AND the target file already exists. The first run of the day still produces an empty skeleton so downstream tooling can grep for today's file unconditionally. Two new tests: - run_review_preserves_existing_digest_when_nothing_scanned: seeds a digest, re-runs with zero readers, asserts the seeded content is intact afterward. - run_review_writes_digest_when_file_absent_even_with_no_sessions: asserts the first-of-day empty-skeleton path still works. All 85 jilog-review tests pass.
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
A mid-day re-run that finds only already-processed sessions would overwrite the morning's populated digest with an empty one, because the in-memory signal lists only contain this run's findings — not the prior run's.
Skip the write when
sessions_scanned == 0and the target digest file already exists. The first run of the day still produces an empty skeleton, so downstream tooling can grep for today's file unconditionally.Why merging is the conservative choice
The signal vectors (
all_corrections,all_errors, …) are populated only from sessions scanned in the current call. There's no way to merge today's earlier signals with this run's zero signals without reloading the prior digest, parsing it, and re-rendering — and the prior digest is already byte-stable downstream-grep input. Preserving the file is strictly safer than synthesizing a partial overwrite.Test plan
run_review_preserves_existing_digest_when_nothing_scanned— seeds a digest, runsrun_reviewwith zero readers on the same date, asserts the seededSEEDED-FROM-EARLIER-RUNmarker survives.run_review_writes_digest_when_file_absent_even_with_no_sessions— asserts the first-of-day empty-skeleton path still writes a fresh digest withsignals_captured: 0.