Skip to content

fix(digest): preserve earlier digest when re-run scans zero sessions#4

Merged
Joi merged 1 commit into
mainfrom
fix/digest-skip-on-empty-rerun
May 18, 2026
Merged

fix(digest): preserve earlier digest when re-run scans zero sessions#4
Joi merged 1 commit into
mainfrom
fix/digest-skip-on-empty-rerun

Conversation

@Joi
Copy link
Copy Markdown
Owner

@Joi Joi commented May 18, 2026

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 == 0 and 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, runs run_review with zero readers on the same date, asserts the seeded SEEDED-FROM-EARLIER-RUN marker 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 with signals_captured: 0.
  • All 85 jilog-review tests pass.
  • CI green.

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.
@Joi Joi merged commit 8c4f2bf into main May 18, 2026
1 check 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