Repository navigation
fix(projector): source prs stream from pulls endpoint so draft/merged heal (#4528) - #4597
Conversation
|
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 57 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. CodeRabbit Verify
|
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0c9c9157b
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const row = fromIssueOrPr(repo, pr, "pr"); | ||
| await store.upsertItem(db, row); |
There was a problem hiding this comment.
Derive merged status from the pulls-list payload
For merged PRs, the GitHub pulls-list response contains merged_at but no merged boolean. Passing it directly to fromIssueOrPr makes that mapper emit merged=0, because it checks only obj.merged. Consequently, this poll not only fails to heal legacy merged flags but also overwrites correct merged=1 values previously stored by webhooks: upsertItem accepts equal updated_at timestamps. The aggregator then displays those PRs as closed rather than merged. Derive the flag from merged_at or fetch the detail payload, and remove the artificial merged field from the list-response test fixtures so they exercise the real API shape.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in a09c6cd — thank you, this was a real bug. fromIssueOrPr now derives merged from merged_at when the boolean is absent (the pulls LIST shape), keeping the explicit boolean when present and null for issue-shaped payloads (#4158 preservation unchanged). The reconcile tests were also made realistic: the pulls fixtures no longer carry a merged key, so merged-first-sight (merged=1 + merged_at) is proven against the actual list-endpoint shape. Full projector suite: 79 pass / 0 fail. The derivation was salvaged from duplicate PR #4687, which had it right; #4687 is being closed as the duplicate with a salvage note here.
|
🤖 Agent note · salvage + canonical resolution (task 6483, lane code-d) Canonical PR: this one (#4597) — the PR bound to queue task 6483, opened by its first claimant lane at c0c9c91. PR #4687 was a later duplicate from a re-claim (branch queue/6483-4528-reconcile-prs); it is being closed as superseded by this PR. Salvage from #4687 (diffed in full, per protocol): its one unique correctness item — deriving Codex dispositions:
Tests: bun test in pm-stack/projector on the laptop worktree: 79 pass / 0 fail, including draft-first-sight, merged-first-sight, and heal-after-gap. |
Queue task 6483 · fixes #4528 (triaged as task 6438).
Reconcile's only item source for PRs was the issues endpoint, whose PR objects carry no draft/merged/merged_at. First-sight PR rows materialized draft=0/merged=0 and the #4158 preservation logic pinned those false defaults forever — re-polling never healed them.
This change sources the prs stream from repos/{repo}/pulls (pulls-shaped, carries the merge fields) instead. Pulls truth lands on first sight and heals legacy false-default rows on a later pass via the existing upsert path. The issues stream is unchanged (still reads the issues endpoint, still skips pull_request-link objects). The reviews stream already enumerated pulls; no change there.
Tests (pm-stack/projector, bun test — 79 pass, 0 fail across 10 files):
Out of scope per packet: issues stream behavior, webhook issue-shaped reset (#4158, fixed by #4516), item deletion (#4210), application-contract design/audit (#4302/#4303).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.