Skip to content

test(matrix): misc route coverage — incidents/confirm-deletion/usage-wall/webhook-inspector/experiments (exempt→mapped)#258

Merged
mastermanas805 merged 1 commit into
masterfrom
test/route-coverage-misc-2026-06-05
Jun 5, 2026
Merged

test(matrix): misc route coverage — incidents/confirm-deletion/usage-wall/webhook-inspector/experiments (exempt→mapped)#258
mastermanas805 merged 1 commit into
masterfrom
test/route-coverage-misc-2026-06-05

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

What

Closes the last real-flow wave of the route-coverage tail. The five "misc" routes that lived in route_donebar_guard_test.go's routeCoverageExemptions (TODO pointer, no mapped test) move exempt→mapped, each pointed at real DB-backed integration coverage.

New suite: internal/handlers/misc_routes_block_integration_test.go (TestMiscBlock_*) — drives each route through the SAME middleware chain router.go wires (RequireAuth / OptionalAuth / bare public) against a real migrated Postgres (+ Redis for the inspector round-trip).

Route Mapped test Coverage
GET /api/v1/incidents TestMiscBlock_Incidents_PublicFeed public feed contract, no auth
GET /auth/email/confirm-deletion TestMiscBlock_ConfirmDeletionRedirect_TokenBranches token IS credential: present → 302 w/ token verbatim; missing/blank → 400 missing_token
GET /api/v1/usage/wall TestMiscBlock_UsageWall_RealDBContract 401 unauth, near_wall=true + flattened metadata + cache headers, team-tier short-circuit, cross-team isolation
GET /api/v1/webhooks/:token/requests TestMiscBlock_WebhookInspector_TokenScopedAndIsolated receive→store→inspect; token-scoped + cross-token isolation; invalid→400, unknown→404, cross-team session→403
POST /api/v1/experiments/converted TestExperimentsConverted_WritesAuditRow already DB-backed/production-router covered by experiments_test.go; row points there

Scope

One self-contained PR: new test file + guard-map move. No handler-source edits. Helpers prefixed misc* (no redefinition of miniRedis/doJSON/decodeBody/requireTestDB).

Rebased onto origin/master after #257 (billing/api-keys/audit) merged into the same guard file — both disjoint move-sets preserved, guards green.

Post-move exemption audit

Remaining routeCoverageExemptions are all legitimately exempt:

  • OPTIONS/CORS preflight (livez/healthz/readyz/openapi.json)
  • webhook/receive/:token non-GET/POST verb fan-out (app.All; POST round-trip mapped)
  • static content (llms.txt, security.txt) + storage presign (cites handler test)
  • GitHub-App OAuth install/callback + HMAC webhook receivers (need a real App)
  • internal/operator routes + admin-console (path-prefix gated)
  • SES/Brevo provider webhooks + GET health-probes

Real-flow routes still exempt — W3 billing invoices/usage/payment/change-plan/promo + W4 PATCH /stacks/:slug/env — carry their own matrix-wave TODO pointers and are out of this wave's scope.

Gate

make gate — green except the documented pre-existing flakes (TestLinkGitHubID, TestGetExpiredDeployments, TestGetDeploymentsExpiringSoon, TestQueue_* NATS-503; all in untouched internal/models / NATS-dependent, identical on clean origin/master). All TestMiscBlock_* + the router done-bar guards pass.

🤖 Generated with Claude Code

…wall/webhook-inspector/experiments (exempt→mapped)

Closes the last real-flow wave of the route-coverage tail: the five "misc"
routes that lived in route_donebar_guard_test.go's routeCoverageExemptions
with a TODO pointer and no mapped test now move exempt→mapped, backed by a new
DB-backed handler-integration suite (misc_routes_block_integration_test.go,
TestMiscBlock_*) that drives each route through the SAME middleware chain
router.go wires against a real migrated Postgres:

  - GET /api/v1/incidents              → TestMiscBlock_Incidents_PublicFeed
      public status-page feed contract ({ok,items,total,status_page}, no auth).
  - GET /auth/email/confirm-deletion   → TestMiscBlock_ConfirmDeletionRedirect_TokenBranches
      tokenized email-link redirect (token IS the credential): present token →
      302 to dashboard with token carried verbatim; missing/blank → canonical
      400 missing_token envelope.
  - GET /api/v1/usage/wall             → TestMiscBlock_UsageWall_RealDBContract
      RequireAuth chain + real Postgres: 401 unauth, near_wall=true + flattened
      metadata + cache headers, team-tier short-circuit, team-scoped isolation.
  - GET /api/v1/webhooks/:token/requests → TestMiscBlock_WebhookInspector_TokenScopedAndIsolated
      receive→store→inspect round-trip: token-as-bearer reads only its own
      captures (cross-token isolation), invalid→400, unknown→404, cross-team
      session→403.
  - POST /api/v1/experiments/converted → TestExperimentsConverted_WritesAuditRow
      already DB-backed + production-router covered by experiments_test.go; the
      row points there rather than duplicating the audit round-trip.

Helpers are prefixed misc* (no redefinition of miniRedis/doJSON/decodeBody/
requireTestDB). After the move, the remaining routeCoverageExemptions hold only
legitimately-exempt routes (OPTIONS/CORS preflight, app.All verb fan-out,
static content, GitHub-App OAuth/HMAC callbacks, internal/operator + admin-
console, SES/Brevo provider webhooks) plus the W3 billing/api-keys/audit + W4
stack-env real flows that carry their own matrix-wave TODO pointers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 enabled auto-merge (squash) June 5, 2026 01:35
@mastermanas805 mastermanas805 merged commit e81cb99 into master Jun 5, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant