Add ChangedFile type and GetChangedFiles() method that calls the Gitea
API endpoint GET /repos/{owner}/{repo}/pulls/{index}/files to retrieve
the list of files changed in a pull request. This is a prerequisite for
displaying changed files in the PR detail view (#189).
Includes unit tests for success and error cases.
Closesleeworks-agents/gitea-mobile#205
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add 4 new integration-style unit tests for GetTriageQueue using mock
HTTP servers: full integration test verifying issue filtering (assigned
vs unassigned), PR inclusion, and priority sorting; empty orgs test;
all-assigned test (expect empty queue); and label extraction test
verifying multi-label items are correctly populated.
Closesleeworks-agents/gitea-mobile#117
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add automatic retry logic to doRequest for HTTP 429 responses. Uses
Retry-After header when present, otherwise exponential backoff
(1s, 2s, 4s). Respects context cancellation during waits. Defaults
to 3 max retries with 1s base delay. Includes 7 new tests covering
retry success, exhaustion, Retry-After header, context cancellation,
non-429 errors, and backoff calculation.
Closesleeworks-agents/gitea-mobile#132
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add four test functions using httptest.NewServer:
- TestApplyLabel: verifies POST request path, auth header, label IDs
in body, and cache invalidation after success
- TestApplyLabel_Error: verifies 404 error propagation
- TestSubmitReview: verifies POST path, event/body fields, and cache
invalidation after success
- TestSubmitReview_Error: verifies 422 error propagation
Closesleeworks-agents/gitea-mobile#127
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add comprehensive unit tests using mock HTTP servers for four key
aggregation methods in the Gitea client. Tests cover correct API
integration, caching behavior, sorting, state filtering, repo
filtering, pagination, and label handling.
Closesleeworks-agents/gitea-mobile#122Closesleeworks-agents/gitea-mobile#121
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add SetIssueState client method and handler for toggling issue state
between open and closed via PATCH API. Add AddComment client method
wrapping PostComment. Register new routes POST /issues/{owner}/{repo}/{index}/state
and POST /issues/{owner}/{repo}/{index}/comments. Update issue_detail.html
template with comment form (HTMX inline append) and close/reopen button
(HTMX inline swap of state badge).
Closesleeworks-agents/gitea-mobile#29
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add CloseIssue (PATCH state=closed) and PostComment (POST comment body)
methods to the Gitea client with cache invalidation. Add corresponding
handler routes POST /issues/{owner}/{repo}/{index}/close and
POST /issues/{owner}/{repo}/{index}/comment with HTMX support.
Include unit tests for both client methods.
Closesleeworks-agents/gitea-mobile#36
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add core aggregation layer wrapping the Gitea API for fan-out
concurrent fetching across repos and organizations with caching.
- internal/gitea/client.go: Gitea API client with aggregation
- ListOrgs/ListOrgRepos/ListOrgsAndRepos for org enumeration
- ListAllIssues: concurrent fetch across repos via goroutines with semaphore (5)
- ListAllPullRequests: same pattern for PRs
- GetTriageQueue: unassigned issues + open PRs, sorted by priority
- CreateIssue, ApplyLabel, SubmitReview: write operations with cache invalidation
- In-memory cache with 30s TTL using sync.RWMutex
- internal/gitea/client_test.go: unit tests for caching, priority scoring,
API calls with httptest server, and triage queue sorting
Closesleeworks-agents/gitea-mobile#3
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>