Repository navigation
feat(versioning): gate history APIs and runtime capture - #44514
aminghadersohi merged 21 commits into
Conversation
Preserve ordinary ORM saves when host capture is denied, without mutating global listeners. Bind restore authorization to its write transaction so changing policy cannot produce an untracked restore. Keep OSS defaults and independent retention; add persisted regressions and API availability tests.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #44514 +/- ##
==========================================
+ Coverage 81.11% 81.21% +0.10%
==========================================
Files 2955 2963 +8
Lines 178330 179187 +857
Branches 41311 41462 +151
==========================================
+ Hits 144651 145529 +878
+ Misses 30974 30950 -24
- Partials 2705 2708 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Align the unreleased application and environment key with VERSION_HISTORY_RETENTION_DAYS without a legacy alias. Preserve duration policy and pin environment loading and runtime task lookup in regression tests.
|
The documentation for version history has been updated to reflect that the |
There was a problem hiding this comment.
Code Review Agent Run #1af5f9
Actionable Suggestions - 4
-
superset/versioning/utils.py - 1
- Implicit session fallback in gate · Line 65-69
-
docs/docs/using-superset/version-history.mdx - 2
- Retention cap undocumented, silent fallback · Line 75-77
- Undocumented downgrade-grace clause · Line 84-84
-
tests/unit_tests/config_test.py - 1
- runpy config override taint · Line 74-74
Additional Suggestions - 6
-
superset/config.py - 1
-
Duplicated bounds, unlogged value · Line 1034-1046`_parse_soft_delete_retention_days` hardcodes the business bounds `30` and `36500` inline, while the sibling `_parse_version_history_retention_days` (lines 1786-1814) encodes the same values as `_DEFAULT_VERSION_HISTORY_RETENTION_DAYS`/`_MAX_VERSION_HISTORY_RETENTION_DAYS`. The duplicated 36500 cap can drift between the two parsers. Its warning also omits the offending value (`%r`), unlike the sibling's messages, hampering ops diagnosis of bad env seeds.
-
-
tests/unit_tests/config_test.py - 1
-
Duplicated env/runpy test scaffold · Line 113-118Lines 113-118 repeat the delenv/setenv/`runpy.run_path(config.__file__)`/assert-int scaffolding of lines 70-78 with only the env key changed. Extracting a shared helper keeps both verification surfaces (raw module dict vs Flask `app.config`) while removing the copy that can drift when env handling changes.
-
-
tests/unit_tests/tasks/test_deletion_retention.py - 2
-
Untyped lambda in test stub · Line 51-51BITO adaptive rule 13350 asks for typed named helpers over untyped lambdas. `lambda: days` hides the `-> object` contract `resolve_retention_window` expects from `SOFT_DELETE_RETENTION_DAYS_FUNC` (`superset/config.py:1052`). A nested `def host_policy() -> object: return days` keeps the closure while documenting the type. Same pattern applies at line 65.
-
Untyped lambda in test stub · Line 65-65Same BITO rule 13350 violation as line 51: `lambda: value` is an untyped stub for `SOFT_DELETE_RETENTION_DAYS_FUNC`, obscuring the `-> object` contract `resolve_retention_window` validates (`superset/commands/deletion_retention/window.py:86`). A nested `def host_policy() -> object: return value` documents it.
-
-
superset/commands/deletion_retention/window.py - 1
-
Magic retention bound duplicated · Line 86-86Line 86 hardcodes the retention ceiling `36500` (~100 years), duplicating the same bare literal in `_parse_soft_delete_retention_days` (`superset/config.py:1041`). If one copy is updated and the other is not, a valid host policy gets rejected (purge skipped) or an out-of-range value accepted. Name it once — e.g. `_MAX_RETENTION_DAYS` beside `_DEFAULT_RETENTION_DAYS` — and reference it in both validators.
-
-
superset/versioning/utils.py - 1
-
Dead constant, no consumer · Line 29-32`HOST_POLICY_API_VERSION` is defined but has no consumer anywhere in the repo (grep across *.py finds only this definition). The comment says downstream startup may require this version before installing policy callbacks, but no such check exists here, so the constant is dead and its contract claim is unenforced.
-
Review Details
-
Files reviewed - 23 · Commit Range:
7f79f55..0afd908- docs/docs/using-superset/version-history.mdx
- superset/charts/api.py
- superset/cli/deletion_retention.py
- superset/commands/deletion_retention/window.py
- superset/commands/version_restore.py
- superset/config.py
- superset/dashboards/api.py
- superset/datasets/api.py
- superset/extensions/__init__.py
- superset/tasks/version_history_retention.py
- superset/translations/messages.pot
- superset/versioning/baseline/listener.py
- superset/versioning/changes/listener.py
- superset/versioning/queries.py
- superset/versioning/unit_of_work.py
- superset/versioning/utils.py
- superset/views/base.py
- tests/integration_tests/versioning/retention_prune_tests.py
- tests/unit_tests/config_test.py
- tests/unit_tests/tasks/test_deletion_retention.py
- tests/unit_tests/tasks/test_version_history_retention.py
- tests/unit_tests/versioning/test_api_feature_flag.py
- tests/unit_tests/versioning/test_runtime_capture.py
-
Files skipped - 2
- UPDATING.md - Reason: Filter setting
- docs/static/feature-flags.json - Reason: Filter setting
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers an incremental AI Review. -
/review full- Manually triggers a full AI Review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
Accept the explicit -1 sentinel without computing a future cutoff, preserve live records and purge guards, and document permanent purge history removal.
Preserve SC-121613 behavior while incorporating upstream OAuth2 destination wording. Remove the Python 3.12 tokenizer-only catalog entry to match CI's Python 3.11 extraction.
There was a problem hiding this comment.
Code Review Agent Run #ed9d1e
Actionable Suggestions - 2
-
superset/tasks/deletion_retention.py - 1
- Magic sentinel -1 · Line 138-138
-
superset/config.py - 1
- Inconsistent invalid-negative handling · Line 1806-1808
Additional Suggestions - 1
-
superset-frontend/src/utils/softDeleteCopy.ts - 1
-
Magic sentinel -1 · Line 50-50The `-1` sentinel (immediate eligibility, matching backend `resolve_retention_window`) is hardcoded in two comparisons (lines 50 and 72). A bare literal encoding a business rule invites divergence if the backend convention changes. Extract a named constant like `IMMEDIATE_ELIGIBILITY` and reference it in both spots.
-
Review Details
-
Files reviewed - 12 · Commit Range:
0afd908..a7fc18c- docs/docs/using-superset/version-history.mdx
- superset-frontend/src/utils/softDeleteCopy.test.ts
- superset-frontend/src/utils/softDeleteCopy.ts
- superset/cli/deletion_retention.py
- superset/commands/deletion_retention/window.py
- superset/config.py
- superset/tasks/deletion_retention.py
- superset/tasks/version_history_retention.py
- tests/unit_tests/cli/deletion_retention_test.py
- tests/unit_tests/config_test.py
- tests/unit_tests/tasks/test_deletion_retention.py
- tests/unit_tests/tasks/test_version_history_retention.py
-
Files skipped - 1
- UPDATING.md - Reason: Filter setting
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers an incremental AI Review. -
/review full- Manually triggers a full AI Review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
Continuum observes SQLAlchemy broker sessions before Celery has a Flask context. Return a denied capture decision for those sessions so queue declaration can commit without an untracked version write or worker startup crash. Clarify the chart/dashboard version-history UI scope in the user docs and generated feature-flag catalog.
|
Heya @mikebridge, the shape here seems reasonable, the predicate plus the unit-of-work gate in particular. One thing I'd want sorted before this merges, though: the retention parsing. Also, a handful of bito threads are still open (the |
|
@rusackas sorry, yes, this is madly being worked on last-minute---the "-1" is my late addition so that we can test this in staging without having to wait for some number of days. QA has said that it might have been better to test this by altering dates in the DB to be outside the window....
|
richardfogaca
left a comment
There was a problem hiding this comment.
Richard's agent here: gating and restore-in-transaction look solid; all 12 history routes are covered and permission-before-flag ordering is right. A few things before merge:
1. Old setting name already ships on 7.0
SUPERSET_VERSION_HISTORY_RETENTION_DAYS is already on the 7.0 branch, and its UPDATING note says 0 or negative disables pruning. Unless this rename is backported before 7.0 is cut, a 7.0 operator's setting is silently reset to 30 on upgrade, and the next prune deletes older history.
→ Could we backport it, or read the old name with a deprecation warning?
2. -1 changes from "disable" to "purge now"
The 7.0 docs say negative values disable pruning; here -1 purges immediately.
→ Could UPDATING say this explicitly and point people to 0? A startup warning while -1 is active would also help.
3. The per-transaction capture decision is left to the host
capture_enabled calls the host check on every call and leaves per-transaction caching to the host. Helper sessions on the same connection (e.g. tagging's Session(bind=connection)) miss a host cache kept in session.info. A False there makes CaptureUnitOfWork.process_after_flush discard the shared unit of work's operations.
→ Caching the decision once per unit of work in core would make "no untracked restore" something core guarantees rather than assumes. Fine as a follow-up if you prefer.
Minor
- The parent-snapshot rebuild runs on every captured save, and it now fails the save on error, which is worth a line in UPDATING.
Code Review Agent Run #7a0c64Actionable Suggestions - 0Additional Suggestions - 2
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
@richardfogaca Thanks for the careful review. I addressed the four points in 07a27cb:
The exact tree passed 578 affected unit tests, five retention integration tests on migrated SQLite, and all applicable hooks on the eight follow-up files. The full PR hook run in this isolated checkout hit only unbuilt frontend declaration artifacts (TS6305); fresh exact-head CI is queued. Shell #5218 remains dependent on this core change reaching a private production commit and a verified shell pin; this PR head is not that production SHA. Would you take another look when CI settles? |
richardfogaca
left a comment
There was a problem hiding this comment.
Richard's agent here: re-reviewed 07a27cb12 and all four points are fixed. The deprecated fallback keeps 7.0 behavior, the -1 upgrade warning and startup log are clear, and caching the capture decision per unit of work closes the helper-session gap (the tests cover both directions). Totally optional: the old/new retention merge now lives in both config.py and prune_old_versions. Pulling it into one shared helper would keep the two from drifting apart. Happy to keep as-is. LGTM.
There was a problem hiding this comment.
Code Review Agent Run #4a899c
Actionable Suggestions - 2
-
superset/config.py - 2
- CWE-706: Wrong var name in warning · Line 1872-1876
- Legacy deprecation warning skipped · Line 3655-3655
Additional Suggestions - 7
-
tests/unit_tests/versioning/test_listener.py - 3
-
Duplicated Test Setup Block · Line 39-49`test_shared_connection_capture_decision_survives_helper_session` and `test_shared_connection_denial_cannot_be_reenabled_by_helper_session` duplicate the full setup — the `MagicMock(spec=Session)` pair, `CaptureUnitOfWork(versioning_manager)`, the pending statement, and the identical three-patch context — differing only in `capture_enabled`'s return value. A shared helper parameterized on the gate result prevents drift when patch targets change.
-
Inline Import Violates Rule · Line 37-37This function-scope `from sqlalchemy_continuum import versioning_manager` conflicts with BITO rule 12745 (module-level imports unless a documented circular dependency). None exists here: `sqlalchemy_continuum.unit_of_work` is already imported at module level (line 28). Move it to the top import block; the new test at line 62 repeats this.
-
Inline Import Violates Rule · Line 62-62Same inline `from sqlalchemy_continuum import versioning_manager` as line 37: BITO rule 12745 requires module-level imports absent a documented circular dependency, and line 28 already imports `sqlalchemy_continuum.unit_of_work` at module scope. Hoist it into the top import block with the other sqlalchemy_continuum imports.
-
-
tests/unit_tests/tasks/test_version_history_retention.py - 2
-
Duplicated test scaffold · Line 88-148The three new tests repeat the same scaffold — build `Flask` app, set config, `patch.object(version_history_retention, "_prune_old_versions_impl")`, assert on `prune` — duplicating `test_task_reads_canonical_application_retention` (line 66). With five near-identical blocks, a config-key or lookup-contract change must now be edited in five places. Extract a shared helper taking the config mapping and expected argument.
-
Env-dependent test config · Line 109-127This test reads ambient process state: with both keys set, `prune_old_versions` evaluates the legacy-merge branch (`version_history_retention.py:562-566`), gated on `"VERSION_HISTORY_RETENTION_DAYS" not in os.environ` and `retention_days == _version_history_retention_seed` (import-time, `config.py:1881`). If the env var is exported with any value other than 30, the merge is skipped, `prune` receives 30, and the 0/365 expectations fail. Patch `os.environ` and the seed for determinism.
-
-
superset/config.py - 1
-
Env var outranks config override · Line 3646-3649This guard lets the env var `VERSION_HISTORY_RETENTION_DAYS` (already applied at import, line 1829) outrank an explicit canonical `VERSION_HISTORY_RETENTION_DAYS` set in the config file, so the legacy-key merge at 3650+ runs and can only keep or raise the value (max/0 rule). That diverges from the module's config-file-override model and from `ENV_VAR_KEYS` (3666), which lists the only env vars meant to override config. Intent should be confirmed and documented.
-
-
tests/unit_tests/config_test.py - 1
-
Test isolation gap · Line 116-116Unlike the sibling tests at lines 77 and 156, this test never neutralizes a developer `superset_config` module. If one is importable in the test environment, config.py line 3646 re-normalizes the legacy override and `_parse_version_history_retention_days()` still returns the env value, so the test passes today but is not hermetic. Consider `monkeypatch.setitem(sys.modules, "superset_config", None)` for consistency.
-
Filtered by Review Rules
Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
-
superset/tasks/version_history_retention.py - 2
- Magic default duplicated as literal · Line 555-555
- Duplicated retention precedence policy · Line 562-576
-
superset/config.py - 1
- Duplicated override-capture block · Line 3578-3591
Review Details
-
Files reviewed - 7 · Commit Range:
d658013..07a27cb- docs/docs/using-superset/version-history.mdx
- superset/config.py
- superset/tasks/version_history_retention.py
- superset/versioning/unit_of_work.py
- tests/unit_tests/config_test.py
- tests/unit_tests/tasks/test_version_history_retention.py
- tests/unit_tests/versioning/test_listener.py
-
Files skipped - 1
- UPDATING.md - Reason: Filter setting
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers an incremental AI Review. -
/review full- Manually triggers a full AI Review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
| if retention_days == -1: | ||
| logger.warning( | ||
| "VERSION_HISTORY_RETENTION_DAYS=-1 makes history eligible for " | ||
| "immediate pruning on the next scheduled run; use 0 to disable" | ||
| ) |
There was a problem hiding this comment.
This warning hardcodes VERSION_HISTORY_RETENTION_DAYS, but _normalize_version_history_retention_days also runs for the legacy SUPERSET_VERSION_HISTORY_RETENTION_DAYS env var (lines 1832-1833) and for legacy config overrides (line 3650), where name is the legacy key. A legacy user setting -1 gets a warning naming a variable they never set. Use name like the other warnings do. (CWE-706)
Code Review Run #4a899c
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
There was a problem hiding this comment.
Updated in 903a799ae3a8: the warning now uses the setting name consistently, with regression coverage. The legacy -1 path already returns 0 before this warning; the regression confirms it still disables pruning and emits no immediate-pruning warning.
There was a problem hiding this comment.
The suggestion to use the name variable in the warning message is correct and has been addressed. The updated code now dynamically uses name (which correctly reflects whether the legacy or canonical setting is being processed) in all warning logs, ensuring that users receive accurate feedback regardless of which environment variable triggered the warning.
superset/config.py
try:
if isinstance(value, bool) or not isinstance(value, (str, int)):
raise ValueError("Retention must be integer days")
retention_days: int = int(value)
except ValueError:
logger.warning("Invalid %s=%r; skipping pruning", name, value)
return 0
| ) | ||
| if not _canonical_history_retention_override: | ||
| VERSION_HISTORY_RETENTION_DAYS = _legacy_history_retention_days | ||
| elif VERSION_HISTORY_RETENTION_DAYS == _version_history_retention_seed: |
There was a problem hiding this comment.
When a config file sets both keys and the canonical value differs from _version_history_retention_seed, this elif skips normalization of _legacy_history_retention_value entirely — so the deprecation warning for SUPERSET_VERSION_HISTORY_RETENTION_DAYS (lines 1853-1858) never fires, unlike the legacy-only path (3653-3654) which always warns. The legacy key is silently ignored. Normalize/warn for the legacy key before the seed comparison.
Code Review Run #4a899c
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
There was a problem hiding this comment.
Addressed in 903a799ae3a8. The consolidated resolver already warned for a valid legacy config value before a differing canonical override won; a config-load regression now covers that case. Also fixed the remaining ignored-legacy paths: a canonical environment setting still allows the legacy deprecation warning, and ignored invalid legacy values no longer claim active pruning is skipped. Retention results and precedence are unchanged; 581 affected tests passed, and a differential probe matched the previous returned values in 608 cases.
There was a problem hiding this comment.
The suggestion provided by the reviewer is valid and addresses a potential issue where the legacy deprecation warning could be skipped. By normalizing and warning for the legacy key before the seed comparison, the code ensures that the deprecation warning is correctly triggered even when a canonical override is present. Applying this change improves the robustness of the configuration loading logic.
superset/config.py
_legacy_history_retention_days: int = _normalize_version_history_retention_days(
_legacy_history_retention_value, legacy=True
)
if not _canonical_history_retention_override:
VERSION_HISTORY_RETENTION_DAYS = _legacy_history_retention_days
elif VERSION_HISTORY_RETENTION_DAYS == _version_history_retention_seed:
rusackas
left a comment
There was a problem hiding this comment.
Heya @mikebridge, thanks for chasing all this down. The retention parsing I flagged is fixed and tested now, test_star_imported_default_does_not_hide_legacy_retention covers the exact star-import ambiguity case, and the two parsers agree on invalid/oversized values deferring with 0. -1 immediate-purge is still in core though, just warned-on rather than removed, so that design call is still open if you want to revisit it.
@richardfogaca's three points in 07a27cb all check out too, traced each against the actual code rather than just the commit message.
One thing before this merges, though. _capture_enabled() in api_helpers.py calls capture_enabled() with no session, so it falls back to db.session() on every GET/ETag read (current_entity_version_info, used from the chart/dashboard/dataset GET and pre-write-read paths), not just at save time. VERSIONING_CAPTURE_PREDICATE is documented as a stable-per-transaction save-time decision, so a host predicate that's session/transaction-aware can now see a different session on a read than it'll see at the actual write, and the ETag computed here could disagree with what capture decides at commit. Might be worth threading the request's session through the same way version_restore.py does now.
Also prune_old_versions()'s legacy-ambiguity branch does a bare int(legacy_configured) with no try/except. A non-numeric legacy value raises past the documented "invalid values defer with 0" and turns into a hard task failure instead.
Non-blocking, but that same function re-derives a good chunk of the legacy/canonical disambiguation config.py already resolves once into app.config, a future fix to that policy won't reach the task unless someone remembers to mirror it. And reconcile_parent_snapshots runs on every captured save even when nothing changed (bito's right about that one), and CaptureUnitOfWork._capture_allowed is None doubles as both "undecided" and a legit None from a predicate breaking its own contract, minor unless a host predicate misbehaves.
Two other bito threads on config.py are still open (the -1 warning naming the wrong var, a supposedly-skipped deprecation warning) but I traced both by hand and neither reproduces, happy to explain if useful but wouldn't hold on those.
CI's green, test coverage throughout is genuinely thorough. Once the session-on-read thing and the retention task's exception path are sorted, I think this is good to go.
…nvalid retention with 0 Addresses the blocking review on apache#44514: - `api_helpers._capture_enabled` passes the request's Session to the shared capture gate explicitly, as the restore command does, instead of relying on the gate's ambient fallback. The scoped_session proxy is resolved to its current Session; a plain Session bound in its place is used as-is. - `prune_old_versions` no longer re-derives the legacy/canonical retention policy with bare `int()` casts. A single `_resolve_version_history_retention_days` in config.py serves both config load and the task, so an invalid canonical or legacy value defers pruning with 0 and a warning instead of failing the run. `-1` immediate eligibility is unchanged. - `capture_enabled` coerces the host predicate's result to bool, so a `None` from a predicate breaking its contract denies capture instead of leaving `CaptureUnitOfWork` undecided. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01WQEoQmmvQvPAc9k8dsGtL4
|
Thanks, Evan. I pushed I also made a predicate result of |
|
There is one pending issue with sqlite with ID collisions that is being worked on. |
A child id deleted from one dataset and reused under another while capture was denied made the resumed save abort: `_reconcile_children` discovered the prior row per parent and inserted under the global shadow key `(id, transaction_id)` twice. Reconciliation now runs once per child model over the whole captured parent set, so a reassigned id gets exactly one row at the resumed transaction: an INSERT under its new parent, which closes the old parent's open row. The gap-born predecessor probe is restricted to same-parent rows so a natively edited reborn child is recorded the same way. The restore guard accepts that surviving foreign closer as proof of the old parent's absence (the shadow key is unique per transaction, so no same-parent successor could have been pruned), read under the same lock as the same-parent rows; its known-limitation list gains the matching shape. Native coverage: both creation orders x columns/metrics x native edit of the reborn child, asserting one shadow row per transaction for the recycled id and restoring both parents' resumed snapshots; a guard unit table for foreign closers. Six mock bindings in test_listener.py are declared. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01WQEoQmmvQvPAc9k8dsGtL4
Code Review Agent Run #4c5740Actionable Suggestions - 0Additional Suggestions - 7
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
rusackas
left a comment
There was a problem hiding this comment.
Heya @mikebridge, both things I flagged are fixed and traced against the code, not just the commit message: _capture_enabled() now threads the actual request session through instead of falling back to a fresh db.session() on reads, and the retention parsing consolidation means an invalid legacy value defers with 0 instead of crashing the task. Nice bonus on the DRY cleanup too.
I had the newest commit (5ab4170e1, recycled child ids across parents) independently verified given it touches the fail-closed restore guarantee directly, the foreign-closer matching is correct and atomic, and the tests include the adversarial wrong-transaction/wrong-child-id negatives that would catch a weakened guard. Holds up.
Two small bito threads are still open, real but minor, both are log-message completeness issues (a warning naming the wrong env var when triggered via the legacy key, and a precedence branch that skips the legacy-deprecation warning when canonical wins). Neither affects the actual retention-day resolution. Not holding up the merge for those.
CI's green. LGTM!
…to another dataset Continuum's reverter resolves a column or metric by integer primary key alone. When a child id was freed by a hard delete and reused under another dataset while capture was denied, restoring the old dataset to a pre-recycle version rewrote the other dataset's live child in place. `_verify_child_identities` now runs before the revert: for every child row the reverter would apply (the latest row at or before the target per child id, matching Continuum's one_to_many_criteria), the live row is read FOR UPDATE, and the restore is refused with a user-facing `RecycledChildIdentityError` (422, like the pruned-history refusal) when that row belongs to a different dataset. Both datasets, their children and the history stay unchanged. An id no longer live anywhere is still recreated, and a same-parent row is still rewritten to the snapshot's values, which keeps pre-import versions restorable after import's in-place uuid rewrite. The SQLite write reservation is a helper each guard calls for itself. Native tests through the restore command: cross-dataset recycle refused (column/metric x both-captured/old-only) with no writes; retired id recreated with its historical id and uuid; same-parent re-birth rewritten; endpoint 422 mapping. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01WQEoQmmvQvPAc9k8dsGtL4
|
Pushed Independent Astra review of the complete PR and final deltas passed; 581 affected tests and all six changed-file pre-commit checks passed locally. The warning fixes preserve retention values and precedence. GitHub still reports APPROVED after the push; fresh CI is queued/running. |
Code Review Agent Run #df348bActionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Co-authored-by: Mike Bridge <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
Resolve the conflict in docs/docs/using-superset/version-history.mdx. Master's retention section, merged with apache#44514, is kept word for word. This branch's operator guidance is kept around it: the task name and schedule, what pruning preserves, and how to keep history while the feature is off. Three statements from this branch are dropped because the merged core no longer behaves that way: the old setting name, the 30-day fallback for an invalid value, and non-positive values disabling pruning. The advice to remove the beat schedule entry is dropped because that logs a warning at every startup. Co-Authored-By: Claude Fable 5.1 <[email protected]>
SUMMARY
Add host-policy support for version-history access/capture and soft-delete retention while keeping commercial eligibility outside Apache core. Disabled history APIs return 404 with existing permissions preserved. Ordinary saves still succeed when capture is denied, without creating history; transaction-scoped capture checks prevent untracked version restores.
An optional authoritative
SOFT_DELETE_RETENTION_DAYS_FUNCcallback takes precedence over stored shared values. Invalid or unavailable host policy defers purging; without the callback, ordinary shared-value/config resolution remains. BothVERSION_HISTORY_RETENTION_DAYSandSOFT_DELETE_RETENTION_DAYSuse canonical integer settings/environment names with a 30-day core default; zero disables cleanup. The canonical version-history name is preferred; the previously shipped prefixed name remains a deprecated compatibility alias when the canonical setting is absent.HOST_POLICY_API_VERSION = 1identifies the complete API/capture/retention contract for downstream adoption. Preset shell #5218 depends on this contract and must adopt a matching merged core pin before deployment. No tier rules, live configuration changes, deployment, or cleanup activation are included here.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable: backend contracts and documentation.
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
VERSIONING_CAPTURE_PREDICATE(session); existing startup capture control remains authoritative.