Skip to content

fix(migration): reset item_volatility_stats after V1.22 truncate#92

Merged
dangerworm merged 2 commits into
mainfrom
development
Apr 24, 2026
Merged

fix(migration): reset item_volatility_stats after V1.22 truncate#92
dangerworm merged 2 commits into
mainfrom
development

Conversation

@dangerworm
Copy link
Copy Markdown
Owner

Addresses Codex P1 on the dev → main PR: V1.22 truncated item_change_log_summaries but left item_volatility_stats populated with rankings derived from the old 6h-bucket data. RebuildStatsAsync can't self-heal that — its counts CTE only updates rows for items that have appeared in the last 7 days of summaries, which is empty during the post-V1.22 backfill window. So GetTopAsync would keep serving stale rankings indefinitely from the user's POV.

Truncate the derived table in a follow-up migration so V1.22 + V1.23 together do an atomic cutover: both source and derived tables emptied, both rebuild from scratch on the next Hangfire pass. The frontend's existing noData check in TopMovers.tsx renders an honest "no data yet" message during the warmup window rather than the misleading stale rows we'd otherwise serve.

Picked truncate over Codex's other suggestion (gating reads on a fresh computed_at) because it makes the staleness impossible rather than checking around it — fewer moving parts that have to stay correct.

dangerworm and others added 2 commits April 24, 2026 22:38
Addresses Codex P1 on the dev → main PR: V1.22 truncated
item_change_log_summaries but left item_volatility_stats populated
with rankings derived from the old 6h-bucket data. RebuildStatsAsync
can't self-heal that — its counts CTE only updates rows for items
that have appeared in the last 7 days of summaries, which is empty
during the post-V1.22 backfill window. So GetTopAsync would keep
serving stale rankings indefinitely from the user's POV.

Truncate the derived table in a follow-up migration so V1.22 + V1.23
together do an atomic cutover: both source and derived tables emptied,
both rebuild from scratch on the next Hangfire pass. The frontend's
existing noData check in TopMovers.tsx renders an honest "no data
yet" message during the warmup window rather than the misleading
stale rows we'd otherwise serve.

Picked truncate over Codex's other suggestion (gating reads on a
fresh computed_at) because it makes the staleness impossible rather
than checking around it — fewer moving parts that have to stay correct.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dangerworm dangerworm merged commit 52c9da7 into main Apr 24, 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