fix(selfhost): send conditional backfill requests on the scheduled cadence (#1942) - #1976
Conversation
…dence (#1942) #1901 added ETag/If-Modified-Since validators for backfill segments, but fetchPagedSegment loaded the prior segment (and so built the conditional request) only when mode===resume. The scheduled cadence runs light/full, so the 304 fast-path never fired on the path that actually runs — every 30-min light crawl re-listed labels/open-issues/open-PRs at full cost. Load the prior segment for every mode so a light/full crawl sends If-None-Match and an unchanged single-page list returns a 0-body 304. Resume pagination stays gated on canResumePreviousScan; open-scan reconciliation segments still force allowEtag:false, so close-detection is unchanged.
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-01 04:06:25 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1976 +/- ##
=======================================
Coverage 95.57% 95.57%
=======================================
Files 218 218
Lines 24257 24257
Branches 8795 8794 -1
=======================================
Hits 23184 23184
Misses 436 436
Partials 637 637
🚀 New features to boost your workflow:
|
Summary
#1901 added conditional (ETag / If-Modified-Since) validators for backfill segments, but
fetchPagedSegmentonly loaded the prior segment row — and thus only built the conditional request — whenmode === "resume"(src/github/backfill.ts:1289). The scheduled cadence runs inlight/fullmode, so the 304 fast-path never fired on the path that actually runs: every 30-min light crawl re-listed labels / open-issues / open-PRs at full cost even when nothing had changed.This loads the prior segment for every mode, so a scheduled
light/fullcrawl sends the storedIf-None-Matchand an unchanged single-page list returns a 0-body 304 instead of a full re-list — the largest avoidable GitHub cost on the backfill cadence.Correctness is preserved by the machinery that was already there:
canResumePreviousScan(mode === "resume"), solight/fullstill start a fresh page-1 scan — only the conditional header is added.allowEtag: false, so they always full-scan; loadingpreviousnever lets a dropped close slip through.conditionalRequestForSegmentstill requires the prior scan to be fresh, complete, single-page, andexpectedCount-matched before sending validators.Advances #1942 (rec #3 from the #1936 audit); builds directly on #1901.
Scope
CONTRIBUTING.md; nosite//CNAME.Validation
git diff --checknpm run typechecknpm run test:coverage— the single changed line is exercised by the existing backfill segment suite (133 tests); added a regression test proving thelightcadence now sendsIf-None-Matchand short-circuits tonot_modified(it assertsstatus: "complete"→not_modifiedand the exact request headers, so it fails without the fix).npm run test:cinpm audit --audit-level=moderateIf any required check was skipped, explain why:
ui:openapi/cf-typegen/ migration regen: single-file backend change, no API/schema/binding/DB change.Safety
Notes
light/fullcrawls now send conditional headers; the open-scan/reconciliation segments are unaffected (allowEtag: false), so close-detection is unchanged.