Skip to content

Commit 289eec0

Browse files
abhizipstackclaude
andcommitted
fix: address reviewer feedback — null config, auto-expand, dedup helper
P1: enabled_model_count crashed with AttributeError when a model in model_configs had a null/non-dict value. Added isinstance(m_cfg, dict) guard before calling .get(). P2: FAILURE rows no longer auto-expanded after the earlier "collapse by default" change. Restored auto-expand for FAILURE rows only, keyed on backUpData (fresh loads) so filter changes don't reset user-expanded rows. P2: Replaced the local formatRelativeTime in no-code-model.jsx with the shared getRelativeTime from common/helpers.js which already handles both past and future dates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9dc905b commit 289eec0

3 files changed

Lines changed: 9 additions & 19 deletions

File tree

backend/backend/core/scheduler/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ def list_deploy_candidates(request, project_id, model_name):
778778
enabled_model_count = sum(
779779
1
780780
for m_cfg in model_configs.values()
781-
if m_cfg.get("enabled", True)
781+
if isinstance(m_cfg, dict) and m_cfg.get("enabled", True)
782782
)
783783
env = task.environment
784784
candidates.append({

frontend/src/ide/editor/no-code-model/no-code-model.jsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ import {
9090
addIdToObjects,
9191
checkPermission,
9292
getBaseUrl,
93+
getRelativeTime,
9394
removeIdFromObjects,
9495
removeUnwantedKeys,
9596
} from "../../../common/helpers.js";
@@ -258,7 +259,6 @@ function NoCodeModel({ nodeData }) {
258259
runTask,
259260
listRecentRunsForModel,
260261
} = useJobService();
261-
const { token } = theme.useToken();
262262

263263
const [quickDeployModal, setQuickDeployModal] = useState({
264264
open: false,
@@ -1672,19 +1672,6 @@ function NoCodeModel({ nodeData }) {
16721672
RETRY: "orange",
16731673
};
16741674

1675-
const formatRelativeTime = (iso) => {
1676-
if (!iso) return "—";
1677-
const diff = Date.now() - new Date(iso).getTime();
1678-
const mins = Math.floor(diff / 60000);
1679-
if (mins < 1) return "just now";
1680-
if (mins < 60) return `${mins} min ago`;
1681-
const hrs = Math.floor(mins / 60);
1682-
if (hrs < 24) return `${hrs} hr ago`;
1683-
const days = Math.floor(hrs / 24);
1684-
if (days < 7) return `${days} day${days > 1 ? "s" : ""} ago`;
1685-
return new Date(iso).toLocaleDateString();
1686-
};
1687-
16881675
const fetchRecentRuns = async () => {
16891676
const name = nodeData?.node?.title;
16901677
if (!name) return;
@@ -1757,7 +1744,7 @@ function NoCodeModel({ nodeData }) {
17571744
{run.environment_name ? ` · ${run.environment_name}` : ""}
17581745
</Typography.Text>
17591746
<Typography.Text type="secondary" style={{ fontSize: 11 }}>
1760-
{formatRelativeTime(run.start_time)}
1747+
{getRelativeTime(run.start_time)}
17611748
</Typography.Text>
17621749
</div>
17631750
);

frontend/src/ide/run-history/Runhistory.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,13 @@ const Runhistory = () => {
191191
backUpData,
192192
]);
193193

194-
/* ─── collapse all rows when the underlying data changes ─── */
194+
/* ─── auto-expand failed rows on fresh data load ─── */
195195
useEffect(() => {
196-
setExpandedRowKeys([]);
197-
}, [JobHistoryData]);
196+
const failedIds = (backUpData || [])
197+
.filter((r) => r.status === "FAILURE" && r.error_message)
198+
.map((r) => r.id);
199+
setExpandedRowKeys(failedIds);
200+
}, [backUpData]);
198201

199202
/* ─── handlers ─── */
200203
const handleJobChange = useCallback((value) => {

0 commit comments

Comments
 (0)