Skip to content

projector(items): issue-shaped payloads must not reset a merged PR's merged/merged_at/draft - #4516

Merged
dezren39 merged 1 commit into
mainfrom
queue/6325-4158-projector-merged
Nov 2, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/6325-4158-projector-merged

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #4158.

Problem

A pull_request closed event stores merged=1 / merged_at set. A later issues (labeled) or issue_comment event for the same PR carries an issue-shaped object — it has a pull_request link but no merged / merged_at / draft fields. fromIssueOrPr defaulted those to 0 / null, and upsertItem wrote the defaults over the stored row: the merged PR silently regressed to merged=0, merged_at=null, draft=0.

Fix

Tests

New repro tests in test/projector.test.ts (fake store + real libSQL store):

  • merged PR survives issues labeled and issue_comment events — merged stays 1, merged_at stays set, and the later upserts demonstrably applied (labels moved);
  • PR-shaped payloads still update draft / merged / merged_at normally.

Full projector suite on the laptop: bun test — 76 pass, 0 fail (10 files).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…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.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 18:12
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a82efafe-9aba-4d15-8c33-908c45a85f92
Commits

Reviewing files that changed from the base of the PR and between c91c679 and 0ca284f.

Files selected for processing: 3
  • pm-stack/projector/src/projector.ts
  • pm-stack/projector/src/store.ts
  • pm-stack/projector/test/projector.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T18:13:56.214983Z 0ca284f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

projector(items): an issues/issue_comment event for a merged PR resets merged to 0 and clears merged_at — issue-shaped payloads carry no merge fields

1 participant