fix(tenancy): record tenant source and set Vary (#367) - #384
Open
antosubash wants to merge 1 commit into
Open
antosubash wants to merge 1 commit into
antosubash wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying simple-module-python with
|
| Latest commit: |
bfb0853
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b218619d.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-367-tenant-source-vary.simple-module-python.pages.dev |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #367
TenantMiddleware now records where the bound tenant came from and tells caches what the answer depended on.
request.state.tenant_source:fixed,subdomain,header,session,claim,anon_header,resolver, orNone.str | None(sourceresolver), a(tenant_id, source)pair, or the newTenantResolution(tenant_id, source, vary).Varyinto the response (existing entries kept, case-insensitive dedupe,Vary: *untouched). Tenants resolver reportsHostwhen subdomains are enabled and the tenant header when configured; the anonymous header fallback reports its header.Tests: new framework/hosting/tests/test_tenant_source.py and modules/tenants/tests/test_resolver_source.py.
pytest framework modules/tenants: 1528 passed;make test-py: 3311 passed.make lint: ruff, ty, biome, tsc, file-size pass; the only failure is the pre-existing hardcoded-strings check on modules/tenants/tenants/module.py:38 (depends_on=["Auth", "Settings"]), which also fails on main.https://claude.ai/code/session_01F8RiTBUJQnZmSq56qReZeV