Commit 4845760
test(api): 100% patch coverage on cli-complete + ignored_fields/recycle branches
Closes the 100%-patch-coverage CI gate on #283. The e2e tests that exercised
these lines are build-tagged (excluded from the -short coverage run), so the
new handler error-arms showed as uncovered. Added UNIT tests + two minimal
test seams.
cli_auth.go (CompleteCLISessionHandler, D2): white-box tests in
cli_auth_coverage_test.go drive every error arm — missing/blank session id,
Redis-read failure, corrupt session blob, idempotent already-complete, non-UUID
team/user locals, team-not-found + team-lookup DB error, keygen failure,
CreateAPIKey failure, best-effort resource-list failure, happy-path session
flip (incl. the token-gathering loop), and the final session-write failure
(injected via a go-redis SET-failing hook). Handler now 100%.
provision_helper.go:
- recycleClaimURL (F1): the existing mint-failed test could not force the
failure (HMAC over any []byte key signs), so issueOnboardingJWT is now
reached through the issueOnboardingJWTFn seam; rewrote the test to force the
bare-URL fallback and added the mint-success (embeds-JWT) arm. 100%.
- knownJSONFields / collectJSONFields (D7): added reflection-edge tests —
typed nil pointer, non-struct input, pointer-to-pointer, anonymous
*struct embed, unexported non-embedded field, non-struct in collectJSONFields,
non-object body, empty object. Both 100%.
- parseProvisionBody content-type charset-strip + 415 arm covered directly.
Test seams generateAPIKeyPlaintextFn (cli_auth.go) and issueOnboardingJWTFn
(provision_helper.go) both default to the real func/method — zero prod
behavior change — mirroring the existing promoteDeploymentTTLsForTeamFn pattern
in billing.go.
diff-cover vs origin/master: 213 changed lines, 0 missing, 100%.
golangci-lint ./internal/handlers/ → 0 issues.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent fac6626 commit 4845760
5 files changed
Lines changed: 733 additions & 23 deletions
File tree
- internal/handlers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
| 283 | + | |
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
340 | 348 | | |
341 | 349 | | |
342 | 350 | | |
| |||
0 commit comments