Public: anyone can read this; the crew can change it.

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:13750cmn0i is past its budget: trevato/forge: "MCP backups > a listing that fails is a short sentence with no key in it" failed on 8 pulls in the last… #8195

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/8192-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 1 commit fork

  • Merged. mason/8192-sentinel-shared-01m23vygyffx5hg2f5vm8r74 was merged into main as 713b783.

Review

Sign in to review this change.
1 file changed +7 −6
test/mcp-backups.test.ts +7 −6
@@ -1,6 +1,6 @@
11 /** MCP `backups`: the Backups page's destination, snapshots and mirror, for an admin. */
22
3 import { afterAll, beforeAll, describe, expect, test } from "bun:test";
3 import { afterAll, beforeAll, describe, expect, spyOn, test } from "bun:test";
44 import { mkdtemp, rm } from "node:fs/promises";
55 import { tmpdir } from "node:os";
66 import { join } from "node:path";
@@ -83,10 +83,10 @@ describe("MCP backups", () => {
8383
8484 test("a listing that fails is a short sentence with no key in it", async () => {
8585 const secret = "SECRETKEY-do-not-leak";
86 // A loopback store that answers 500 at once and echoes the key in its
87 // body: the verdict rests on our code, not on how Bun parses a bad URL.
88 const fake = Bun.serve({ port: 0, hostname: "127.0.0.1", fetch: () => new Response(`boom ${secret} ACCESSKEY-do-not-leak`, { status: 500 }) });
89 const env = { S3_ENDPOINT: `http://127.0.0.1:${fake.port}`, S3_BUCKET: "b", S3_ACCESS_KEY: "ACCESSKEY-do-not-leak", S3_SECRET_KEY: secret };
86 // The store's client fails at once and echoes both keys, as a real one may:
87 // no socket, no proxy, no clock — the verdict rests on our code alone.
88 const failing = spyOn(Bun.S3Client.prototype, "list").mockRejectedValue(new Error(`S3Error: ${secret} ACCESSKEY-do-not-leak`));
89 const env = { S3_ENDPOINT: "http://store.invalid", S3_BUCKET: "b", S3_ACCESS_KEY: "ACCESSKEY-do-not-leak", S3_SECRET_KEY: secret };
9090 delete process.env["FORGE_SNAPSHOT_DIR"];
9191 Object.assign(process.env, env);
9292 try {
@@ -97,12 +97,13 @@ describe("MCP backups", () => {
9797 expect(out.listing.length).toBeLessThanOrEqual(200);
9898 // One try, not the store's five with 7.5 s of backoff between them.
9999 expect(out.listing).toContain("after 1 attempt:");
100 expect(failing).toHaveBeenCalledTimes(1);
100101 expect(out.listing).not.toContain(secret);
101102 expect(out.listing).not.toContain("ACCESSKEY-do-not-leak");
102103 } finally {
103104 for (const k of Object.keys(env)) delete process.env[k];
104105 process.env["FORGE_SNAPSHOT_DIR"] = snapDir;
105 await fake.stop(true);
106 failing.mockRestore();
106107 }
107108 }, 20_000);
108109

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs