Repository navigation
fix(deliveries): date a merge by the pull request's merged_at (#1290) - #1301
Merged
Merged
Conversation
added 2 commits
November 24, 2026 11:26
…ceipt (#1290) Red at this tip: the ledger row and the work item are stamped with nowIso() at receipt. The first case fails here; the second (no merged_at in the payload, one row at receipt) already passes and is kept as the regression guard.
The recorder and both work-item frames stamped nowIso() with the payload in hand, so a redelivered merge landed on the day of receipt. The app closure now takes one mergedAt parameter, threaded from pull_request.merged_at at both call sites, and keeps the receipt instant only when the payload carries no usable value. docs/architecture.md says which instant the ledger holds.
HugoXK-bot
approved these changes
Nov 24, 2026
HugoXK-bot
left a comment
Collaborator
There was a problem hiding this comment.
Verdict: PASS at 67ade55
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
Grounds:
- The defect is closed at both writers:
src/app.ts:7247readspull.merged_atonce (parsed, else null) and the ledger (:7171via:7253/:7262) and the board item (:7252create,:7260update) all consume it;:7171'smergedAt ?? nowIso()is the only receipt fallback. - Red first is the assertion, not a compile or fixture failure: at
7118d28b34ab(base6ebb0902+ the test commit only)test/deliveryOutcome.test.tsis 15/16,not ok 14failingactual '2026-11-24T11:58:41.985Z'vs'2026-11-20T10:00:00Z'attest/deliveryOutcome.test.ts:414; at the tip it is 16/16. - Replay stays a no-op and nothing else moved:
src/db.ts:4033-4036insertsON CONFLICT (repo_id, pr_url) DO NOTHING, testtest/deliveryOutcome.test.ts:447replays a second delivery id and still sees one row at the receipt instant (:449); the diff has no schema change and no backfill. - Acceptance 4 is inverted in wording, not in substance: I read it as "the fix must not pass half 1 by refusing or skipping a late delivery". Half 1 (
:414) requires the 2026-11-20 row to exist at the payload instant, and half 2 (:447-449) requires a payload withoutmerged_atto still write one receipt-dated row; both hold at the tip, so no behaviour is missing from the card. - Docs and changelog match:
docs/architecture.md:1653-1656names the stored instant and where the fallback applies;node scripts/changelog.mjs checkreports 15 fragments ok;ci-ok,pr-lint,test (24),riskandcoverageare success at this sha, andreview-gateis red only for the missing verdict. No UI face.
Ran:
npx tsx --test test/deliveryOutcome.test.tsin the tip tree — 16/16 pass, exit 0.npx tsx --test test/deliveryOutcome.test.tsat7118d28b34ab— 15/16,not ok 14withactual '2026-11-24T11:58:41.985Z', exit 1.node scripts/changelog.mjs check—15 fragment(s) ok, exit 0.curl https://api.github.com/repos/HugoXK/fledge/pulls/1301/reviews— 0 reviews at this head;curl .../commits/67ade554.../check-runs?filter=latest— 31 runs, 0 pending.
Not run: npm run check locally, Docker, and a live webhook redelivery — the full suite is green in CI at this sha (ci-ok, test (24)), and the acceptance is covered by the two tests above.
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.
Written-by: Fledge Platform Dev-3
Fixes #1290
The delivery ledger and the board item were dated by
nowIso()at receipt, with the webhook payload already in hand. So a redelivered event, or an operator replay from the admin webhook page, moved a merge to today:delivery_outcomes.merged_atand the work item'smerged_atshifted with the receipt, and the 90-day window plus any "merged this week" reading shifted with them.What changed: the app's
recordMergedDeliveryclosure takes onemergedAtparameter, and both call sites passpull_request.merged_atfrom the payload they already hold; the work-item frame at both branches reads the same value. The receipt instant remains only as the fallback for a payload that carries no usablemerged_at, and the(repo_id, pr_url)unique key still makes a replayed delivery a no-op. No new column, no backfill, nothing changed in the revert scan or the merge-commit column.One guard beyond the card's wording: the payload value is accepted only when it parses as a date (
Date.parsefinite), otherwise the receipt fallback applies. Storing an unparsable string would sort wrongly in the ledger'smerged_at DESCorder and render an invalid instant on the page.Alternatives considered: a second column holding GitHub's instant beside the receipt time — rejected, the card forbids a new column and two instants that disagree are worse than one that is right. Accepting any string the payload carries — rejected for the reason above.
Red first: commit
7118d28bis the tests alone. At the base6ebb0902,npx tsx --test test/deliveryOutcome.test.tsprinted# tests 16 / # pass 15 / # fail 1, and the failure was the half-1 assertionassert.equal(rows[0]?.merged_at, '2026-11-20T10:00:00Z', ...)withactual: '2026-11-24T11:25:12.889Z'(the receipt instant). The half-2 guard,a merge with no merged_at in the payload is still dated at receipt, passed at the base and still passes at the tip.Note on the card's acceptance bullet 4: as written it is causally inverted. "A fix that passes half 1 by skipping rows whose
merged_atis older than the receipt fails half 2" — such a fix fails half 1, because it never writes the late row that half 1 reads; half 2 is the guard that a fix cannot pass by refusing to record late deliveries. Recorded here rather than by editing the issue body, which is bound to the review hash7ca4f3cea1ea.Ran:
npx tsx --test test/deliveryOutcome.test.ts— 16 pass / 0 fail at the tip, 15 pass / 1 fail at the basenpm run check— exit 0: lint, typecheck, 3423 tests / 3423 pass / 0 fail, buildnode scripts/risk-gate.mjs --base 6ebb0902c488267237b61a3e400cdb921d2d17d9—risk-tier: T2; basis: src/app.tsnode scripts/changelog.mjs check— 15 fragment(s) okNot run: Docker image, a live webhook redelivery against a real repository, and the OpenAPI/meta-schema checks that belong to no part of this change.
Docs:
docs/architecture.md's delivery paragraph now says which instant the row holds and where the fallback applies, so noDocs-not-needed:line.