Skip to content

fix(api): add index tiebreaker to commit status ordering (#39508) - #39525

Merged
silverwind merged 3 commits into
go-gitea:release/v28from
GiteaBot:backport-39508-v28
Oct 1, 2026
Merged

silverwind merged 3 commits into
go-gitea:release/v28from
GiteaBot:backport-39508-v28

Conversation

@GiteaBot

@GiteaBot GiteaBot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Backport #39508 by @perfectra1n

Commit status list orders only by created_unix/updated_unix, which have 1-second resolution while CI often posts many statuses per second. With LIMIT/OFFSET paging, databases (e.g. PostgreSQL using a Sort plan) may order tied rows differently per page, so GET /repos/{owner}/{repo}/commits/{ref}/statuses returns some statuses twice and never returns others.

This became visible after #36521 made requests without page paginated. Clients like Renovate that page until X-Total-Count can miss a context's newest status and see a stale pending, blocking automerge.

Fix: add index (unique per commit) as a tiebreaker to the timestamp-based orders.

Possibly a candidate for backport to v28.

)

Commit status list orders only by `created_unix`/`updated_unix`, which
have 1-second resolution while CI often posts many statuses per second.
With LIMIT/OFFSET paging, databases (e.g. PostgreSQL using a Sort plan)
may order tied rows differently per page, so `GET
/repos/{owner}/{repo}/commits/{ref}/statuses` returns some statuses
twice and never returns others.

This became visible after go-gitea#36521
made requests without `page` paginated. Clients like Renovate that page
until `X-Total-Count` can miss a context's newest status and see a stale
`pending`, blocking automerge.

Fix: add `index` (unique per commit) as a tiebreaker to the
timestamp-based orders.

Co-authored-by: silverwind <me@silverwind.io>
@GiteaBot GiteaBot added topic/api Concerns mainly the API type/bug lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 1, 2026
@GiteaBot GiteaBot added this to the 29.0.0 milestone Oct 1, 2026
@GiteaBot
GiteaBot requested review from lunny and silverwind October 1, 2026 10:43
@GiteaBot GiteaBot modified the milestones: 29.0.0, 28.0.1 Oct 1, 2026
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 1, 2026
@silverwind
silverwind enabled auto-merge (squash) October 1, 2026 10:55
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Oct 1, 2026
@bircni bircni added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Oct 1, 2026
@silverwind
silverwind merged commit e48591b into go-gitea:release/v28 Oct 1, 2026
23 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/api Concerns mainly the API type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants