Repository navigation
SWF(bug): Stabilize repo listing pagination - #668
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
jatmn
left a comment
There was a problem hiding this comment.
🟢 Thanks for the contribution. I do not see any actionable issues from my review.
Merge readiness
- Branch freshness: Head merge-base matches live
origin/mainat65d55405f64e35e02a0e048d1b7b2fe6dbbbd8a1(no stale-base rebase needed for conflict or drift). - Merge gate: GitHub reports
mergeable_state: blockedpending required review (review requested fromjatmn), not merge conflicts. - Required checks: PR Checks workflows on head are SUCCESS (
fmt + clippy,test (stable),test (beta),build --release, MSRV, changed surfaces, triage). CodeQL completed NEUTRAL (informational). - Local validation:
cargo check -p twigpine-nodeon head succeeded in the review checkout; sqlx integration tests were not run here (DATABASE_URLunset). CI test jobs are the runtime oracle forlist_repos_pages_*. - Duplicate work: No open duplicate PR located for this pagination tie-break fix.
Notes (non-blocking)
- New tests cover anon tied-timestamp paging and distinct-timestamp visibility paging; they do not combine tied
updated_atwith visibility holes in one scenario. That is acceptable for this scope because filter-then-slice preserves SQL order among visible rows. - GraphQL legacy
reposand other dedup listing helpers still order byupdated_atonly on unchanged paths; that behavior predates this PR and is outside the REST offset-pagination fix.
Break equal
updated_atties by repo ID so offset pages agree on the order.GET /api/v1/reposused onlyupdated_at DESCafter mirror deduplication. Postgres can return ties in a different order when its plan changes. The handler preserves that order through visibility filtering, then slices by offset. On two instances of the same main build against the same data, taking page one atwork_mem=4MBand page two at64MBreturned three duplicate IDs.The query now orders by
updated_at DESC, id ASC. Distinct timestamps still sort newest first. Visibility, mirror selection, star counts andX-Total-Countwork as before. This fixes ties, not rows moving between pages when their timestamps change.The endpoint test walks three offsets through tied rows whose names sort opposite to their IDs. Before:
After:
The distinct-timestamp test checks rows, order, stars and
X-Total-Countfor anonymous, owner and allowlisted callers on both versions. It injects an authenticated DID through the existing router harness; it doesn't exercise HTTP-signature verification.Formatting and workspace Clippy passed. In
cargo test --workspace, the unrelated sweep timing test failed withleft: 2,right: 1and passed on its own. The four default node integration suites passed separately.Try with
DATABASE_URLset to a local Postgres 16+ instance:cargo test -p twigpine-node --lib list_repos_pages_Summary by CodeRabbit