Skip to content

Tech-debt batch 7: users durable checkpoints via independent_session, internal split; domain errors in users/settings (#592 #595) - #612

Merged
antosubash merged 6 commits into
mainfrom
fix/debt-batch-7
Oct 23, 2026
Merged

antosubash merged 6 commits into
mainfrom
fix/debt-batch-7

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

  • users: request-path session.commit() calls and an overgrown module #592: the six request-session commit() calls in users now go through simple_module_db.independent_session, a short-lived session from the app's factory that commits on exit and supports on_commit. The six are registration's default-role attach, three in login lockout and two in bulk invite. Ordering is preserved: lockout still reserves an attempt before authenticating, and invites commit before mail is sent. Registration releases the fastapi-users connection before its checkpoint, so single-connection pools no longer deadlock (regression test with pool_size=1). A rollback that discards nothing logs at DEBUG, so failed logins no longer warn. Lockout, invite and demo code moved into internal subpackages; nothing outside users imported them. docs/database/sessions.md documents the helper and SQLite's single-writer rule.
  • modules: one error-handling convention (domain exceptions, not HTTPException in services) #595: users and settings services raise module domain errors, and registered exception handlers map them to the same status codes, bodies and headers as before (e.g. lockout's 429 + Retry-After). The convention is in docs/module-authoring.md, the module scaffold and the shipped skills.

Follow-up filed during review: #611 (pre-existing: the demo read-only guard keys on the session, not the resolved identity).

Verification

  • Browser/API-verified on port 8218: lockout (429 + Retry-After, refused while locked, admin unlock), registration with the default role, bulk invite results, settings validation 422; no 5xx
  • Local CI: make lint, make test-py (5767 passed), make test-js (748 passed), full e2e suite (49 passed); users, settings and framework/db on Postgres (1407 passed)
  • Code review: 3 Sonnet passes + Codex. Codex caught the registration pool deadlock (fixed); one attempted optimisation broke the lockout connection-release invariant and was reverted
  • Verification report: https://claude.ai/artifact/2JTYeyiYLJDuuxFJB17JhE

QA Report

Report links are Claude Artifacts and start private; the author can share them from claude.ai/code/artifacts if reviewers need access.

Test plan

  • Fail a login past the threshold: 429 with Retry-After; unlock from /admin/users restores sign-in
  • CI is green (including the Postgres workflow)

Closes #592
Closes #595

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

…-session commits; split internal subsystems into subpackages

Closes #592

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
A rollback that discards nothing logs at DEBUG, so failed logins no longer warn; docs note SQLite's single writer for independent_session.

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Registration releases the fastapi-users connection before the default-role checkpoint, so single-connection pools no longer deadlock.

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-23T14:09:57.610389Z 40922db PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 40922db
Status: ✅  Deploy successful!
Preview URL: https://af92e748.simple-module-python.pages.dev
Branch Preview URL: https://fix-debt-batch-7.simple-module-python.pages.dev

View logs

@antosubash
antosubash merged commit 1ae6e75 into main Oct 23, 2026
17 checks passed
@antosubash
antosubash deleted the fix/debt-batch-7 branch October 23, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant