rusackas opened a new pull request, #41837: URL: https://github.com/apache/superset/pull/41837
### SUMMARY Test-only PR — no production code changes. Issue #41623 reported that the three owner association tables (`dashboard_user`, `slice_user`, `sqlatable_user`) lacked a uniqueness guarantee on `(user_id, <resource>_id)`, letting duplicate owner rows accumulate and silently break owner removal (HTTP 422). That gap was fixed on master by #39859 (merged 2026-07-01, hours after the issue was filed), which replaced the surrogate `id` PK with a composite `(user_id, <resource>_id)` primary key on all M2M association tables. This PR adds a regression test that pins the contract the issue asked for, directly against the live ORM `Table` objects: - each of the three owner tables declares a primary key covering exactly `(user_id, <resource>_id)` - inserting the same (user, resource) pair twice raises `IntegrityError` (in-memory SQLite) - distinct pairs still insert fine (uniqueness is over the pair, not a single column) The existing coverage from #39859 (`tests/unit_tests/migrations/composite_pk_association_tables_test.py`) rebuilds the post-migration schema *synthetically* and notes it "does not reflect the live ORM models" — so a regression in the model definitions themselves would slip past it. This test closes that gap. The test passes on current master, confirming the issue is resolved. closes #41623 ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — test-only change. ### TESTING INSTRUCTIONS ```bash pytest tests/unit_tests/models/owner_association_tables_test.py -q ``` All 9 tests (3 assertions × 3 tables) should pass. ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Has associated issue: closes #41623 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
