test(deploy): add a real login smoke test, not just a health check #11

Merged
BBergle merged 1 commits from test/deploy-login-smoke-test into main 2026-09-21 22:57:35 -04:00
Owner

Adds scripts/smoke-test.sh — found on the actual first deployment that /api/v1/healthz proves nothing about whether login works, because the session cookie is Secure in production and a plain-HTTP test (an IP, a bare port) silently drops it. Login returns 200; the very next request looks unauthenticated; from a browser it looks exactly like "logged in, bounced back to the login screen," with no visible error. That happened for real this session.

What it does

Runs the actual round trip a browser does: login, confirm a session cookie was stored (not just sent — curl won't store a Secure cookie from a non-HTTPS response either, matching real browser behavior), then an authenticated follow-up request confirming it succeeds and returns the right account.

How this was verified

Ran it for real against the live deployment before committing it, both directions:

  • Against a throwaway account, over plain HTTP, against a container actually running VELODROME_ENVIRONMENT=production → got the expected FAIL, with the diagnostic correctly pointing at the Secure-cookie mismatch (this is the literal bug that just happened).
  • Same account/URL once the container's environment was development (inadvertently, from a manual recreate) → got PASS, correctly reflecting that development doesn't set Secure.

Test accounts created for this were cleaned up afterward (direct SQL delete via the running container — there's no CLI for this yet, matches D18's scope).

Docs

deploy/README.md gets a new section recommending this as the real post-deploy check, replacing "hit /healthz and eyeball it" for anything involving auth — pointed at the real public URL, not an IP, since that's the only way this test means anything.

🤖 Generated with Claude Code

Adds `scripts/smoke-test.sh` — found on the actual first deployment that `/api/v1/healthz` proves nothing about whether login works, because the session cookie is `Secure` in production and a plain-HTTP test (an IP, a bare port) silently drops it. Login returns 200; the very next request looks unauthenticated; from a browser it looks exactly like "logged in, bounced back to the login screen," with no visible error. That happened for real this session. ## What it does Runs the actual round trip a browser does: login, confirm a session cookie was *stored* (not just sent — curl won't store a `Secure` cookie from a non-HTTPS response either, matching real browser behavior), then an authenticated follow-up request confirming it succeeds and returns the right account. ## How this was verified Ran it for real against the live deployment before committing it, both directions: - Against a throwaway account, over plain HTTP, against a container actually running `VELODROME_ENVIRONMENT=production` → got the expected `FAIL`, with the diagnostic correctly pointing at the Secure-cookie mismatch (this is the literal bug that just happened). - Same account/URL once the container's environment was `development` (inadvertently, from a manual recreate) → got `PASS`, correctly reflecting that `development` doesn't set `Secure`. Test accounts created for this were cleaned up afterward (direct SQL delete via the running container — there's no CLI for this yet, matches D18's scope). ## Docs `deploy/README.md` gets a new section recommending this as the real post-deploy check, replacing "hit /healthz and eyeball it" for anything involving auth — pointed at the real public URL, not an IP, since that's the only way this test means anything. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
BBergle added 1 commit 2026-09-21 22:55:03 -04:00
test(deploy): add a real login smoke test, not just a health check
CI / Repo hygiene (pull_request) Successful in 2s
CI / Web (lint, typecheck, build) (pull_request) Successful in 14s
CI / Migrations reversible (pull_request) Successful in 12s
CI / API (lint, types, tests) (pull_request) Successful in 59s
8c88748f50
Found on the actual first deployment: /api/v1/healthz proves the process is
up, but says nothing about whether login actually works, because the
session cookie is set with Secure in production. Test through a plain-HTTP
address (an IP, a bare port, skipping the reverse proxy) and /auth/login
still returns 200 with a valid body — the cookie is just silently dropped by
the client, so the very next request looks unauthenticated. From a browser
this looks exactly like "I logged in and it bounced me straight back to the
login screen," with no error anywhere to point at.

scripts/smoke-test.sh does the real round trip a browser does: login,
confirm a session cookie was actually stored (not just sent), then an
authenticated follow-up request confirming it succeeds and returns the
right account. Verified it actually catches what it's meant to catch before
committing: ran it against a throwaway account over plain HTTP against a
production-mode container and got the expected FAIL with a diagnostic
pointing at the Secure-cookie mismatch, then confirmed PASS once the
container's VELODROME_ENVIRONMENT was (inadvertently, in this case)
development instead.

Documented in deploy/README.md as the real post-deploy check, replacing
"hit /healthz and eyeball it" for anything involving auth.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2ZKeWkZV7ehf7fivrAkkG
BBergle merged commit f6005a4fdd into main 2026-09-21 22:57:35 -04:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: BBergle/bike-app#11