implemented 03-gitea-client.md: added Gitea API client for commit statuses, status mapping, and extensive tests

This commit is contained in:
Michael Hoennig
2026-07-07 07:34:18 +02:00
parent a427665ce8
commit ae3ae7aa04
7 changed files with 528 additions and 1 deletions
+13
View File
@@ -38,3 +38,16 @@ WireMock (already a test dependency, see `WireMockSmokeTest`):
- `./gradlew ktlintFormat` then `./gradlew build` is green.
- No call path throws when Gitea is unconfigured or down.
## Execution Notes (2026-07-07)
Implemented as designed; deviations and decisions:
- Added `org.springframework:spring-web` as a dependency; `RestClient` lives there and `spring-boot-starter` alone does not provide it.
- `publishStatus` takes a `BuildStatus` and maps it internally instead of a raw Gitea state string.
The forward mapping never produces `error` because the `BuildStatus` enum is exhaustive; legacy emitted `error` only for unknown status strings.
- `readStatus` returns a sealed `GiteaStatusResult` (`Found`/`None`/`Disabled`/`Error`) so callers get explicit non-fatal error states instead of exceptions.
- `resolveUsername` only requires `gitea.baseUrl` and `git.token`; legacy gated it on the full status-enabled check including owner/repo, which the `/api/v1/user` endpoint does not need.
- Responses are read as strings and parsed with a dedicated Jackson `ObjectMapper` instead of RestClient message converters, keeping malformed-JSON handling explicit and independent of converter auto-detection.
- The legacy "Build status deleted" description marker is not ported; it belongs to the result-delete feature of later steps.
- No config changes were needed: `gitea.*` and `git.token` already exist in `GitTallyConfig`, the `init` templates, and `docs/configuration.md`.
+1 -1
View File
@@ -41,7 +41,7 @@ Foundation:
- [x] `01-build-state-domain.md` — build result domain model and persistent repository
- [x] `02-git-gateway.md` — full git access layer (fetch, branches, commits, checkout)
- [ ] `03-gitea-client.md` — Gitea API client for commit statuses
- [x] `03-gitea-client.md` — Gitea API client for commit statuses
Core engine: