mikebridge opened a new pull request, #44514: URL: https://github.com/apache/superset/pull/44514
### SUMMARY Add a generic, optional `VERSIONING_CAPTURE_PREDICATE(session)` for hosts to decide whether an ORM save records version history. Denied saves still persist live chart/dashboard/dataset changes, but write no baseline, shadow, association-history or semantic-change rows. `None` preserves existing OSS capture behavior, and the startup `ENABLE_VERSIONING_CAPTURE` kill switch still takes precedence. The predicate is consulted at Continuum's unit-of-work boundary and the baseline/change listeners, without per-request global listener changes. Restore begins or reuses its transaction before capture validation so a changing host decision cannot authorize an untracked restore. Existing history and independent retention remain intact; skipped edits are not reconstructed. Also apply `VERSION_HISTORY` availability to the 12 chart/dashboard/dataset version-list, snapshot, activity and restore routes. Disabled routes return the established 404 after existing route permissions; enabled routes retain object-level checks. Defaults, ordinary CRUD and soft-delete recovery remain unchanged. Docs explain the API compatibility change and runtime-hook contract. This is a **draft**. Hosts remain responsible for tenant identity, transaction-stable decisions and expected service-outage handling. No commercial policy or deployment wiring is added to Apache core. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Not applicable: backend behavior and documentation; no frontend source change. ### TESTING INSTRUCTIONS - `python -m pytest tests/unit_tests/versioning/test_runtime_capture.py tests/unit_tests/versioning/test_api_feature_flag.py tests/unit_tests/versioning/test_listener.py tests/unit_tests/commands/test_base_restore_version_command.py -q`: **118 passed** using isolated in-memory SQLite. - Full changed-file pre-commit, including MyPy, passed; explicit pylint on all changed production Python files: **10.00/10**. Full-branch Python assignment/signature review and independent Astra re-review passed on the exact published tree. - Persisted tests cover new/edited saves, multiple flushes, association capture, rollback/reused sessions, re-enabled baselines, denied restore, and fresh/existing-transaction restore when capture policy changes. The fresh-session regression failed before the fix on the missing version row. - Local, non-CI harnesses exercised the actual host adapter: six ordinary-save scenarios and four independent restore scenarios passed; disabling the capture predicate made the ordinary-save negative control detect extra history rows. These use simulated external services and private model-created SQLite, not production data. For manual verification, configure a transaction-stable predicate returning false: ordinary edits must persist without new history, while version restore is refused. With capture enabled, restore must write history. Disable `VERSION_HISTORY` and verify history endpoints are unavailable without changing ordinary CRUD. No PostgreSQL/MySQL, complete import bundle, browser/CSRF, migrations, real external services, concurrent-tenant stress or fleet validation is claimed. Local harness timing is not production latency. The candidate preserves its tested base; newer master commits have not been merged or tested here. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [x] Required feature flags: existing `VERSION_HISTORY`; existing startup capture switch; optional runtime predicate - [ ] 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 - [x] Introduces new feature or API: optional host capture predicate - [ ] Removes existing feature or API -- 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]
