You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs/database/sessions.md and docs/database/mixins.md describe an API that isn't in v0.0.17.
Environment
Framework checkout: v0.0.17-5-g2b079c9; smpy / published simple_module_* / @simple-module-py/*: 0.0.17
Python 3.12.3, uv 0.11.7, node v24.15.0, Linux (Ubuntu)
Found while building a real consumer app (Invoice Manager) on the framework.
Evidence vs. code
sessions.md shows engine_for(...) and DatabaseState.session() — neither exists. Real: get_db reads request.app.state.sm.db.session_factory; out-of-request code uses async with db_state.session_factory() as session: (and init_db(...) does NOT auto-register entity listeners — callers do register_listeners(state), as the root conftest.py does).
mixins.md describes before_compile / before_insert / before_update / before_delete listeners and no_tenant() / skip_tenant_filter=True escape hatches — none exist. Real impl is a single before_flush listener + a do_orm_execute hook with with_loader_criteria; the only escape hatch is stmt.execution_options(include_deleted=True).
mixins.md documents AuditMixin.created_by/updated_by as int | None from request.state.principal.user_id; real columns are str | None, stamped from the current_user_id ContextVar.
Impact
Consumers can't write out-of-request DB code (seeders, scripts) or reason about tenant/soft-delete bypass from the docs. Suggest aligning these two docs with the real simple_module_db API.
Fixed on main by #205 ("full review and sync of docs to current code state").
docs/database/sessions.md and docs/database/mixins.md now reference the real APIs: DatabaseState.session_factory, the single before_flush listener plus the do_orm_execute / with_loader_criteria tenant filter driven by the current_tenant_id / current_user_id ContextVars, str | None audit columns, and TenantIsolationError for cross-tenant writes. The nonexistent engine_for, DatabaseState.session, before_compile/insert/update/delete, and no_tenant / skip_tenant_filter references are gone. Verified against current main.
Activity
antosubash commentedon Jun 8, 2026
Fixed on
mainby #205 ("full review and sync of docs to current code state").docs/database/sessions.mdanddocs/database/mixins.mdnow reference the real APIs:DatabaseState.session_factory, the singlebefore_flushlistener plus thedo_orm_execute/with_loader_criteriatenant filter driven by thecurrent_tenant_id/current_user_idContextVars,str | Noneaudit columns, andTenantIsolationErrorfor cross-tenant writes. The nonexistentengine_for,DatabaseState.session,before_compile/insert/update/delete, andno_tenant/skip_tenant_filterreferences are gone. Verified against currentmain.