|
| 1 | +// G24: Tokenizer roundtrip OK badge must actually mean byte-exact |
| 2 | +// decode. V3-10 only proved FAIL non-blocking; positive case (OK |
| 3 | +// label) was never asserted to be byte-exact. |
| 4 | + |
| 5 | +import { test, expect } from "@playwright/test"; |
| 6 | +import { gotoApp, clickTab } from "../fixtures"; |
| 7 | +import { loadMatrix } from "../utils/matrix"; |
| 8 | + |
| 9 | +test("G24: cppmega tokenizer + T1 parquet → OK rows with byte_diff=0", |
| 10 | + async ({ page }) => { |
| 11 | + test.setTimeout(60_000); |
| 12 | + const matrix = loadMatrix(); |
| 13 | + // T2 = GPT-2 BPE; byte-exact for the ASCII corpus in its matching |
| 14 | + // parquet. (T1 cppmega has decoder=null per repo memory, only |
| 15 | + // ~0.7% of lines roundtrip byte-exact — see e2e_matrix_v3_report.) |
| 16 | + const parquet = matrix.parquets.T2_gpt2_small__P1_minimal.path; |
| 17 | + const tokenizer = matrix.tokenizers.T2_gpt2_small.path; |
| 18 | + |
| 19 | + await gotoApp(page); |
| 20 | + await clickTab(page, "data"); |
| 21 | + await page.getByTestId("data-inspector").waitFor(); |
| 22 | + await page.getByTestId("data-path").fill(parquet); |
| 23 | + await page.getByTestId("data-load").click(); |
| 24 | + await page.getByTestId("data-metrics").waitFor({ timeout: 8_000 }); |
| 25 | + await page.getByTestId("data-tokenizer-path").fill(tokenizer); |
| 26 | + await page.getByTestId("data-roundtrip").click(); |
| 27 | + await page.getByTestId("data-roundtrip-0").waitFor({ timeout: 8_000 }); |
| 28 | + |
| 29 | + // Scan all rendered roundtrip badges; for every row labelled OK, |
| 30 | + // the title attribute MUST report byte_diff=0 (byte-exact decode). |
| 31 | + // Asserts the OK label has real meaning, not just a green chip. |
| 32 | + const rows = page.locator("[data-testid^='data-roundtrip-']"); |
| 33 | + const count = await rows.count(); |
| 34 | + expect(count).toBeGreaterThan(0); |
| 35 | + let okCount = 0; |
| 36 | + for (let i = 0; i < count; i++) { |
| 37 | + const text = await rows.nth(i).textContent(); |
| 38 | + const title = await rows.nth(i).getAttribute("title"); |
| 39 | + if (text?.includes("Roundtrip OK")) { |
| 40 | + okCount++; |
| 41 | + expect(title).toContain("byte_diff=0"); |
| 42 | + } |
| 43 | + } |
| 44 | + // GPT-2 BPE should byte-exact at least one ASCII row. |
| 45 | + expect(okCount).toBeGreaterThan(0); |
| 46 | + }); |
0 commit comments