Sort changelog entries by actual merge time (time-of-day, not just by day) - #259
Merged
Conversation
Entries were ordered lexicographically by `id` (a YYYY-MM-DD date prefix plus an arbitrary slug), so multiple PRs merged on the same calendar day rendered in name order rather than the order they actually landed. Add a `mergedAt` ISO-8601 UTC instant (time-of-day precision) to each fragment and sort newest-first by it, falling back to the id date prefix only when it's absent. Merge time is written straight from the merge event by stamp-pr-number.yml and backfilled from the GitHub API at deploy by resolve-prs.mjs; the build validator enforces the timestamp format. Backfilled all 85 existing fragments from their PRs' real merge times. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Preview removed for PR #259. |
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.
Problem
Changelog / What's New entries were sorted lexicographically by
id— aYYYY-MM-DDdate prefix plus an arbitrary slug:So when several PRs merged on the same calendar day, they rendered in slug/name order, not the order they actually landed. An entry merged at 01:57 could sit below one merged at 15:33 just because of its title. The
idalso only carries day granularity (and used the author's local date), so a PR merged after midnight UTC could even land on the wrong day relative to its neighbours.Fix
Sort by the PR's actual merge time, with time-of-day precision.
mergedAtfield on each fragment — an ISO-8601 UTC instant (e.g.2026-06-17T16:41:38Z), exactly GitHub'smerged_at.site/src/data/changelog.tsnow sorts newest-first bymergedAt, falling back to theiddate prefix (midnight UTC) only when it's absent, withidas a stable tiebreak..github/workflows/stamp-pr-number.ymlwritesmerged_atstraight from the merge event when a PR lands (alongside the PR number + contributors it already stamps).scripts/changelog/resolve-prs.mjsfillsmergedAtfrom the GitHub API at deploy as the safety net (mirrors howpr/authorsare resolved).site/scripts/validate-changelog.tsenforces the ISO-8601 format so a malformed value fails the build instead of silently misordering.tagsarrays preserved, prettier clean).Proof
Globally reverse-chronological by merge time after the change; previously-scrambled same-day clusters are now correct. Example, 2026-06-24 (11 entries):
updated-terms…(15:33)clearer-editing…(01:57, merged last)sync-fails-loudly…(21:43)entity-counts…(01:13)clearer-editing…(01:57) buried mid-listupdated-terms…(15:33, merged first)pnpm validate:changelogpasses (86 fragments); prettier clean on all touched files.🤖 Generated with Claude Code