Repository navigation
projector(items): issue-shaped payloads must not reset a merged PR's merged/merged_at/draft - #4516
Merged
Merged
Conversation
…ields fromIssueOrPr defaulted draft/merged to 0 and merged_at to null for payloads whose shape carries no merge fields (the issue object of issues / issue_comment events), and upsertItem wrote those defaults over stored values: a merged PR regressed to merged=0, merged_at=null on the next label or comment event (#4158). - projector.ts: emit null draft/merged/merged_at when the payload object carries no merge fields; PR-shaped payloads unchanged. - store.ts: ItemRow draft/merged become number|null; upsertItem is now insert-or-ignore (defaults materialized for new rows) + a monotonic update that preserves stored merge fields when the incoming row does not carry them (merged_at follows the merged carrier signal). - projector.test.ts: repro tests (fake store + real store) — merged PR survives issues labeled and issue_comment events; PR-shaped payloads still update draft/merged/merged_at. Full projector suite: 76 pass, 0 fail.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 2, 2026
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.
Fixes #4158.
Problem
A
pull_requestclosed event storesmerged=1/merged_atset. A laterissues(labeled) orissue_commentevent for the same PR carries an issue-shaped object — it has apull_requestlink but nomerged/merged_at/draftfields.fromIssueOrPrdefaulted those to0/null, andupsertItemwrote the defaults over the stored row: the merged PR silently regressed tomerged=0,merged_at=null,draft=0.Fix
projector.ts—fromIssueOrPrnow emitsnullfordraft/merged/merged_atwhen the payload object carries no merge fields at all; PR-shaped payloads produce exactly the same values as before.store.ts—ItemRow.draft/mergedarenumber | null("not carried").upsertItemis now insert-or-ignore (defaults materialize for a brand-new row) plus the same monotonic update as before, except it preserves the stored merge fields when the incoming row does not carry them;merged_atfollows themergedcarrier signal, so a PR-shaped payload can still clear it. The single-statement upsert could not express this:excluded.draftwould already be the COALESCE'd insert value.reconcile.ts(it benefits viafromIssueOrPrunchanged).Tests
New repro tests in
test/projector.test.ts(fake store + real libSQL store):issueslabeled andissue_commentevents —mergedstays 1,merged_atstays set, and the later upserts demonstrably applied (labels moved);draft/merged/merged_atnormally.Full projector suite on the laptop:
bun test— 76 pass, 0 fail (10 files).Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.