Conversation
…low and domain exceptions
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.
What Changed
TenantManager.get_queryset()to fallback to the base queryset instead ofqs.none(), fixing breakages outside of request contexts (e.g., Celery, Admin).gettext_lazytranslations in financial_service.py.TenantManager.for_clinic()chain filtering with a direct super().get_queryset() call, preventing empty results when querying across clinics.tests.pyconflicts.Why
Phase 0 Foundation Hardening requires the DB scope filtering to be solid. Returning
qs.none()blindly prevented automated background jobs and command lines to operate correctly outside the HTTP flow. At the same time, Admin boundaries must still be strictly functional inside HTTP, so that providing anX-Clinic-IDaccurately simulates clinic scopes exactly without hard-rejections.How to Test
make startas an Admin user.curl -s -H "Authorization: Token <TOKEN>" -H "X-Clinic-ID: 2" http://localhost:8000/api/v1/store/products/cd backend && uv run pytestensuring tests yield coverage for all 8 scenarios cleanly within src/apps/core/tests/test_tenant_middleware.py.Checklist
uv run pytestpassesnpm run buildpasses