Skip to content

Commit d3e29df

Browse files
committed
test(v5-g24): Roundtrip OK label means byte_diff=0 (T2 GPT-2 BPE)
Closes V5-G24 / cppmega-mlx-edp. V3-10 only proved FAIL non-blocking; positive case never asserted byte-exact. Scans all rendered roundtrip badges and asserts: for every row labelled 'Roundtrip OK', the title attribute carries byte_diff=0. At least one OK row required (GPT-2 BPE is byte-exact for ASCII corpus). Cppmega tokenizer (T1) is documented-lossy (decoder=null, ~0.7% byte-exact) — not used here. 1/1 e2e green.
1 parent 1187589 commit d3e29df

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

Comments
 (0)