Skip to content

fix(loop): one journal a day — adopt, stamp, and close the loser - #80

Merged
Ardnived merged 1 commit into
mainfrom
claude/one-journal-a-day
Sep 9, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/one-journal-a-day

Conversation

@Ardnived

@Ardnived Ardnived commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

The first day of event dispatch produced two journal issues for 2026-09-09:

Issue Created by Holds
#77 the nightly survey, 08:16, old format, no day marker the session's dispatch-done entry
#78 a dispatch, 14:03 three board-unreachable anomalies

The day's record was split, and each title counted only its own half. reflect reads a week from those titles.

Two causes, both closed

  • An issue without the day marker is matched by creation date. Correct, but it leaves the issue unmarked forever, so every lookup repeats a fragile comparison. An issue adopted that way is now stamped with the marker, and every later lookup is exact.
  • Two act jobs 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.

closeDuplicateDays sweeps up anything left, in the scheduled journal job (every 30 minutes, schedule only, 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.

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Wed — 0 dispatches · 0 failed · 0 anomalies

1 participant