Skip to content

Let an open heatmap tab notice that the store took a new week - #34

Merged
mspinola merged 1 commit into
mainfrom
claude/heatmap-data-staleness-8a5813
Aug 18, 2026
Merged

Let an open heatmap tab notice that the store took a new week#34
mspinola merged 1 commit into
mainfrom
claude/heatmap-data-staleness-8a5813

Conversation

@mspinola

Copy link
Copy Markdown
Owner

The heatmap page kept rendering the previous COT week while the navbar badge above it announced the new one.

The Target Date control is resolved in layout(), which runs once per page load. The navbar badge sits on a five-minute dcc.Interval. So a tab left open across a Friday release contradicted its own header: the badge moved, the grid did not, and the new week could not even be selected by hand because it was absent from the dropdown. Observed 2026-08-14, when the 2026-08-11 week landed at 15:34.

What changed

  • The navbar poller republishes the week into a new cot_release_store, only when it changes, so the five-minute tick does not wake every subscriber for nothing.
  • The heatmap re-offers its dates from that store. Following the new week is conditional: sitting on the newest is a default nobody chose, so it tracks, while a deliberately chosen older week is left alone and merely gains the new option. The test is whether the current selection was the newest, which the old options list answers without anything being remembered server-side.
  • The caption moves onto the selected date. Reading get_available_dates()[0] unconditionally made it a claim about the store rather than about the table beneath it, which was wrong in both directions: stale on an open tab, and wrong on any deliberate look at an older week.
  • The badge no longer flickers to Unknown mid-sync. Replacing a real date with "unavailable" on a tab that was showing one would misfire on exactly the day it matters most.

The arithmetic lives in next_date_selection, apart from the callback, because a Dash callback cannot be called directly to check it.

Tests

tests/test_heatmap_follows_release.py, 9 tests. 147 passed, ruff clean.

Callback registration smoke-checked against a built app; not yet exercised in a running instance.

Related

The Unknown handling pairs with mspinola/cotmetrics#14, which fixes the same torn read at source. This branch is safe without it: the badge just never sees None and keeps printing Unknown as before.

🤖 Generated with Claude Code

The Target Date control is resolved in layout(), which runs once per page load, while
the navbar badge sits on a five-minute dcc.Interval. So a tab left open across a
Friday release contradicted its own header: the badge moved, the grid did not, and the
new week could not even be selected by hand because it was absent from the dropdown.
Observed 2026-08-14, when the 2026-08-11 week landed at 15:34.

The navbar poller now republishes the week into cot_release_store whenever it changes,
and the heatmap re-offers its dates from that. Following the new week is conditional:
sitting on the newest is a default nobody chose, so it tracks, while a deliberately
chosen older week is left alone and merely gains the new option.

The caption moves onto the selected date at the same time. Reading
get_available_dates()[0] unconditionally made it a claim about the store rather than
about the table beneath it, which was wrong in both directions: stale on an open tab,
and wrong on any deliberate look at an older week.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mspinola
mspinola merged commit cd3835e into main Aug 18, 2026
3 checks passed
@mspinola
mspinola deleted the claude/heatmap-data-staleness-8a5813 branch August 18, 2026 12:21
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