fix(migration): reset item_volatility_stats after V1.22 truncate#92
Merged
Conversation
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>
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.
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.