Very low test coverage on most packages (delivery 0%, handlers 5.7%, middleware 0%, session 0%) #28

Closed
opened 2026-03-02 01:30:13 +01:00 by clawbot · 1 comment
Collaborator

Issue

Test coverage across the codebase is very low for critical packages:

Package Coverage Notes
internal/config 87.9% Good
internal/database 74.8% Decent
internal/globals 100% Good
internal/logger 84.0% Good
internal/handlers 5.7% Only tests handler creation and missing template error
internal/delivery 0.0% No tests at all for the core delivery engine
internal/middleware 0.0% No tests
internal/server 0.0% No tests
internal/session 0.0% No tests
internal/healthcheck 0.0% No tests
cmd/webhooker 0.0% No tests
pkg/config 47.5% Separate module

Critical Untested Paths

  1. Delivery engine: The entire delivery logic (HTTP delivery, retry with backoff, log delivery, database delivery) has zero test coverage. This is the core business logic.

  2. Webhook reception handler: No tests for the webhook receiver (event creation, delivery queuing, body size limits, inactive entrypoint handling).

  3. Source management handlers: No tests for CRUD operations (create, edit, delete webhooks, add entrypoints/targets).

  4. Auth middleware: No tests for the RequireAuth middleware, session validation, or metrics auth.

  5. Session management: No tests for session creation, destruction, cookie handling.

Notes

  • The config test has an integration gap: it tests DevSessionKey in the config layer but never verifies it works with the session layer (it doesn't — see issue #19).
  • The handlers test uses a mock database that returns nil for DB(), which doesn't reflect real behavior.

Category

Nice-to-have for 1.0 MVP, but critical for reliability going forward.

## Issue Test coverage across the codebase is very low for critical packages: | Package | Coverage | Notes | |---------|----------|-------| | `internal/config` | 87.9% | Good | | `internal/database` | 74.8% | Decent | | `internal/globals` | 100% | Good | | `internal/logger` | 84.0% | Good | | `internal/handlers` | 5.7% | Only tests handler creation and missing template error | | `internal/delivery` | 0.0% | **No tests at all** for the core delivery engine | | `internal/middleware` | 0.0% | No tests | | `internal/server` | 0.0% | No tests | | `internal/session` | 0.0% | No tests | | `internal/healthcheck` | 0.0% | No tests | | `cmd/webhooker` | 0.0% | No tests | | `pkg/config` | 47.5% | Separate module | ## Critical Untested Paths 1. **Delivery engine**: The entire delivery logic (HTTP delivery, retry with backoff, log delivery, database delivery) has zero test coverage. This is the core business logic. 2. **Webhook reception handler**: No tests for the webhook receiver (event creation, delivery queuing, body size limits, inactive entrypoint handling). 3. **Source management handlers**: No tests for CRUD operations (create, edit, delete webhooks, add entrypoints/targets). 4. **Auth middleware**: No tests for the RequireAuth middleware, session validation, or metrics auth. 5. **Session management**: No tests for session creation, destruction, cookie handling. ## Notes - The config test has an integration gap: it tests `DevSessionKey` in the config layer but never verifies it works with the session layer (it doesn't — see issue [#19](https://git.eeqj.de/sneak/webhooker/issues/19)). - The handlers test uses a mock database that returns nil for `DB()`, which doesn't reflect real behavior. ## Category Nice-to-have for 1.0 MVP, but critical for reliability going forward.
clawbot added the
bot
label 2026-03-02 01:30:13 +01:00
Owner

@clawbot please work on this

@clawbot please work on this
sneak closed this issue 2026-03-04 12:07:24 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/webhooker#28
No description provided.