Skip to content

fix(reorg): break phantom depth feedback loop in reorg models#226

Open
samcm wants to merge 1 commit intomasterfrom
fix/reorg-depth-feedback-loop
Open

fix(reorg): break phantom depth feedback loop in reorg models#226
samcm wants to merge 1 commit intomasterfrom
fix/reorg-depth-feedback-loop

Conversation

@samcm
Copy link
Member

@samcm samcm commented Feb 23, 2026

Summary

  • The existing_depths CTE in both reorg models reads back all distinct depths from the output table for the current batch's target days, including rows with reorg_count=0. These zero-count rows self-reinforce on every reprocessing of those days, keeping phantom depth entries alive indefinitely.
  • The phantom depths (e.g. 7, 8, 9) originated from timing issues during initial backfill — fct_block_proposer hadn't fully populated, so missing slots created false runs of consecutive orphaned slots that were detected as deep reorgs. Once the dependency data settled, the reorgs disappeared but the zero-count rows persisted via the feedback loop.
  • Adds WHERE e.reorg_count > 0 to existing_depths in both fct_reorg_daily and fct_reorg_hourly, breaking the cycle while preserving the one-pass zero-overwrite behavior needed for eventually-consistent data corrections.

The existing_depths CTE reads back all distinct depths from the output
table, including rows with reorg_count=0. These zero-count rows feed
back into the CROSS JOIN, causing every depth that ever existed to
propagate to every day/hour forever.

Filter existing_depths to only consider rows where reorg_count > 0,
breaking the self-reinforcing cycle while still allowing one pass of
zero-overwrite when a reorg legitimately disappears from the data.
@samcm samcm requested a review from Savid as a code owner February 23, 2026 04:04
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