Uh oh!
There was an error while loading. Please reload this page.
test(api): cover client endpoints + error paths (77.9% -> 96.3%) - #269
Conversation
Wave-2 coverage for internal/api, all via httptest stubs + a dead transport: - APIError.Error(), RevokeClient, ListClientAdmins — were 0%, now covered (2xx + non-2xx + bad-JSON arms). - Every endpoint's transport-error arm (post/get returned an error) via an errRoundTripper client. - Non-2xx APIError arms + 2xx-undecodable decode arms across RequestDeviceCode, PollToken, RevokeToken, CreateClient, PatchClientClusterID, ListClients, WhoAmI. - PollToken edge cases (2xx-missing-token, expired_token -> ErrExpiredToken); RequestDeviceCode empty-fields; ListClients DRF `next` pagination + nextPath. Package clears 95% (96.3%). The few remaining branches are the 426-upgrade detection + nextPath's bad-URL guard + the maxListPages backstop. make ci green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LukasWodka
commented
Jul 14, 2026
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3bb6678. Configure here.
saadqbal
left a comment
There was a problem hiding this comment.
LGTM 👍 Good endpoint coverage — verified the expired_token→ErrExpiredToken mapping and the ListClients DRF next-pagination loop (with the maxListPages guard) against source. Batching the non-2xx/transport/decode arms across all endpoints keeps it tight. Clean.
saadqbal
commented
Jul 14, 2026
Lint is red on The |
The CI Lint job (errcheck) flagged the unchecked fmt.Fprintf in TestListClients_Pagination's httptest handler. Assign to _,_ like the sibling w.Write calls. No behavior change; unblocks #269's Lint check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LukasWodka
commented
Jul 14, 2026
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2b07a1a. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Wave-2 coverage for
internal/api: 77.9% → 96.3% ✅. All viahttpteststubs + a dead-transport client — no production changes.APIError.Error(),RevokeClient,ListClientAdminswere 0% → now covered (2xx / non-2xx / bad-JSON arms).post/getitself failing) via anerrRoundTripperclient.APIErrorarms + 2xx-undecodable decode arms acrossRequestDeviceCode,PollToken,RevokeToken,CreateClient,PatchClientClusterID,ListClients,WhoAmI.PollToken2xx-missing-token +expired_token→ErrExpiredToken;RequestDeviceCodeempty-fields;ListClientsDRFnextpagination (exercisesnextPath+ the follow loop).Clears 95%. The few remaining branches are the central 426-upgrade detection,
nextPath's bad-URL guard, and themaxListPagesbackstop — left per the "honest ceiling" policy.Test plan
make cigreen. Behavior-asserting httptest tests; no production changes.🤖 Generated with Claude Code
Note
Low Risk
Test-only changes using httptest stubs; no runtime or API behavior is modified.
Overview
Adds test-only coverage for
internal/api’s HTTP client, raising package coverage from ~78% to ~96% with no production code changes.New
httptesthelpers (stubClient) and suites assertAPIError.Error(),RevokeClient, andListClientAdmins(success, HTTP errors, bad JSON). Bulk tests hit non-2xxAPIErrorand 2xx decode failures across device auth, token revoke, client CRUD,WhoAmI, andListClients.errRoundTripperexercises transport failures on every exported endpoint. Edge cases coverRequestDeviceCodeempty fields,PollTokenmissing token andexpired_token→ErrExpiredToken, andListClientsDRFnextpagination across two pages.Reviewed by Cursor Bugbot for commit 2b07a1a. Bugbot is set up for automated code reviews on this repo. Configure here.