Skip to content

test(public-api): add 503 resilience tests for checkLockout/recordFailedAttempt Redis rejection paths #181

@coderabbitai

Description

@coderabbitai

Follow-up from PR #164

This issue tracks adding test coverage for the Redis error (503 / rejection) paths in the login lockout utilities introduced in PR #164.

Context

PR #164 added Redis-backed login lockout to apps/public-api. The implementation correctly uses fail-open behavior on success paths and fail-closed on lockout reads when Redis is unavailable. However, test cases explicitly asserting this resilience behavior (i.e., when checkLockout or recordFailedAttempt rejects with a Redis error) are not yet present.

What needs to be done

Add unit/integration tests to apps/public-api/src/__tests__/userAuth.email.test.js (and any other relevant test files) covering:

  1. checkLockout rejects (Redis down) — login should proceed normally (fail-open), not surface a 500 to the caller.
  2. recordFailedAttempt rejects (Redis down) — login failure response should still return the appropriate 400, without surfacing a Redis error.
  3. clearLockout rejects (Redis down) — signup / password-reset should complete successfully and only log the error (fail-open).

References

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions