test: state the current contract in tests named after removed limits (#11588)

Eleven tests were named "beyond the former ..." and pinned a value just above
a limit that no longer exists. Each now states and checks the current
contract:

- jsonShape: the caller's byte allowance is the only bound; a shape that fits
  exactly is complete and one byte less is a capacity refusal.
- Hopper download: chunks arriving just inside the stall bound complete (the
  trickle case already covers the total bound).
- Firmware: a selected analysis_timeout_ms above the default governs the owned
  command, expressed from the default constant.
- Provider process output, CDP resources/timeline/WebMCP frames, Playwright
  steps/artifacts/Electron waits, scenario diff and Bun ELF names: renamed to
  the unbounded-count or exact-selection contract they check, with a note on
  what bound (if any) still applies and where it is covered.

The six JavaScript analyzer tests with the same naming are left to their
workstream.

Refs #10515
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 07:56:52 +08:00
1 parent f8cec67e44
commit e3eb4c1749
14 files changed
+58 -26

No files matched your search

+1 -1
View File
@@ -419,7 +419,7 @@ it.each([
},
);
it("recognizes an ELF Bun name beyond the former string-table prefix without reading the prefix", async () => {
it("recognizes an ELF Bun section name deep in the string table by reading only that name", async () => {
const bytes = elfBunSection(
bunPrefixedPayload(
bunModuleGraphPayload({
@@ -537,7 +537,7 @@ describe("PlaywrightBrowserScenarioProvider", () => {
expect(result.value.limitations).toContain(session.storageGaps[0]);
});
it("returns an initial state and every step beyond the former action ceiling", async () => {
it("returns an initial state and every step of a long scenario", async () => {
const session = new FakeSession("launch");
const provider = new PlaywrightBrowserScenarioProvider(() =>
Promise.resolve(session),
@@ -406,7 +406,7 @@ it("runs an untargeted deep-link without requiring a BrowserWindow", async () =>
]);
});
it("honors caller-selected Electron waits beyond the former action timeout", async () => {
it("honors a caller-selected Electron wait duration exactly", async () => {
const input = electronActiveObservationInputSchema.parse({
executable_path: "/opt/electron",
application_path: "/opt/app/main.js",
@@ -15,7 +15,8 @@ const scenario = browserScenarioSchema.parse({
});
const secrets = resolveScenarioSecrets(scenario, {});
it("returns a complete requested text artifact beyond the former inline ceiling", async () => {
// Text artifacts have no inline size ceiling; the content is returned whole.
it("returns a large requested text artifact complete", async () => {
const page = {
url: () => "https://app.example.test/",
content: () => Promise.resolve("x".repeat(16 * 1_024 * 1_024 + 1)),
+1 -1
View File
@@ -1026,7 +1026,7 @@ describe("browser scenario comparison validation", () => {
).toBe(false);
});
it("returns every aligned step beyond the former capture ceiling", () => {
it("returns every aligned step of long scenarios", () => {
const before = multiStepScenarioCapture(130, "before");
const after = multiStepScenarioCapture(130, "after");
const result = compareBrowserScenarios(
+26 -7
View File
@@ -201,18 +201,37 @@ describe("JSON shape completeness and ordering", () => {
}
});
it("retains every parsed property beyond the former shape-node limit", () => {
const content = Object.fromEntries(
Array.from({ length: 5_001 }, (_, index) => [`field_${index}`, index]),
// The caller's byte allowance is the only bound: a shape that fits exactly
// is complete, and one byte less is a capacity refusal naming both sizes.
it("retains every parsed property within the byte allowance and refuses one byte less", () => {
const source = JSON.stringify(
Object.fromEntries(
Array.from({ length: 5_001 }, (_, index) => [`field_${index}`, index]),
),
);
const unbounded = inferJsonShape(source, Number.MAX_SAFE_INTEGER);
if (!unbounded.ok) throw unbounded.error;
const { serializedBytes } = unbounded.value;
expect(serializedBytes).toBe(
Buffer.byteLength(JSON.stringify(unbounded.value.shape)),
);
const shape = completeShape(JSON.stringify(content));
expect(shape.properties).toHaveLength(5_001);
expect(shape.node_count).toBe(5_002);
expect(shape.properties).toContainEqual({
const exact = inferJsonShape(source, serializedBytes);
if (!exact.ok) throw exact.error;
expect(exact.value.shape.properties).toHaveLength(5_001);
expect(exact.value.shape.node_count).toBe(5_002);
expect(exact.value.shape.properties).toContainEqual({
path: [property("field_5000")],
types: ["number"],
observations: 1,
});
const refused = inferJsonShape(source, serializedBytes - 1);
if (refused.ok || refused.error.kind !== "capacity")
throw new Error("A shape one byte over its allowance was admitted");
expect(refused.error.maximumBytes).toBe(serializedBytes - 1);
expect(refused.error.requiredBytesAtLeast).toBeGreaterThan(
serializedBytes - 1,
);
});
});
@@ -757,7 +757,9 @@ describe("CdpBrowserProvider: WebMCP replay inventory", () => {
);
});
it("retains registrations from authorized frames beyond the former frame cap", async () => {
// Frame count has no ceiling: the last of many authorized frames still
// contributes its registration.
it("retains registrations from every authorized frame of a page with many frames", async () => {
const browser = await startFakeCdpBrowser({
webMcpTools: true,
webMcpFrameCount: 1_001,
@@ -776,7 +778,7 @@ describe("CdpBrowserProvider: WebMCP replay inventory", () => {
expect(result.value.tools.items).toEqual(
expect.arrayContaining([
expect.objectContaining({
name: "beyond_frame_limit_tool",
name: "last_frame_tool",
frame_id: "webmcp-frame-1000",
}),
]),
@@ -422,7 +422,8 @@ describe("CdpBrowserProvider navigation timeline", () => {
}
},
);
it("returns every event beyond the former default collection cap", async () => {
// Event count has no ceiling; only a dropped event truncates the timeline.
it("returns every event of a long session timeline without truncating it", async () => {
const additionalEvents = 2_001;
const browser = await startFakeCdpBrowser({
pageScopedVersionWebSocket: true,
@@ -516,7 +516,9 @@ describe("CdpElectronProvider target access", () => {
expect(browser.activeConnectionCount()).toBe(0);
});
it("returns every in-scope resource beyond the former collection ceiling", async () => {
// Resource count has no ceiling; only an exhausted resource budget
// truncates the section.
it("returns every in-scope resource of a large inventory without truncating the section", async () => {
const root = await electronFixture();
const index = join(root, "index.html");
const count = 2_001;
@@ -235,7 +235,9 @@ describe("provider process output and cleanup primitives", () => {
});
});
it("retains complete stdout and stderr beyond the former fixed ceiling", async () => {
// Without a selected diagnostic budget every byte is retained; a selected
// budget drains and reports overflow (providerProcessOutput.test.ts).
it("retains complete stdout and stderr when no diagnostic budget is selected", async () => {
const outputBytes = 70_000;
const child = spawnProviderProcessFixture("burst", outputBytes);
const diagnostics: ProviderProcessDiagnostic[] = [];
+1 -1
View File
@@ -112,7 +112,7 @@ const emitMainWebMcpTools = (
...(options.webMcpFrameCount !== undefined && options.webMcpFrameCount > 0
? [
{
name: "beyond_frame_limit_tool",
name: "last_frame_tool",
description: "Registered in an in-scope frame after index 999",
frameId: `webmcp-frame-${String(options.webMcpFrameCount - 1)}`,
},
@@ -249,7 +249,9 @@ test("keeps each queued request's independent analysis and publication budgets",
await assertFirmwareCleanup(fixture.launches);
});
test("uses the selected phase deadline inside an owned command beyond the former 120-second cap", async () => {
// A selected analysis_timeout_ms governs the owned command, not the default:
// time past the default elapses inside the command and analysis completes.
test("uses a selected analysis deadline above the default inside an owned command", async () => {
const fixture = await firmwareFixture();
const advance = phaseClock();
const wait = ProviderProcessSupervisor.prototype.waitForOutputClose;
@@ -264,18 +266,18 @@ test("uses the selected phase deadline inside an owned command beyond the former
const closed = await wait.apply(this, args);
if (!advanced) {
advanced = true;
advance(120_001);
advance(DEFAULT_FIRMWARE_ANALYSIS_TIMEOUT_MS + 1);
return false;
}
return closed;
});
const result = await fixture.service.execute("inspect_firmware_regions", {
path: fixture.path,
analysis_timeout_ms: 240_000,
analysis_timeout_ms: 2 * DEFAULT_FIRMWARE_ANALYSIS_TIMEOUT_MS,
});
if (!result.ok) throw result.error;
expect(result.value.normalized_result).toMatchObject({
analysis_timeout_ms: 240_000,
analysis_timeout_ms: 2 * DEFAULT_FIRMWARE_ANALYSIS_TIMEOUT_MS,
});
expect(fixture.launches).toHaveLength(2);
expect(
@@ -53,10 +53,13 @@ const stubPackage = (chunkEveryMs: number, chunks: number) => {
return fetch;
};
it("completes a slow download that keeps delivering bytes past the former 120 s deadline", async () => {
stubPackage(20_000, 9);
// Each chunk arrives just inside the stall bound; the download completes
// well before the total bound (the trickle case below exceeds it).
it("completes a slow download whose bytes keep arriving within the stall bound", async () => {
const chunkEveryMs = HOPPER_DOWNLOAD_STALL_MS - 1;
stubPackage(chunkEveryMs, 9);
const pending = downloadHopperPackage(url);
await vi.advanceTimersByTimeAsync(9 * 20_000);
await vi.advanceTimersByTimeAsync(9 * chunkEveryMs);
expect(await pending).toEqual(ok(Buffer.alloc(9 * 1024)));
});
+1 -1
View File
@@ -1435,7 +1435,7 @@ export const PROVIDER_LIFECYCLE_COVERAGE: Readonly<
operation: covered(
test(
"src/browser/PlaywrightBrowserScenarioProvider.test.ts",
"returns an initial state and every step beyond the former action ceiling",
"returns an initial state and every step of a long scenario",
),
),
cancel: covered(