Conversation
Resolve registered repos with LOWER(repo_full_name) so webhook events are not dropped when GitHub payload casing differs from the stored PK. Normalize payload.repository.full_name to the canonical row before handlers run, and apply the same case-insensitive match on repository events. Fixes #140
PR state (OPEN -> MERGED/CLOSED) was written only by the pull_request webhook handler. A single missed/dropped `pull_request.closed` delivery left a merged PR stuck OPEN forever: the frequent metadata-fetch path deliberately never touched state, there was no reconciliation, and backfill only ran on manual trigger. Observed on phase-rs/phase (#2745/2751/2752/2753/2756/3095 merged on GitHub, OPEN in the mirror), which makes the validator under-credit the miner since it reads PR state verbatim from the mirror. - Fetcher: fetchPrMetadata now also returns authoritative GraphQL state/mergedAt/closedAt/mergedBy. - Metadata handler: re-asserts that state (MERGED is terminal, so an in-flight stale fetch can't revert it) and logs corrected drift. - PrReconcileService: hourly sweep enqueues a metadata fetch for every still-open PR in registered repos within the scoring window, so missed merge events self-heal. Window/interval env-tunable. - RepoBackfillScheduleService: daily full backfill per registered repo as a coarse safety net; env kill-switch (NIGHTLY_BACKFILL_ENABLED=false). - Webhook handler: derive merged state from `merged` alone (synthesize merged_at from closed_at) so a closed event with a not-yet-populated merged_at isn't pinned to OPEN.
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.
Summary
Type of Change