fix(api): update database routing logic in MainRouter - #9080
Conversation
|
✅ All necessary |
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
Status update - ExplanationWhen the task blew up with We iterate findings inside with The moment we call Forcing the RLS transaction with The other piece was in So the full fix is: Let the router consider replica a safe partner for relations (reads still stay readonly, writes still go through the primary). |
7d1de5a to
a6ed144
Compare
…invalid-router-problem
ee52693 to
2c8e564
Compare
2c8e564 to
2b992ab
Compare
josema-xyz
left a comment
There was a problem hiding this comment.
After reading some Django docs... 🚀
🔒 Container Security ScanImage: 📊 Vulnerability Summary
3 package(s) affected
|
…invalid-router-problem
e9f930e to
37cdd11
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #9080 +/- ##
==========================================
+ Coverage 88.50% 93.98% +5.47%
==========================================
Files 93 141 +48
Lines 3524 16962 +13438
==========================================
+ Hits 3119 15941 +12822
- Misses 405 1021 +616
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
Context
Security Hub exports were failing in production with Cannot assign "<Integration …>" and invalid input syntax for type uuid: "". The first came from reading the integration-provider relationship through the read replica; the second was Row Level Security blocking our integration.save() calls because the tenant context was only being set on the replica connection.
Description
Allow allow_relation to treat default, admin, and replica as compatible aliases so Django stops rejecting relationships built from replica reads.
Ensure every Security Hub write (regions update, connection flag) runs inside rls_transaction(..., using=MainRouter.default_db) before saving, so SET CONFIG(api.tenant_id, …) hits the same primary connection that persists the row.
Steps to review
Checklist
API
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.