Skip to content

feat(session): Postgres SessionRegistry — postgres parity (v26.06.68)#95

Merged
ancongui merged 1 commit into
mainfrom
feat/postgres-session-registry
Jun 7, 2026
Merged

feat(session): Postgres SessionRegistry — postgres parity (v26.06.68)#95
ancongui merged 1 commit into
mainfrom
feat/postgres-session-registry

Conversation

@ancongui
Copy link
Copy Markdown
Contributor

@ancongui ancongui commented Jun 7, 2026

Extends session concurrency control to Postgres (the audit's session Postgres-parity item). PostgresSessionRegistry is a durable, queryable, cross-process registry backed by a Postgres table (session_id PK, principal, created_at), selected via pyfly.session.concurrency.registry=postgres — clustered maximumSessions with no Redis.

  • Table created lazily + idempotently; table name validated against injection.
  • Hexagonal: the SQLAlchemy AsyncEngine is resolved lazily + injected by the composition root; the adapter imports no SQLAlchemy at module scope.
  • SessionRegistry now exported from pyfly.session.ports (audit consistency fix).
  • Validated against real Postgres (testcontainers: upsert, oldest-first, count, deregister). Unit (6, SQL-recording fake) + integration (1). Gates: mypy --strict (633), ruff+format, full suite 3932.

…ssionRegistry from ports + bump v26.06.68

PostgresSessionRegistry (session/adapters/postgres_registry.py): durable, queryable, cross-process
session-concurrency registry over a Postgres table (session_id PK, principal, created_at). Selected
via pyfly.session.concurrency.registry=postgres -> clustered maximumSessions with no Redis. Table
created lazily+idempotently; table name validated against injection. Hexagonal: AsyncEngine resolved
lazily + injected by the composition root; no module-scope sqlalchemy. SessionRegistry now exported
from pyfly.session.ports (audit consistency fix).

Tests: tests/session/test_postgres_registry.py (6, SQL-recording fake) + tests/integration/
test_postgres_session_registry_integration.py (real Postgres: upsert/oldest-first/count/deregister,
PASSED). Gates: mypy --strict (633), ruff + format, full suite 3932 passed.
@ancongui ancongui merged commit 5167471 into main Jun 7, 2026
5 checks passed
@ancongui ancongui deleted the feat/postgres-session-registry branch June 7, 2026 18:54
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.

1 participant