You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mikebridge (via GitHub)" <gi...@apache.org> on 2026/09/08 16:46:31 UTC
[PR] fix(versioning): resolve dashboard M2M membership by attach/detach windows, not end_transaction_id [superset]
mikebridge opened a new pull request, #44010:
URL: https://github.com/apache/superset/pull/44010
### SUMMARY
`sqlalchemy_continuum` **never closes an M2M association shadow row's `end_transaction_id`** — its unit-of-work only inserts association versions (`create_association_versions`); the validity backfill that sets `end_transaction_id` runs for parent/child shadows, not for M2M links. (Confirmed against the installed library: Continuum's own `association_subquery` resolves membership via `MAX(tx) <= target AND operation_type != DELETE`, never via `end_transaction_id`.) So any code that resolves `dashboard_slices_version` membership with the ordinary validity filter (`end_transaction_id IS NULL OR > tx`, `operation_type != DELETE`) silently **re-includes a chart that was removed before the transaction it asks about**.
PR #43837 fixed one such site (the activity relationship walk). This fixes the two that remained:
- **`versioning/restore.py` `_restore_dashboard_membership`** used `shadow_rows_valid_at` against the M2M shadow, so restoring a dashboard to a transaction **after** a chart was removed re-attached that chart (attached@1, removed@5, restore to tx10 → the chart wrongly returns). This is a silent, incorrect mutation of the dashboard.
- **`versioning/activity/impact.py` `batch_chart_counts`** carried the same assumption on the m2m side, over-counting removed charts in the related-impact rollup.
Both now derive membership from `charts_attached_to_dashboard`, which owns the association-shadow read and the `[attach, detach)` window pairing — the single place that must never filter the M2M shadow by `end_transaction_id`. A slice is a member at a transaction iff one of its attachment windows contains it. `impact.py`'s chart→dataset side still uses the parent shadow's validity (correct there), scans only the dashboard's member charts (no cross-dashboard over-fetch, no `m2m ⋈ slices` join), and delegates the count to the pure, unit-tested `_count_attached_charts_at`.
The pure window primitive (`attachment_windows` + the `M2M_OP_*` constants) is promoted from `activity/queries.py` into the pure `activity/windows.py` module so all three call sites share one implementation. `shadow_rows_valid_at` is unchanged — it stays correct for parent/child shadows, whose `end_transaction_id` the validity backfill does close.
**Known follow-up (out of scope, filed separately):** the same naive M2M filter still lives in a third site, `versioning/changes/shadow_queries.py::_dashboard_slice_uuids_at_tx` (the added/removed-chart change-record diff), where it silently drops "chart removed" activity records. Flagged for a separate ticket.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable — backend correctness fix, no UI.
### TESTING INSTRUCTIONS
- New integration test `test_restore_to_tx_after_removal_does_not_reattach_chart` (in `tests/integration_tests/dashboards/version_restore_tests.py`): attach charts → remove one → snapshot **after** the removal → restore to that snapshot → assert the removed chart is **not** re-attached and the survivors remain. It is the inverse of the existing `test_restore_reattaches_chart_removed_after_snapshot` (restore to a tx where the chart *was* a member must still re-attach it).
- New unit tests for `_count_attached_charts_at` (in `tests/unit_tests/versioning/test_activity.py`): removed-before-target exclusion, in-window inclusion, both-windows-required, dedupe within a pair, and a never-on-dashboard slice.
- Each behavioral guard was verified to fail when its fix is reverted.
- `pytest tests/unit_tests/versioning/test_activity.py` (91 passed); changed-file pre-commit (mypy/ruff/ruff-format/pylint) clean.
### ADDITIONAL INFORMATION
- [x] Has associated issue: sc-119907 (Preset-internal)
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] 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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(versioning): resolve dashboard M2M membership by attach/detach windows, not end_transaction_id [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #44010:
URL: https://github.com/apache/superset/pull/44010
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(versioning): resolve dashboard M2M membership by attach/detach windows, not end_transaction_id [superset]
Posted by "mikebridge (via GitHub)" <gi...@apache.org>.
mikebridge commented on PR #44010:
URL: https://github.com/apache/superset/pull/44010#issuecomment-5589167416
@aminghadersohi — ready for review when you have a bandwidth. This fixes two remaining sites of the M2M attach-window bug (Continuum never closes an association shadow's `end_transaction_id`): restore was re-attaching a chart removed before the restore target, and the impact rollup over-counted removed charts. Both now derive membership from `charts_attached_to_dashboard`'s [attach, detach) windows.
A cross-model review pass already went over it; I've folded in its refinements — relocated the shared membership query into a neutral `versioning/membership.py` (so the restore write path no longer reaches into the activity read path), restored the DB-side `datasource_id` prune in the impact scan, fixed a stale module docstring, and added an open-ended re-attach test. The same defect class in a third, out-of-scope site (`_dashboard_slice_uuids_at_tx`, the change-record diff) is tracked separately as sc-120007. Real-Continuum integration test included (restore-to-post-removal → not re-attached).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(versioning): resolve dashboard M2M membership by attach/detach windows, not end_transaction_id [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44010:
URL: https://github.com/apache/superset/pull/44010#issuecomment-5594629598
**Bito Automatic Review Skipped – PR Already Merged**<br/><br/>Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.<br/>No action is needed if you didn't intend to review it. To get a review, you can type `/review` in a comment and save it
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(versioning): resolve dashboard M2M membership by attach/detach windows, not end_transaction_id [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #44010:
URL: https://github.com/apache/superset/pull/44010#issuecomment-5589162096
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 07bf201ea1b9b13955ae3ffa8a92ad496ef09a82 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6aa044a96caf9200099cb772 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-44010--superset-docs-preview.netlify.app](https://deploy-preview-44010--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DctBCoAgEEDRu8y6gVFCmW7QMabRKMgUEyKiu-fuL95_odScSoMJYIClyqlb70vRGGbyWOPVco2YbEJpTXTDez9DvjsPsRz5mUMfnAiNo7BTWdkSEbMu3lv4fg) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-44010--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(versioning): resolve dashboard M2M membership by attach/detach windows, not end_transaction_id [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44010:
URL: https://github.com/apache/superset/pull/44010#issuecomment-5588683355
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(versioning): resolve dashboard M2M membership by attach/detach windows, not end_transaction_id [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #44010:
URL: https://github.com/apache/superset/pull/44010#issuecomment-5588744732
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/44010?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `41 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 57.55%. Comparing base ([`7d0cf1a`](https://app.codecov.io/gh/apache/superset/commit/7d0cf1acfc82750b17ca65cb6f6dc1e80efc4f5f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`5c03dbd`](https://app.codecov.io/gh/apache/superset/commit/5c03dbdbbd4aa4c2b4a3faaca1a7ac91eb85e1a1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/44010?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/versioning/activity/impact.py](https://app.codecov.io/gh/apache/superset/pull/44010?src=pr&el=tree&filepath=superset%2Fversioning%2Factivity%2Fimpact.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmVyc2lvbmluZy9hY3Rpdml0eS9pbXBhY3QucHk=) | 0.00% | [20 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/44010?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [superset/versioning/activity/windows.py](https://app.codecov.io/gh/apache/superset/pull/44010?src=pr&el=tree&filepath=superset%2Fversioning%2Factivity%2Fwindows.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmVyc2lvbmluZy9hY3Rpdml0eS93aW5kb3dzLnB5) | 0.00% | [18 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/44010?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [superset/versioning/activity/queries.py](https://app.codecov.io/gh/apache/superset/pull/44010?src=pr&el=tree&filepath=superset%2Fversioning%2Factivity%2Fqueries.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmVyc2lvbmluZy9hY3Rpdml0eS9xdWVyaWVzLnB5) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/44010?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [superset/versioning/restore.py](https://app.codecov.io/gh/apache/superset/pull/44010?src=pr&el=tree&filepath=superset%2Fversioning%2Frestore.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmVyc2lvbmluZy9yZXN0b3JlLnB5) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/44010?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (7d0cf1a) and HEAD (5c03dbd). Click for more details.
>
> <details><summary>HEAD has 4 uploads less than BASE</summary>
>
>| Flag | BASE (7d0cf1a) | HEAD (5c03dbd) |
>|------|------|------|
>|python|6|2|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #44010 +/- ##
===========================================
- Coverage 79.82% 57.55% -22.27%
===========================================
Files 2914 2914
Lines 170473 170479 +6
Branches 39518 39520 +2
===========================================
- Hits 136076 98116 -37960
- Misses 31875 71441 +39566
+ Partials 2522 922 -1600
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/44010/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/44010/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `37.63% <0.00%> (-0.01%)` | :arrow_down: |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/44010/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/44010/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/44010/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.51% <0.00%> (-0.01%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/44010/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.56% <0.00%> (-44.64%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/44010/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/44010/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/44010?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org