Ubisam-MobileGit/tasks/021-repository-global-recent-update-order.md

34 lines
1.9 KiB
Markdown

# TASK-021: Enforce recent-push repository order across pages
Status: implemented and device-verified
Owner: Codex
Reviewer: Claude
## Outcome
The repository list places the repository with the newest Gitea `updated_at` value at the top of page 1 and preserves that descending order across every local page, even when this Gitea server ignores `sort=updated&order=desc` on repository-list endpoints.
## Scope
- Read every accessible repository page for the selected list (all, organization, or favorites).
- Sort the complete result by `updatedAtEpochMillis` descending before splitting it into five-row UI pages.
- Cache the sorted snapshot during navigation and invalidate it on refresh or logout.
## Acceptance criteria
- [x] A newer repository returned on a later server page appears before older repositories from page 1.
- [x] Local next/previous navigation does not refetch the complete server list.
- [x] Refresh invalidates and rebuilds the sorted snapshot.
- [x] Empty, error, authentication-expired, organization, and favorites behavior remains intact.
- [x] Build, unit tests, lint, secret scan, and physical-device verification pass.
## Note
The Gitea repository payload exposes `updated_at`, which is the existing product proxy for recent repository push activity. Exact branch commit timestamps continue to be fetched only for the five visible rows so one repository with a broken branch endpoint cannot block the global list.
## Evidence
- Focused ViewModel tests cover cross-server-page sorting, five-row local paging, navigation caching, and refresh invalidation.
- `assembleDebug testDebugUnitTest lintDebug` passed.
- The APK was installed wirelessly over the existing authenticated app. Page 1 changed from the server's apparent alphabetical order to the newest-update order, rendered five repositories with their latest branch labels, retained next-page navigation, and produced no crash entry.