Skip to content

Migrate to new simpleauth#481

Merged
mtlynch merged 78 commits into
masterfrom
new-simpleauth
May 3, 2026
Merged

Migrate to new simpleauth#481
mtlynch merged 78 commits into
masterfrom
new-simpleauth

Conversation

@mtlynch
Copy link
Copy Markdown
Owner

@mtlynch mtlynch commented Apr 19, 2026

No description provided.

mtlynch and others added 25 commits April 19, 2026 19:07
simpleauth v3 stores only UserID in sessions (not Username/IsAdmin),
requiring database lookups to reconstruct user info. This change adds
dev-mode auth cookies to carry username and admin state without extra
DB roundtrips, adds per-session database isolation for e2e tests, and
fixes Playwright setup to supply required env vars and wait robustly
for the server before running tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
These changes were debugging artifacts (sleep-based workarounds) that
are not necessary for the simpleauth v3 migration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The ncruces/go-sqlite3 WASM driver does not implement cache=shared for
in-memory databases: each new pool connection gets an empty database
rather than sharing the named one. This caused "no such table: users"
errors when concurrent browser requests hit different connections.

Limiting to one open connection ensures every query uses the same
underlying in-memory database.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The dev auth cookie (dev-is-admin) existed to work around a mismatch
where sessions lived in the shared database while user data lived in
per-session databases. This made the session manager's DB resolver
context-aware so sessions are stored in the same per-session database
as application data, eliminating the two-database problem entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mtlynch added a commit that referenced this pull request May 3, 2026
Previously, we had a mechanism in the debug built of the app to load
per-request databases. This pulls this behavior out of the app and makes
test isolation Playwright's job instead.

When we got to #481, there was just too much complexity to the
per-request DB and it was making request handling for auth too
complicated. It's simpler if we don't have to bend the app to satisfy
the test isolation goal.

This implementation starts one dev server per Playwright worker and
restarts it with a fresh SQLite database for each test so e2e isolation
no longer depends on app-level per-session DB routing.
# Conflicts:
#	handlers/auth.go
#	handlers/db_dev.go
#	handlers/password_reset.go
@mtlynch mtlynch merged commit 7be66f8 into master May 3, 2026
9 checks passed
@mtlynch mtlynch deleted the new-simpleauth branch May 3, 2026 12:55
@github-actions github-actions Bot locked and limited conversation to collaborators May 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant