fix(backfill): include recent-merged segment in repo sync-status rollup - #378
Merged
JSONbored merged 2 commits intoJun 4, 2026
Merged
Conversation
…-aware terminal handling
JSONbored
approved these changes
Jun 4, 2026
JSONbored
left a comment
Owner
There was a problem hiding this comment.
@philluiz2323 this is good to land after GitHub refreshes the branch state.
A few notes:
- Including the recent-merged segment fixes the status rollup without broadening the backfill scope.
- The terminal-status helper keeps the behavior understandable.
- No code changes requested.
Validation expected:
- Keep the current green CI run after the branch is updated if GitHub requires it.
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.
Closes #377.
Summary
refreshRepoSyncStateFromSegmentsderived the repo-level syncstatusfrom a segment list that omittedrecent_merged_pull_requests(it was loaded and used for counts, but excluded from thewaiting/running/errored/incompletechecks). So when the merged-history crawl was stillrunning/waiting_rate_limit/errorwhile the other segments completed, the rollup producedstatus: "success"with a freshlastCompletedAt. The freshness check then skips the repo for the freshness window, leaving recent-merged PR history silently stale/undercounted (andstatus: "success"could coexist with a stalemergedPullRequestsSyncedAt). The monolithic path'ssummarizeSegmentsalready includes recent-merged, so the two paths disagreed.Scope
src/github/backfill.ts— includerecent_merged_pull_requestsin the status/warnings rollup, and add anisTerminalSegmentStatushelper that treatscomplete/not_modified/sampledas terminal.sampledis the recent-merged progressive-history terminal state (no other segment produces it, already treated as synced formergedPullRequestsSyncedAt), so a sampled crawl still counts assuccessrather than perpetuallypartial.test/unit/backfill.test.ts— rollup test for an unfinished merged-history crawl.No schema, API, or public-surface changes. Rebased on top of #353.
Validation
Branch coverage stays >= 97%. CI
validateis green.Safety
status/warnings. No new external calls, tokens, or data surface.success(torunning/rate_limited/error/partial) when the merged-history crawl is unfinished; asampled/completecrawl still yieldssuccess, so it cannot wrongly force healthy repos into perpetual re-backfill.Notes
buildRepoOutcomePatternsignores therecent_merged_pull_requeststable — merge-rate analysis runs almost without merged PRs, falsely flagging healthy repos as "high closure risk" #312 (the analysis ignoring recent-merged): this fixes the sync-status/freshness mechanism that was prematurely marking the crawl complete.