Unit-test GiteaClient's 404->NotFound status mapping #2

Open
opened 2026-06-28 16:56:35 +02:00 by Brummel · 0 comments
Owner

Context

GiteaClient::branch_sha / fetch_raw (src/gitea/client.rs:43-68) map a 404
response to GiteaError::NotFound and any other non-success status to
GiteaError::Transport. The 404->NotFound branch is the invariant-3
broken-reference signal — load-bearing.

Gap

That status mapping is exercised by no unit test. The in-module tests cover
only extract_commit_id (the pure parser); MockFetcher hardcodes its miss;
the gated live smoke (tests/live_smoke.rs) covers only the happy-path fetch.
The 404 branch of the live client stays unverified.

Acceptance

A test that drives GiteaClient against a controllable HTTP status — a local
stub server, or an injectable status seam — and asserts 404 -> NotFound,
non-success -> Transport, 200 -> body.

Surfaced by the cycle-0001 close audit (architect drift, med).

## Context `GiteaClient::branch_sha` / `fetch_raw` (`src/gitea/client.rs:43-68`) map a 404 response to `GiteaError::NotFound` and any other non-success status to `GiteaError::Transport`. The 404->`NotFound` branch is the invariant-3 broken-reference signal — load-bearing. ## Gap That status mapping is exercised by no unit test. The in-module tests cover only `extract_commit_id` (the pure parser); `MockFetcher` hardcodes its miss; the gated live smoke (`tests/live_smoke.rs`) covers only the happy-path fetch. The 404 branch of the live client stays unverified. ## Acceptance A test that drives `GiteaClient` against a controllable HTTP status — a local stub server, or an injectable status seam — and asserts 404 -> `NotFound`, non-success -> `Transport`, 200 -> body. Surfaced by the cycle-0001 close audit (architect drift, med).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Brummel/DocSite#2