Resolves the active tenant for each request and binds it to AsyncLocalStorage
(global-tenancy §9.3 / FR-2). Reads the trusted session (user id + activeOrganizationId)
through the core-owned RequestSessionReader port — no Better Auth / @app/modules/auth
import crosses into tenancy core (§9.5.4①B · P1b). Downstream guards / services read the
bound context via TenantIsolationService.
The port's read already short-circuits public / auth / bypass routes (and any request
without a session cookie) to null, so this adds a session lookup only where one can
exist. Failures degrade to "no tenant" rather than throwing (enforcement is S2).
逐请求解析活跃租户并绑定至 AsyncLocalStorage(global-tenancy §9.3 / FR-2)。
Remarks
Resolves the active tenant for each request and binds it to AsyncLocalStorage (global-tenancy §9.3 / FR-2). Reads the trusted session (user id +
activeOrganizationId) through the core-ownedRequestSessionReaderport — no Better Auth /@app/modules/authimport crosses into tenancy core (§9.5.4①B · P1b). Downstream guards / services read the bound context viaTenantIsolationService.The port's
readalready short-circuits public / auth / bypass routes (and any request without a session cookie) tonull, so this adds a session lookup only where one can exist. Failures degrade to "no tenant" rather than throwing (enforcement is S2).