-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sqllab): normalize changedOn timestamp #24513
Conversation
e498a6d
to
d459ec8
Compare
d459ec8
to
295aa6a
Compare
49140d5
to
ccf3960
Compare
Codecov Report
@@ Coverage Diff @@
## master #24513 +/- ##
==========================================
+ Coverage 69.06% 69.07% +0.01%
==========================================
Files 1901 1902 +1
Lines 74019 74024 +5
Branches 8116 8117 +1
==========================================
+ Hits 51121 51134 +13
+ Misses 20787 20779 -8
Partials 2111 2111
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@villebro could you expand on what you mean by,
The reason I ask is I was wondering whether the fix should be a backend rather than frontend fix, where the backend returns a non-ambiguous timestamp. |
@john-bodley yes, I think we should do that in the long run. However, at this point I felt it an unnecessarily risky change, as it might have far reaching implications for users that are relying on the current formatting behavior. Also, the fact that this functionality was broken in multiple ways on the frontend, including having either erroneous or missing tests (hence the regression), I felt it prudent to first get this area improved some more before proceeding to fixing the backend, which IMO has an even larger blast radius. |
SUMMARY
#24422 introduced a regression which caused SQL Lab results to not show up in SQL Lab for clients that had a negative TZ offset. This was due to the backend returning timestamps in naive format that don't include a prefix to indicate that the timestamp is in UTC TZ. Due to parsing this using
Date.parse()
in the frontend, this timestamp was assumed to be in local timezone, causing an inconsistency when requesting updated queries using the epoch representation.This fixes the issue by using the
normalizeTimestamp
function from@superset-ui/core
, and adds tests to ensure thatqueriesLastUpdate
in Redux state is correctly normalized (adenormalizeTimestamp
util is added as it's needed for updating the tests). This new test would previously have failed on master branch when run in non-UTC TZ.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION