Ubisam-MobileGit/tasks/006-code-browser.md

42 lines
2.9 KiB
Markdown

# TASK-006: Browse trees and source code by ref
Status: implemented and locally verified — independent review/device check deferred
Owner: Codex
Reviewer: Claude (deferred until independent review is re-enabled)
## Outcome
A user can navigate directories and view source files at an explicit branch, tag, or commit without silently changing refs.
## Writable paths
- `app/src/main/java/com/ubisam/ubgitea/feature/codebrowser/`
- `app/src/test/java/com/ubisam/ubgitea/feature/codebrowser/`
- `app/src/main/res/values/strings_codebrowser.xml`
- TASK-006 evidence only
- `app/src/main/java/com/ubisam/ubgitea/MainActivity.kt` (feature wiring only)
- `app/src/main/java/com/ubisam/ubgitea/feature/repositories/RepositoryListScreen.kt` (selected-ref handoff only)
- `app/src/main/java/com/ubisam/ubgitea/feature/repositories/RepositoryListViewModel.kt` (selected-ref handoff only)
Shared domain, data, Gradle, and manifest contracts remain unchanged. Codex temporarily owns implementation because the product owner paused Claude work while retaining Claude as the future independent reviewer.
## Acceptance criteria
- [x] Repository, selected ref, and current path remain visible.
- [x] Directory navigation is deterministic and safely handles encoded names.
- [x] Text files render with bounded memory use and copy support.
- [x] Binary, Git LFS, submodule, unsupported encoding, and oversized-file states have explicit fallbacks.
- [x] Loading, empty, offline, authentication-expired, not-found, and server-error states are localized and accessible.
- [x] Tests cover ref preservation, path navigation, content classification, and size limits.
- [x] Resource names use the `codebrowser_` prefix.
- [ ] Evidence records the exact reviewed TASK-005 contract-freeze commit.
## Evidence
- Implemented against TASK-005 local completion commit `bbbff77`. It remains a provisional integration base until the deferred independent review closes the contract-freeze criterion.
- Selecting a branch or tag opens its root tree. Every load carries immutable repository coordinates and an explicit ref; no navigation action substitutes the default branch.
- Breadcrumb and parent navigation operate on validated `RepositoryPath` values without decoding encoded-looking names. Directory rows use the server-returned validated path, and directory results are bounded, deduplicated, directory-first, and deterministic.
- Source viewing reuses the reviewed TASK-006A strict classifier with 1 MB input, 200,000-code-point, and 10,000-line display limits. Text is selectable and copyable; truncation, binary, LFS, unsupported UTF-8, oversized, symlink, and submodule states are explicit.
- Focused code-browser tests and repository-wide `assembleDebug testDebugUnitTest lintDebug` passed: 102 unit tests across 23 suites, zero failures. `git diff --check` and focused sensitive-pattern/read-only scans passed.
- Device interaction and independent review remain deferred while Codex owns the serial implementation stream.