Skip to content

Commit de97852

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 8e49a74 commit de97852

3 files changed

Lines changed: 9 additions & 18 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 & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import {
8989
addIdToObjects,
9090
checkPermission,
9191
getBaseUrl,
92+
getRelativeTime,
9293
removeIdFromObjects,
9394
removeUnwantedKeys,
9495
} from "../../../common/helpers.js";
@@ -1624,19 +1625,6 @@ function NoCodeModel({ nodeData }) {
16241625
RETRY: "orange",
16251626
};
16261627

1627-
const formatRelativeTime = (iso) => {
1628-
if (!iso) return "—";
1629-
const diff = Date.now() - new Date(iso).getTime();
1630-
const mins = Math.floor(diff / 60000);
1631-
if (mins < 1) return "just now";
1632-
if (mins < 60) return `${mins} min ago`;
1633-
const hrs = Math.floor(mins / 60);
1634-
if (hrs < 24) return `${hrs} hr ago`;
1635-
const days = Math.floor(hrs / 24);
1636-
if (days < 7) return `${days} day${days > 1 ? "s" : ""} ago`;
1637-
return new Date(iso).toLocaleDateString();
1638-
};
1639-
16401628
const fetchRecentRuns = async () => {
16411629
const name = nodeData?.node?.title;
16421630
if (!name) return;
@@ -1709,7 +1697,7 @@ function NoCodeModel({ nodeData }) {
17091697
{run.environment_name ? ` · ${run.environment_name}` : ""}
17101698
</Typography.Text>
17111699
<Typography.Text type="secondary" style={{ fontSize: 11 }}>
1712-
{formatRelativeTime(run.start_time)}
1700+
{getRelativeTime(run.start_time)}
17131701
</Typography.Text>
17141702
</div>
17151703
);

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)