From 68c2d6caa8e6233759fbdb140ad7c40fe409125f Mon Sep 17 00:00:00 2001 From: danielhanchen Date: Tue, 28 Jul 2026 16:47:28 +0000 Subject: [PATCH] Point the lifecycle contracts at the module the labels moved to Extracting the labels out of the monitor page left two contracts asserting they were still in it, so the staged run went red on all three platforms. They read the new module now, and the page contract additionally pins that it imports from there rather than redefining them. --- .../test_usage_examples_model_source_contract.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/studio/test_usage_examples_model_source_contract.py b/tests/studio/test_usage_examples_model_source_contract.py index 42bbc67cb6..3f83db9b4a 100644 --- a/tests/studio/test_usage_examples_model_source_contract.py +++ b/tests/studio/test_usage_examples_model_source_contract.py @@ -136,6 +136,12 @@ def test_usage_examples_has_no_duplicate_auto_switch_control(): # configuration and links across; these contracts follow the behaviour, not the # old file. API_MONITOR_TSX = REPO / "studio/frontend/src/features/api-monitor/api-monitor-page.tsx" +# The lifecycle labels live in their own module: the overlay is mounted from +# __root.tsx, so importing them from the page pulled the whole page into the +# eager bundle and undid the route's lazyRouteComponent. +API_MONITOR_LIFECYCLE_TS = ( + REPO / "studio/frontend/src/features/api-monitor/lifecycle.ts" +) MONITOR_LINK_TSX = SETTINGS / "components/monitor-link.tsx" @@ -153,12 +159,14 @@ def test_api_monitor_history_does_not_reorder_under_the_reader(): def test_api_monitor_renders_lifecycle_rows(): src = API_MONITOR_TSX.read_text(encoding = "utf-8") - assert "export function isLifecycleEntry(" in src - assert 'entry.kind === "lifecycle"' in src + labels = API_MONITOR_LIFECYCLE_TS.read_text(encoding = "utf-8") + assert "export function isLifecycleEntry(" in labels + assert 'entry.kind === "lifecycle"' in labels for label in ("Loading model", "Model loaded", "Model unloaded"): - assert label in src + assert label in labels # A lifecycle row has no prompt or reply, so it is not selectable for detail. assert "if (isLifecycleEntry(entry)) {" in src + assert 'from "./lifecycle"' in src def test_auto_switch_section_sits_above_the_usage_examples(): @@ -174,7 +182,7 @@ EN_TS = REPO / "studio/frontend/src/i18n/locales/en.ts" def test_api_monitor_renders_download_rows(): - src = API_MONITOR_TSX.read_text(encoding = "utf-8") + src = API_MONITOR_LIFECYCLE_TS.read_text(encoding = "utf-8") assert 'entry.event === "download"' in src for label in ("Downloading model", "Model downloaded", "Model download failed"): assert label in src