Repository navigation
fix: Do not convert dataset changed_on to UTC - #33693
Merged
Merged
Conversation
There was a problem hiding this comment.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
| Category | Issue | Status |
|---|---|---|
| Naive Datetime Usage ▹ view | 🧠 Not in scope |
Files scanned
| File Path | Reviewed |
|---|---|
| superset/daos/dataset.py | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
|
|
||
| if force_update: | ||
| attributes["changed_on"] = datetime.now(tz=timezone.utc) | ||
| attributes["changed_on"] = datetime.now() |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
betodealmeida
approved these changes
Jun 4, 2025
betodealmeida
left a comment
Member
There was a problem hiding this comment.
Thanks! Sorry for the extra work in the original PR!
Contributor
Author
No worries! It was def a good idea and something we should implement. It's just going to take a little bit more work :P |
ianngech
pushed a commit
to Pesapal-Ltd/superset
that referenced
this pull request
Jun 10, 2025
LevisNgigi
pushed a commit
to LevisNgigi/superset
that referenced
this pull request
Jun 18, 2025
alexandrusoare
pushed a commit
to alexandrusoare/superset
that referenced
this pull request
Jun 19, 2025
(cherry picked from commit c951848)
6 of 9 tasks
mikebridge
pushed a commit
to mikebridge/superset
that referenced
this pull request
May 8, 2026
Two short documentation additions in models/helpers.py: * SoftDeleteMixin.soft_delete: note that datetime.now() mirrors AuditMixinNullable.changed_on by design (PR apache#33693 reverted UTC on the audit columns). * _add_soft_delete_filter listener: distinguish the per-query execution_options bypass (narrow, for non-user-facing paths) from the per-request flask.g flag (broad, reserved for user-facing list filters that ask to surface soft-deleted rows). Reduces the risk of a future code path setting g.skip_visibility_filter and bleeding the bypass into incidental queries. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2 of 6 tasks
qfcwell
pushed a commit
to qfcwell/superset
that referenced
this pull request
May 12, 2026
mikebridge
pushed a commit
to mikebridge/superset
that referenced
this pull request
Jul 28, 2026
- Revert the retention cutoff to the same naive-local clock soft_delete() stamps deleted_at with (PR apache#33693 convention); the naive-UTC cutoff shifted the window by the server's timezone offset, purging early west of UTC. Document the audit table's deliberate divergence instead. - Explicitly delete embedded_dashboards for a purged dashboard — the delete-orphan child carrying the public embed UUID leaked on FK-off SQLite, contradicting the cascade's explicit-delete doctrine. - Commit outside the association-version suppression block so the trim runs before Continuum executes pending statements, and pin the no-shadow guarantee with an integration test. - Chunk the orphan-transaction sweep's IN() lists under the SQLite bind-variable limit; a long-history entity previously crashed the sweep and became permanently unpurgeable. Drop the misattributed _BATCH alias/comment. - Move PurgeAuditLog to superset/models/ so it registers with Model.metadata at app init (alembic autogenerate would otherwise propose dropping the table), and declare the composite status/created_on index on the model. - Fail closed on write-ahead audit failure in the scheduled purge (skip and retry next run); force-purge still proceeds with the operator present. Documented in UPDATING.md with the dry-run upper-bound note. - Make finalize() a conditional UPDATE on status='pending' and lock the reconcile scan, closing the delayed-worker/reconcile races. - Validate --uuid with click.UUID before the irreversible prompt. - Index dashboard_slices_version(slice_id): chart purges previously full-scanned the association shadow history. Co-Authored-By: Claude Fable 5 <[email protected]>
6 of 9 tasks
mikebridge
pushed a commit
to mikebridge/superset
that referenced
this pull request
Jul 31, 2026
…r's clock The capstone review's HIGH, found independently by five lenses. deleted_at is stamped with the server's naive-local datetime.now() -- deliberately, matching every audit column per the PR apache#33693 revert, and the purge task's cutoff matches the same clock. The archive UI then undid that consistency on the other side of the API: it parsed the offset-less serialization as UTC (extendedDayjs.utc(...).fromNow()) and compared client-UTC toISOString() cutoffs against the naive-local column, so on any non-UTC deployment both the "Archived" ages and the Last-7/30/90-day presets shifted by the server's offset. UTC-based CI can never catch it. The column and the stamp are correct and unchanged. The fix moves both interpretations to the clock that did the stamping: - Display: rows now carry deleted_at_delta_humanized, produced server-side like changed_on_delta_humanized on the sibling list pages. The humanizer is hoisted from AuditMixinNullable to a module function so the archive's bare column projection can reuse it; the mixin delegates. The raw ISO value stays for API consumers. - Filtering: the presets send a day count (7/30/90) through a new per-model <type>_deleted_recency filter that resolves the cutoff with the server's datetime.now(). Beyond the timezone, this also retires two smaller defects three lenses noted in the old shape: the cutoff was frozen when the page mounted (a long-lived tab drifted a day per day), and it was persisted into ?filters= as an absolute timestamp no regenerated option could ever match. Day counts are stable and shareable. A malformed value degrades to the unfiltered list, like other FAB filter inputs. The new backend tests build their own database + dataset rather than assuming the example fixtures, so they run on a bare schema -- the review flagged the example-data dependence in these suites, and the shared local DB losing dataset id=1 mid-session (28 unrelated failures, all environmental) made the case concretely. Controls: neutralizing the recency predicate fails the window test; removing the humanized injection fails the display test; reverting the frontend presets to absolute cutoffs fails the contract test. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
In #33626, we decided to store the dataset's
changed_onattribute in UTC, to ensure consistency. This introduced an issue to calculate thechanged_on_humanizedproperty (now - item.changed_on). In order to fix this calculation for new edits, we would have to update it tonow.utc() - item.changed_onwhich then would break the calculation for items that were modified before this modification.Ideally, a long-term solution would be to implement timezone support at the DB level, and then migrate existing columns to use the timezone from the server. This however is not aligned with #33626 original's scope, so this PR just reverts that to store the
changed_onusingnow().BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No UI changes.
TESTING INSTRUCTIONS
N/A.
ADDITIONAL INFORMATION