bito-code-review[bot] commented on code in PR #36934:
URL: https://github.com/apache/superset/pull/36934#discussion_r2666713542
##########
superset/common/utils/query_cache_manager.py:
##########
@@ -108,6 +111,7 @@ def set_query_result(
self.df = query_result.df
self.sql_rowcount = query_result.sql_rowcount
self.annotation_data = {} if annotation_data is None else
annotation_data
+ self.queried_dttm =
datetime.now(tz=timezone.utc).isoformat().split(".")[0]
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect cache persistence for queried_dttm</b></div>
<div id="fix">
The queried_dttm field tracks when the query was executed, but it's not
stored in the cache value, so when loading from cache, it incorrectly uses the
cache timestamp instead of the original query time. This could affect any logic
or display relying on the actual query execution time.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/2592b1c/AGENTS.md#L25">AGENTS.md:25</a>
</li>
</ul>
</details>
<small><i>Code Review Run #7e0279</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/components/LastQueriedLabel/index.tsx:
##########
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { FC } from 'react';
+import { t } from '@superset-ui/core';
+import { css, useTheme } from '@apache-superset/core/ui';
+import { extendedDayjs } from '@superset-ui/core/utils/dates';
+
+interface LastQueriedLabelProps {
+ queriedDttm: string | null;
+}
+
+const LastQueriedLabel: FC<LastQueriedLabelProps> = ({ queriedDttm }) => {
+ const theme = useTheme();
+
+ if (!queriedDttm) {
+ return null;
+ }
+
+ const formattedTime = extendedDayjs
+ .utc(queriedDttm)
+ .local()
+ .format('L LTS');
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing date validation</b></div>
<div id="fix">
The component should validate that queriedDttm is a valid date string to
avoid displaying 'Invalid Date' if malformed input is passed. Consider adding a
check like `if (!extendedDayjs.utc(queriedDttm).isValid()) return null;` after
the null check.
</div>
</div>
<small><i>Code Review Run #7e0279</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]