Skip to content

Bind every session through session_scope and start test requests unbound - #563

Merged
czpython merged 1 commit into
mainfrom
session-rule-everywhere
Sep 15, 2026
Merged

czpython merged 1 commit into
mainfrom
session-rule-everywhere

Conversation

@czpython

@czpython czpython commented Sep 14, 2026

Copy link
Copy Markdown
Owner

What changed

session_scope is the one primitive that binds a session, and every place that runs outside a request now uses it.

  • step_session returns session_scope(_step_engine()); session_scope yields its session for the callers that need it.
  • dispatch() binds its own session wherever it is called. Workflow.__init_subclass__ wraps a declared dispatch() in bound_session(), and the cron tick calls it without a session of its own. The SessionNotBoundError message, which names dispatch() as a bound place, is now true.
  • The test harness enters each request as production does: configure_app_for_test installs a boundary that hides the harness session for the request, and the fixture's on-demand session refuses inside one. A read the app never bound now fails in a test the way it fails on the host. The direct verifier test is gone; the wire test covers it. The generic-subjects fixture mounts its fake app through the app, so its routes get the request session like a loaded app's.

The author guide states that dispatch() binds its own session, that a row a step returns is detached, and that a test request starts with no session bound.

@mintlify

mintlify Bot commented Sep 14, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
druks 🟢 Ready View Preview Sep 15, 2026, 7:24 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@czpython
czpython force-pushed the session-rule-everywhere branch from 955de95 to 1bd5fc5 Compare September 15, 2026 07:23
@czpython
czpython enabled auto-merge (squash) September 15, 2026 07:25
@czpython
czpython merged commit bdd5446 into main Sep 15, 2026
4 checks passed
@czpython
czpython deleted the session-rule-everywhere branch September 15, 2026 07:28
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