Remove legacy git-webhooks routes
All checks were successful
check / check (push) Successful in 35s

This commit is contained in:
matamune 2026-05-12 23:34:42 +00:00
parent d99c2d9894
commit 3173641827
Signed by: matamune
GPG key ID: 3BB8E7D3B968A324
3 changed files with 8 additions and 23 deletions

View file

@ -10,9 +10,6 @@ POST /patchbay/jojo
POST /patchbay/github
```
Existing `/git-webhooks/jojo` and `/git-webhooks/github` routes remain
compatibility aliases for existing webhook registrations.
## Environment
```text

View file

@ -101,10 +101,10 @@ export function createHandler(config: ServerConfig): (request: Request) => Promi
if (url.pathname === "/healthz") {
return textResponse("ok\n");
}
if (url.pathname === "/patchbay/github" || url.pathname === "/git-webhooks/github") {
if (url.pathname === "/patchbay/github") {
return handleGithub(request, config, store);
}
if (url.pathname === "/patchbay/jojo" || url.pathname === "/git-webhooks/jojo") {
if (url.pathname === "/patchbay/jojo") {
return handleJojo(request, config, store);
}
return jsonResponse({ error: "not_found" }, { status: 404 });

View file

@ -39,6 +39,12 @@ describe("server", () => {
expect(response.status).toBe(401);
});
test("does not serve legacy git-webhooks routes", async () => {
const handler = createHandler({ githubSecret: "gh", jojoSecret: "jojo", dataDir: await mkdtemp(join(tmpdir(), "patchbay-")) });
const response = await handler(new Request("http://localhost/git-webhooks/jojo", { method: "POST", body: "{}" }));
expect(response.status).toBe(404);
});
test("accepts jojo main pushes and queues a job", async () => {
const dataDir = await mkdtemp(join(tmpdir(), "patchbay-"));
const handler = createHandler({ githubSecret: "gh", jojoSecret: "jojo", dataDir });
@ -58,24 +64,6 @@ describe("server", () => {
expect(await readFile(join(dataDir, "jobs.jsonl"), "utf8")).toContain("\"kind\":\"main_push\"");
});
test("keeps legacy git-webhooks routes as aliases", async () => {
const dataDir = await mkdtemp(join(tmpdir(), "patchbay-"));
const handler = createHandler({ githubSecret: "gh", jojoSecret: "jojo", dataDir });
const request = await signedRequest("/git-webhooks/jojo", "jojo", "jojo", {
ref: "refs/heads/main",
after: "abc123",
repository: {
name: "patchbay",
full_name: "peezy-tech/patchbay",
owner: { username: "peezy-tech" },
},
});
const response = await handler(request);
expect(response.status).toBe(202);
expect(await readFile(join(dataDir, "events.jsonl"), "utf8")).toContain("\"provider\":\"jojo\"");
});
test("continues accepting webhooks when Discord returns an error", async () => {
const originalFetch = globalThis.fetch;
globalThis.fetch = (async () => new Response("bad", { status: 500 })) as unknown as typeof fetch;