|
| 1 | +// V4-1: DataInspector → stage_options.train.parquet_path threading. |
| 2 | +// |
| 3 | +// Walks: load parquet in Data tab → click "Use for training" → switch |
| 4 | +// to canvas → Train → assert extras.data_source === "parquet" AND |
| 5 | +// extras.token_count > 0 (proves UI selection actually reached backend). |
| 6 | +// |
| 7 | +// Closes G1 from V4 audit (UI parquet decorative for training). |
| 8 | + |
| 9 | +import { test, expect } from "@playwright/test"; |
| 10 | +import { gotoApp, selectPreset, clickTab, closeModal } from "../fixtures"; |
| 11 | +import { loadMatrix } from "../utils/matrix"; |
| 12 | +import { readTrainExtras } from "../utils/train_extras"; |
| 13 | + |
| 14 | +test("V4-1: DataInspector parquet reaches stage_train via stage_options", |
| 15 | + async ({ page }) => { |
| 16 | + test.setTimeout(120_000); |
| 17 | + const matrix = loadMatrix(); |
| 18 | + const parquet = matrix.parquets.T2_gpt2_small__P1_minimal.path; |
| 19 | + |
| 20 | + await gotoApp(page); |
| 21 | + await selectPreset(page, "llama3_8b"); |
| 22 | + |
| 23 | + // Default indicator: synthetic |
| 24 | + await expect(page.getByTestId("train-data-source")).toContainText( |
| 25 | + "synthetic"); |
| 26 | + |
| 27 | + // Load parquet in Data tab |
| 28 | + await clickTab(page, "data"); |
| 29 | + await page.getByTestId("data-inspector").waitFor(); |
| 30 | + await page.getByTestId("data-path").fill(parquet); |
| 31 | + await page.getByTestId("data-load").click(); |
| 32 | + await page.getByTestId("data-metrics").waitFor({ timeout: 8_000 }); |
| 33 | + |
| 34 | + // Use this parquet for training |
| 35 | + await page.getByTestId("data-use-for-train").click(); |
| 36 | + |
| 37 | + // Indicator now shows parquet basename |
| 38 | + const indicator = page.getByTestId("train-data-source"); |
| 39 | + await expect(indicator).toContainText("parquet:"); |
| 40 | + await expect(indicator).toContainText("T2_gpt2_small__P1_minimal"); |
| 41 | + |
| 42 | + // Train |
| 43 | + await clickTab(page, "canvas"); |
| 44 | + await page.getByTestId("run-pipeline-toggle").click(); |
| 45 | + await page.getByTestId("run-pipeline-train").click(); |
| 46 | + const modal = page.getByTestId("run-result-modal"); |
| 47 | + await modal.waitFor({ timeout: 60_000 }); |
| 48 | + |
| 49 | + const extras = await readTrainExtras(page); |
| 50 | + // Direct DOM check on new data_source / token_count primitives. |
| 51 | + const dataSource = await page.getByTestId( |
| 52 | + "run-result-extras-train-data_source").textContent(); |
| 53 | + expect(dataSource?.trim()).toBe("parquet"); |
| 54 | + const tokenCount = parseInt( |
| 55 | + (await page.getByTestId( |
| 56 | + "run-result-extras-train-token_count").textContent()) ?? "0", 10); |
| 57 | + expect(tokenCount).toBeGreaterThan(0); |
| 58 | + // Weights moved |
| 59 | + expect(extras.weight_delta_norm).toBeGreaterThan(0); |
| 60 | + |
| 61 | + await closeModal(page); |
| 62 | + }); |
| 63 | + |
| 64 | +test("V4-1 negative: no Use-for-train click → stage_train falls back to synthetic", |
| 65 | + async ({ page }) => { |
| 66 | + test.setTimeout(120_000); |
| 67 | + await gotoApp(page); |
| 68 | + await selectPreset(page, "llama3_8b"); |
| 69 | + |
| 70 | + // Don't click Use-for-train; just run Train. |
| 71 | + await page.getByTestId("run-pipeline-toggle").click(); |
| 72 | + await page.getByTestId("run-pipeline-train").click(); |
| 73 | + const modal = page.getByTestId("run-result-modal"); |
| 74 | + await modal.waitFor({ timeout: 60_000 }); |
| 75 | + |
| 76 | + await page.getByTestId("run-result-expand-train").click(); |
| 77 | + const dataSource = await page.getByTestId( |
| 78 | + "run-result-extras-train-data_source").textContent(); |
| 79 | + expect(dataSource?.trim()).toBe("synthetic"); |
| 80 | + await closeModal(page); |
| 81 | + }); |
0 commit comments