# TASK-005: Browse repositories and branches Status: implemented and independently reviewed by Claude; no P0/P1 findings; device check deferred Owner: Codex Reviewer: Claude ## Writable paths - `app/src/main/java/com/ubisam/ubgitea/feature/repositories/` - `app/src/test/java/com/ubisam/ubgitea/feature/repositories/` - `app/src/main/java/com/ubisam/ubgitea/MainActivity.kt` - `app/src/main/java/com/ubisam/ubgitea/data/auth/AuthApi.kt` (testable gateway extraction only) - `app/src/main/java/com/ubisam/ubgitea/data/repositories/RepositoryListApi.kt` (testable gateway extraction only) - `app/src/main/res/values/strings_repositories.xml` - `app/src/main/java/com/ubisam/ubgitea/ui/navigation/` - `app/src/test/java/com/ubisam/ubgitea/ui/navigation/` - `tasks/005-repository-branch-ui.md` ## Outcome A signed-in user can browse every repository and branch visible to their Gitea account with loading, pagination, refresh, empty, offline, expired-authentication, and server-error states. ## Acceptance criteria - [x] Repository and branch lists preserve pagination and refresh state. - [x] Organization/owner, visibility, default branch, and selected branch are unambiguous. - [x] Loading, empty, offline, authentication-expired, and server-error states are accessible and localized. - [x] Retry and pagination cannot create duplicate items or overlapping requests. - [x] Presentation and ViewModel tests cover primary states and selection behavior. - [x] Resource names use the `repositories_` prefix. - [x] The reviewed completion commit is recorded as TASK-006's contract-freeze base. ## Evidence - Repository rows open a repository-scoped branch/tag screen; the selected repository, account, default branch, protected status, selected ref, and abbreviated commit ID remain visible. - Branch and tag pages are consumed serially with a 100-page bound, presenter-level name deduplication, cancellation of replaced operations, refresh/retry, and deterministic back navigation to the immutable repository snapshot. - Focused presenter/ViewModel tests passed, including default selection, tag selection, back restoration, immutable snapshots, deduplication, and network-error mapping. - Repository-wide `assembleDebug testDebugUnitTest lintDebug` passed: 96 unit tests across 21 suites, zero failures/errors. - `git diff --check` passed. Focused sensitive-pattern inspection found no token, client secret, password, private key, or credential material. - The independent reviewer and physical-device interaction check are deferred while Codex owns the serial implementation stream. TASK-006 may be developed on the local contract, but its eventual integration review must include this commit before the contract-freeze checkbox is closed. ## Claude independent review closure Reviewed read-only at commit `bbbff77` per `handoff/claude-master-handoff.md`. Independently reran `assembleDebug testDebugUnitTest lintDebug --rerun-tasks` at `16c46a5` (which includes this commit): BUILD SUCCESSFUL, 102 tests / 23 suites, 0 failures; `git diff --check` clean. - Races/cancellation (verified, no finding): `selectRepository`, `refreshReferences`, and `retry` all route through `startOperation`, which cancels the prior `Job` before launching the next one, so rapid repository/branch/tag switches cannot overlap. - Immutable snapshots (verified, no finding): `RepositoryListUiState.Content` and `ReferencesContent` wrap their lists in `Collections.unmodifiableList`; `backToRepositories()` restores the stored `repositoryContent` snapshot rather than reloading, and the restored snapshot cannot be mutated by later reference-loading state. - Page overflow (verified, no finding): `loadAllPages` bounds branch/tag pagination to `MAX_REFERENCE_PAGES` (100) and throws a typed failure instead of looping forever if a server never reports the end of a list. - No P0/P1 found. The 409/422 typed-failure gap recorded under TASK-004 was the only cross-cutting finding and is now fixed there. Device interaction remains deferred (no physical device available in this environment); this is an existing known limitation, not a new finding.