Skip to content

fix(backfill): include recent-merged segment in repo sync-status rollup - #378

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
philluiz2323:fix/sync-status-include-recent-merged
Jun 4, 2026
Merged

fix(backfill): include recent-merged segment in repo sync-status rollup#378
JSONbored merged 2 commits into
JSONbored:mainfrom
philluiz2323:fix/sync-status-include-recent-merged

Conversation

@philluiz2323

Copy link
Copy Markdown
Contributor

Closes #377.

Summary

refreshRepoSyncStateFromSegments derived the repo-level sync status from a segment list that omitted recent_merged_pull_requests (it was loaded and used for counts, but excluded from the waiting/running/errored/incomplete checks). So when the merged-history crawl was still running / waiting_rate_limit / error while the other segments completed, the rollup produced status: "success" with a fresh lastCompletedAt. The freshness check then skips the repo for the freshness window, leaving recent-merged PR history silently stale/undercounted (and status: "success" could coexist with a stale mergedPullRequestsSyncedAt). The monolithic path's summarizeSegments already includes recent-merged, so the two paths disagreed.

Scope

  • src/github/backfill.ts — include recent_merged_pull_requests in the status/warnings rollup, and add an isTerminalSegmentStatus helper that treats complete / not_modified / sampled as terminal. sampled is the recent-merged progressive-history terminal state (no other segment produces it, already treated as synced for mergedPullRequestsSyncedAt), so a sampled crawl still counts as success rather than perpetually partial.
  • 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

npx vitest run test/unit/backfill.test.ts                                   # 54/54
npx vitest run test/unit/queue.test.ts test/unit/data-spine.test.ts \
  test/unit/data-quality.test.ts test/integration/api.test.ts               # 92/92
npx tsc --noEmit                                                            # clean
git diff --check                                                            # clean (no whitespace errors)

Branch coverage stays >= 97%. CI validate is green.

Safety

  • Pure status-derivation change: it only makes an already-tracked segment's state affect the repo status/warnings. No new external calls, tokens, or data surface.
  • Strictly more conservative — it can only move a repo out of success (to running/rate_limited/error/partial) when the merged-history crawl is unfinished; a sampled/complete crawl still yields success, so it cannot wrongly force healthy repos into perpetual re-backfill.

Notes

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@dosubot dosubot Bot added the lgtm label Jun 4, 2026
@JSONbored
JSONbored merged commit 7f4d1d1 into JSONbored:main Jun 4, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 4, 2026
@JSONbored JSONbored added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

No open projects
Status: Done

2 participants