GeezerVison is showing github.com — projector(reviews): webhook reviews get a fabricated created_at (delivery time, not submitted_at) — reconcile's correct row is then guard-refused forever · Issue #3087 · developing-today/code
projector(reviews): webhook reviews get a fabricated created_at (delivery time, not submitted_at) — reconcile's correct row is then guard-refused forever #3087DescriptionSummary
In the PM projector, a PR review delivered by webhook gets a fabricated timestamp. GitHub's pull_request_review payload review object has no created_at or updated_at — its only timestamp is submitted_at. The webhook path builds the review's comment row through commentCommon, whose timestamp fallback is "now", so the row is stored with created_at = the delivery instant and source_updated_at = the same delivery instant. Reconciliation builds the same review correctly (submitted_at for both fields), but its row can then never replace the webhook row: the store's monotonic guard refuses any upsert whose source_updated_at is older than the stored one, and the true submitted_at is always older than the fabricated delivery time. Every webhook redelivery or review edit fabricates a fresh "now", so the row's created_at keeps moving and the review sorts as brand-new in the activity stream forever.
Evidence (main 94fdb0f)
pm-stack/projector/src/projector.ts commentCommon (~lines 76-95): created_at = iso(c.created_at) ?? iso(c.updated_at) ?? new Date().toISOString(), and source_updated_at: createdAt. Nothing in the function knows about submitted_at.
pm-stack/projector/src/projector.ts pull_request_review branch (~lines 175-191): passes the raw review object to commentCommon, then sets base.submitted_at = iso(review.submitted_at) ?? base.created_at — i.e. the correct timestamp is read, but only into the secondary submitted_at field, after created_at/source_updated_at were already fabricated.
pm-stack/projector/src/reconcile.ts reviews stream (~lines 113-131): the same review is built with created_at = r.submitted_at ?? r.created_at and source_updated_at: createdAt — the two writers of the same row disagree.
pm-stack/projector/src/store.ts upsertComment (~line 224): conflict update gated by WHERE excluded.source_updated_at >= pmp_comments.source_updated_at; comment reads order by created_at DESC (~lines 265, 281).
Verified this run with a Bun probe driving the real applyEvent from projector.ts against a fake store mirroring the store.ts guard, for a review with submitted_at: 2026-10-02T03:04:05Z:
WEBHOOK ROW: { "id": "777", "kind": "review", "created_at": "2026-10-31T14:10:59.594Z",
"submitted_at": "2026-10-02T03:04:05Z", "source_updated_at": "2026-10-31T14:10:59.594Z", ... }
GUARD REFUSED upsert for 777 excluded 2026-10-02T03:04:05Z < stored 2026-10-31T14:10:59.594Z
AFTER RECONCILE: created_at still "2026-10-31T14:10:59.594Z" (fabricated delivery time kept)
Why it matters
The projector is the fleet dashboard's unified activity projection. A review's position in that stream is its created_at: a weeks-old review that is edited, dismissed, or merely redelivered jumps to the top as if just submitted, and reconciliation — the mechanism that is supposed to heal webhook drift — is permanently locked out of correcting that row by the guard the fabricated timestamp poisons. This is distinct from #2455 (the guard key for ordinary comments, whose payloads do carry real created_at/updated_at): here the input timestamp is absent by schema and fabricated instead of taken from submitted_at, and the two writers disagree.
Acceptance criteria
- A webhook-delivered review row carries
created_at and source_updated_at derived from the review's submitted_at (matching the reconcile builder), never from delivery time.
- After a webhook write, a reconcile write of the same review is not guard-refused for timestamp reasons (and vice versa): both writers produce the same guard key for the same source state.
- A redelivered or edited review event does not move the review's
created_at in getComments/subject-activity ordering.
- Regression tests cover: webhook review → reconcile same review (reconcile values win or agree); reconcile → webhook redelivery (no timestamp change); a review edit/dismissal still updates
review_state.
Dedup
Searched open + closed for projector review / submitted_at / source_updated_at / comment guard: #2455 (open) covers ordinary comment guard ordering and delete resurrection — its payloads carry real timestamps and it does not cover the review submitted_at fabrication or the webhook/reconcile writer disagreement. #2694 (open) is the bare-numeric-ID key collision in the same table — different defect. #2991 (closed) is webhook dedup on apply failure — different. Activitydezren39 commented on Oct 31, 2026 🤖 Agent note · filed
- Agent: new-issue-creator job (lane A, new-issue-creator-code-a)
- Session / ID: cron new-issue-creator-code-a, run 2026-10-31 09:05 CDT
- Found via: filed this run
- Task: Webhook-delivered PR reviews are stored with a fabricated created_at/source_updated_at (delivery time instead of the review's submitted_at), and reconcile's correct row for the same review is then refused by the store's monotonic guard — verified this run with a Bun probe driving the real applyEvent (see issue body).
- Expectation: effort s — triage routes a fix that makes the webhook review builder use submitted_at like reconcile.ts does, plus regression tests for the webhook↔reconcile ordering.
- Links: queue packet packet-3087-triage.json (repo-health-code-pilot)
dezren39 commented on Nov 8, 2026 🤖 Agent note · done — PR opened
dezren39 commented on Nov 14, 2026
Agent note — done (fixed_merged via salvage PR), task 15875 for issue #3087 (lane code-c)
dezren39 commented on Nov 14, 2026 🤖 Agent note · done — already fixed and merged (task 16833 revalidation)
- Agent: repo queue worker, lane code-a (repo-worker-code)
- Session / ID: cron repo-queue-worker-shift-code-a run 2026-11-14; task 16833
- Task: task 16833 for issue projector(reviews): webhook reviews get a fabricated created_at (delivery time, not submitted_at) — reconcile's correct row is then guard-refused forever #3087 (blocker triage; packet created as a follow-on of triage task 15272 after the fix had already landed).
- Fresh verification (this shift, via
gh): issue projector(reviews): webhook reviews get a fabricated created_at (delivery time, not submitted_at) — reconcile's correct row is then guard-refused forever #3087 is CLOSED. The fix landed via task 15875 (lane code-c): original PR fix(projector): use submitted_at for webhook review timestamps #7814 was superseded by the impl(observability): queue/PM integration views (#2072 slice 3) #7078/projector(reconcile): list-page elements are shape-trusted — a null/string element crashes the stream and wedges its cursor, a number-less element writes a phantom owner/repo#undefined row #7009 projector refactor, its one missing piece (the Codex P2 one-time upsertComment correction + 3 regression tests) was salvaged as PR fix(projector): one-time correction for legacy fabricated review timestamps (#3087) #9720, which is MERGED at 2026-11-14T04:42:19Z, merge commit 19ef6b6 — the merge closed this issue. Projector suite on the salvage branch: 135 pass / 0 fail (recorded on task 15875's note).
- Disposition: task 16833 completes as
already_done with that evidence. The dependent work it blocked (task 6179, issue Phase 4 (audit) of #4302 — closing writer inventory + contract statement for the PM projector #4303) is no longer gated on projector(reviews): webhook reviews get a fabricated created_at (delivery time, not submitted_at) — reconcile's correct row is then guard-refused forever #3087.
- Links: task 16833 · task 15875 · PR fix(projector): one-time correction for legacy fabricated review timestamps (#3087) #9720 · PR fix(projector): use submitted_at for webhook review timestamps #7814 · issue projector(reviews): webhook reviews get a fabricated created_at (delivery time, not submitted_at) — reconcile's correct row is then guard-refused forever #3087
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|