Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -16,6 +16,10 @@
* `plugin-invoke.test.ts`; here we only assert the composition itself.
*/
import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, test, vi } from "vitest";
import { bootstrapPluginInvokeDeps, type PluginInvokeBootstrapPrismaSurface } from "./plugin-invoke-bootstrap.js";
@@ -307,6 +311,31 @@ describe("bootstrapPluginInvokeDeps", () => {
);
});
test("loadBinary rejects oversized WASM before reading it into memory", async () => {
const basePath = await mkdtemp(path.join(tmpdir(), "hivegrid-plugin-binary-"));
const binaryDirectory = path.join(basePath, "de.hivegrid.large", "1.0.0");
await mkdir(binaryDirectory, { recursive: true });
await writeFile(path.join(binaryDirectory, "plugin.wasm"), Buffer.alloc(9));
const logger = { info: vi.fn(), warn: vi.fn(), error: vi.fn() };
try {
const deps = bootstrapPluginInvokeDeps({
env: { PLUGIN_BINARY_BASE_PATH: basePath, PLUGIN_MAX_BINARY_BYTES: "8" },
prisma: makeFakePrisma(),
store: makeFakeStore() as never,
logger,
});
await expect(deps.loadBinary({ pluginId: "de.hivegrid.large", version: "1.0.0" })).resolves.toBeNull();
expect(logger.warn).toHaveBeenCalledWith(
expect.objectContaining({ pluginId: "de.hivegrid.large", version: "1.0.0", sizeBytes: 9, maxBytes: 8 }),
"plugin.invoke.binary_size_rejected",
);
} finally {
await rm(basePath, { recursive: true, force: true });
}
});
test("consumeRateLimit allows the first N calls then rejects", async () => {
const store = makeFakeStore();
const deps = bootstrapPluginInvokeDeps({