Skip to content

D26g — A pinned clock pins the date too

  • Status: Accepted — amends D26f
  • Date: 2026-10-30
  • Origin: politics_s28_hosted golden session, which began to fail with no change to the code
  • Area: build

Decision

clock_date() in src/kg/core/store.py is the only reader of the machine's date. It returns KG_NOW's date when a session pins the clock, and date.today() otherwise. Every fallback for a missing on uses it, and tests/unit/test_clock.py fails if date.today() appears anywhere else under src/kg.

It does not call utcnow(): that would spend a tick, and would move an unpinned date from local time to UTC.

Why

D26f pinned the timestamps of rows, but not the date Python code compares them with. The golden runner hides this by passing on= to the reads it makes itself; a session that goes through a write path reaches code with no on. In politics_s28_hosted a search recorded on the pinned 2026-09-25 was compared with the real date, so the 30-day retry_days hold-back lapsed on 2026-10-25 and the snapshot failed. slice25_gaps would have failed the same way later. Views already treat KG_NOW as the graph's own clock in SQL (D57); this gives Python the same clock.