Release Minimize Tools 0.2.0
Verify / verify (push) Canceled after 0s

This commit is contained in:
2026-09-02 04:45:12 +02:00
parent 7bd20872a2
commit 87a7ef6ddd
25 changed files with 758 additions and 52 deletions
+20 -1
View File
@@ -81,6 +81,25 @@ test("downloads the minimized case and exact predicate report", async ({
);
});
test("minimizes a deterministic multi-file bundle with stability sampling", async ({
page,
}) => {
await page.goto("/deep/nested/minimize/");
await page.getByLabel("Failure predicate").selectOption("contains");
const bundleInput = page.locator('input[type="file"][multiple]');
await bundleInput.setInputFiles([
"tests/fixtures/noise.txt",
"tests/fixtures/case.txt",
]);
await expect(page.getByText("2 bundle files active")).toBeVisible();
await page.getByRole("button", { name: "Minimize reproducer" }).click();
await expect(
page.getByRole("heading", { name: "Minimized bundle" }),
).toBeVisible();
await expect(page.getByText(/2 1 files/u)).toBeVisible();
await expect(page.getByText(/flaky candidates observed/u)).toBeVisible();
});
test("integrates help, themes, identity, headers and offline reload", async ({
page,
request,
@@ -111,7 +130,7 @@ test("integrates help, themes, identity, headers and offline reload", async ({
const manifest = await request.get("/deep/nested/minimize/toolbox-app.json");
await expect(manifest.json()).resolves.toMatchObject({
id: "de.add-ideas.minimize-tools",
version: "0.1.0",
version: "0.2.0",
privacy: { processing: "local", telemetry: false },
});
await context.setOffline(true);
+18
View File
@@ -0,0 +1,18 @@
import { expect, test } from "@playwright/test";
test("keeps the primary workspace inside a narrow viewport", async ({
page,
}) => {
await page.goto("/deep/nested/minimize/");
await expect(page.locator("main").first()).toBeVisible();
await expect(
page.locator("main .loading, main .workbench-loading"),
).toHaveCount(0);
const widths = await page.evaluate(() => ({
content: document.documentElement.scrollWidth,
viewport: document.documentElement.clientWidth,
}));
expect(widths.viewport).toBeLessThanOrEqual(430);
expect(widths.content).toBeLessThanOrEqual(widths.viewport + 1);
});
+1
View File
@@ -0,0 +1 @@
prefix BOOM suffix
+1
View File
@@ -0,0 +1 @@
discard this entire file
+47
View File
@@ -4,6 +4,10 @@ import {
createPredicate,
type RegexEvaluator,
} from "../../src/minimize/predicates";
import {
bundlePredicateAdapter,
minimizeBundle,
} from "../../src/minimize/bundle";
const unusedRegex: RegexEvaluator = async () => ({
matched: false,
@@ -125,4 +129,47 @@ describe("minimization engine", () => {
),
).toThrow(/include/u);
});
it("samples a flaky predicate according to an explicit stability policy", async () => {
const observations = new Map<string, number>();
const result = await minimizeInput(
"noise BOOM noise",
{
structure: "text",
maxTests: 300,
maxSeconds: 5,
stability: { samples: 3, requiredPasses: 2 },
},
async (candidate) => {
const count = (observations.get(candidate) ?? 0) + 1;
observations.set(candidate, count);
return candidate.includes("BOOM") && count % 3 !== 0;
},
new AbortController().signal,
);
expect(result.minimized).toContain("BOOM");
expect(result.stability).toEqual({ samples: 3, requiredPasses: 2 });
expect(result.unstableCandidates).toBeGreaterThan(0);
});
it("removes files and then minimizes retained bundle content", async () => {
const predicate = bundlePredicateAdapter(
createPredicate({ kind: "contains", needle: "BOOM" }, unusedRegex),
"concatenated",
);
const result = await minimizeBundle(
[
{ path: "noise.txt", content: "discard all of this" },
{ path: "case/input.txt", content: "prefix BOOM suffix" },
],
{ maxTests: 400, maxSeconds: 5 },
predicate,
new AbortController().signal,
);
expect(result.minimized).toHaveLength(1);
expect(result.minimized[0]).toMatchObject({ path: "case/input.txt" });
expect(result.minimized[0]?.content).toContain("BOOM");
expect(result.steps.some((step) => step.stage === "files")).toBe(true);
expect(result.steps.some((step) => step.stage === "content")).toBe(true);
});
});