Repository navigation
fix(loop): one journal a day — adopt, stamp, and close the loser - #80
Merged
Merged
Conversation
The first day of event dispatch made two journal issues: the survey's own, written without the day marker, and the dispatcher's. The session wrote to one and the anomalies to the other. An issue matched by creation date is now stamped with the marker, so every later lookup is exact. After creating, the dispatcher looks again and closes its own issue if an older one appeared — the oldest wins, a rule two racing jobs agree on without talking. The scheduled journal job sweeps the rest. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.
The first day of event dispatch produced two journal issues for 2026-09-09:
dispatch-doneentryboard-unreachableanomaliesThe day's record was split, and each title counted only its own half.
reflectreads a week from those titles.Two causes, both closed
actjobs can look at the same instant, find nothing, and both create. After creating, the dispatcher looks again and closes its own issue if an older one appeared. The oldest issue for the day wins — a rule two racing jobs can agree on without talking.closeDuplicateDayssweeps up anything left, in the scheduled journal job (every 30 minutes,scheduleonly, so it never races itself), keeping the oldest.Tests
Five over the real scenario, in
dispatcher/test/journal-day.test.mjs: the survey's unmarked issue is adopted and stamped rather than duplicated, a create that loses the race closes itself and returns the older number, a clean day creates and closes nothing, the scheduled sweep closes every extra and leaves yesterday alone, and a failed create still returns 0 without throwing. 62 pass.Once this merges, the next scheduled run closes #78 and keeps #77.