Skip to content

fix(15036): PR sync pass every 10 min on a shared cache tick - #7

Draft
MattRiddell wants to merge 1 commit into
fix/15036-pr-lookup-passesfrom
fix/15036-pr-sync-pass
Draft

MattRiddell wants to merge 1 commit into
fix/15036-pr-lookup-passesfrom
fix/15036-pr-sync-pass

Conversation

@MattRiddell

Copy link
Copy Markdown
Owner

Board pingdotgg#15036 (fork patch; stacks on #6).

Why: PullRequestSyncReactor swept every minute. Open PRs are always due. Cache entries expired 10 min after their own read. Every finished run invalidates its project's entries. So each minute found a few stale PRs and sent them as their own GraphQL document: ~50/h, 1,213 getPullRequestSummary calls on 2026-10-13 (fleet/api-calls, unit t3-server).

Change

  • PullRequestReadCache: an entry expires at the next 10-min tick since the epoch (entryExpiresAt). No entry lives longer than ENTRY_TTL; scope invalidations still last ENTRY_TTL from now, so they outlive every entry.
  • PullRequestSyncReactor: the periodic pass runs 1 s after each tick (nextPassDelay, marker PASS_AFTER_TICK_MS). Stale PRs are read together, 25 per document. Requested syncs (new link, merge a reader saw, run that ran gh pr merge) still run at once.

Lag: badge data is at most one tick old when the pass writes it. Matt, q3440: "PR badges can lag up to 10 min".

Projection: summary ≈ 144 documents/day (one per pass) + listPullRequestsByHead 121 ≈ 265/day, under the 283 target.

Tests (local, once each, suite-gate):

  • PullRequestSyncReactor.test.ts + PullRequestReadCache.test.ts: 34/34 pass. New: pass waits for the tick, not every minute; entries read at different times expire together; no entry outlives ENTRY_TTL. Adjusted: 15-min closed-PR rediscovery, rate-limit retryAt, scope-compaction start time.
  • PullRequestService.test.ts: 187 pass, 3 fail. The same 3 fail on base ebddc2c without this change (pre-existing).
  • tsc --noEmit (apps/server): 0 errors. vp fmt --check / vp lint on the 4 files: clean (2 pre-existing warnings).

🤖 Generated with Claude Code

…ry minute

PullRequestSyncReactor swept every minute. Open pull requests are always due,
cache entries expired 10 min after their own read, and every finished run
invalidates its project's entries, so each minute found a few stale PRs and
sent them as their own GraphQL document: ~50/h, 1,213 getPullRequestSummary
calls on 2026-10-13.

- PullRequestReadCache: entries expire at the next 10-min tick since the
  epoch (entryExpiresAt), so entries read at different times go stale
  together. No entry lives longer than ENTRY_TTL.
- PullRequestSyncReactor: the periodic pass runs 1 s after each tick
  (nextPassDelay), so it finds them stale together and reads them in shared
  documents of 25. Requested syncs still run at once.

Badge data is at most one tick old when the pass writes it (Matt, q3440:
PR badges can lag up to 10 min).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Oct 14, 2026
@github-actions

Copy link
Copy Markdown

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 0f53a26.

This comment will update automatically after the next completed run.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant