Skip to content

test(auth): pin agent#166 — login on empty users table returns fast 401 - #272

Merged
dwinter3 merged 1 commit into
mainfrom
test/166-login-empty-users-regression
May 16, 2026
Merged

test(auth): pin agent#166 — login on empty users table returns fast 401#272
dwinter3 merged 1 commit into
mainfrom
test/166-login-empty-users-regression

Conversation

@dwinter3

Copy link
Copy Markdown

Summary

agent#166 reported POST /api/v1/auth/login 504-hanging when the
users table is empty — filed 2026-05-09 against the
phase18-crosstalk image.

Not reproducible on current main. Verified three ways:

  1. test_login_unknown_user already posts a login against the
    unseeded (empty) users table — the suite is green.
  2. Live probe against the engineering L2: POST /auth/login with an
    unknown user → HTTP 401 in 0.35s.
  3. Code path: the handler's user is None short-circuit returns a 401
    before verify_password is ever reached; get_user is a plain
    indexed SELECT … WHERE username = :u that returns None
    instantly on an empty table. There is no hang path.

The auth handler was reworked after the issue was filed
(#251 / #252 / #253), and #165 (just merged) removes the
empty-users state in normal operation anyway. Whatever produced the
original 504 on phase18-crosstalk is gone.

Change

Adds test_login_empty_users_table_returns_401_fast — an explicit
regression test for the exact agent#166 scenario (a genuinely empty
users table, distinct from "unknown user on a populated table"), with
a generous elapsed-time guard so any future hang fails fast and loud.

Test plan

  • tests/test_auth.py — 30 passed
  • ruff check clean

Closes #166.

🤖 Generated with Claude Code

agent#166 reported POST /api/v1/auth/login 504-hanging when the users
table is empty (filed against the phase18-crosstalk image, 2026-05-09).

Not reproducible on current main: the handler's `user is None`
short-circuit returns a 401 before verify_password is reached, and
get_user is a plain indexed SELECT that returns None instantly on an
empty table. Verified two ways — `test_login_unknown_user` already
exercises the unseeded-table path (suite green), and a live probe
against the engineering L2 returns 401 in ~0.35s. The auth handler was
also reworked post-filing (#251/#252/#253).

Adds an explicit regression test for the exact agent#166 scenario
(genuinely-empty users table, not just unknown-user) with a generous
elapsed-time guard, so a future hang is caught as a fast failure rather
than a CI timeout.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@dwinter3
dwinter3 merged commit efaae1f into main May 16, 2026
1 check was pending
@dwinter3
dwinter3 deleted the test/166-login-empty-users-regression branch May 16, 2026 21:34
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.

bug: /api/v1/auth/login times out (504) when users table is empty instead of 401

1 participant