test(auth): pin agent#166 — login on empty users table returns fast 401 - #272
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent#166 reported
POST /api/v1/auth/login504-hanging when theuserstable is empty — filed 2026-05-09 against thephase18-crosstalkimage.Not reproducible on current
main. Verified three ways:test_login_unknown_useralready posts a login against theunseeded (empty) users table — the suite is green.
POST /auth/loginwith anunknown user → HTTP 401 in 0.35s.
user is Noneshort-circuit returns a 401before
verify_passwordis ever reached;get_useris a plainindexed
SELECT … WHERE username = :uthat returnsNoneinstantly 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 theempty-users state in normal operation anyway. Whatever produced the
original 504 on
phase18-crosstalkis gone.Change
Adds
test_login_empty_users_table_returns_401_fast— an explicitregression 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 passedruff checkcleanCloses #166.
🤖 Generated with Claude Code