diff --git i/apps/server/test/services/plugins/plugin-service.test.ts w/apps/server/test/services/plugins/plugin-service.test.ts index f13b15187..c87d5e942 100644 --- i/apps/server/test/services/plugins/plugin-service.test.ts +++ w/apps/server/test/services/plugins/plugin-service.test.ts @@ -1,3 +1,5 @@ +import { Hono } from "hono"; +import { registerPluginRoutes } from "../../../src/routes/plugins.js"; import { cp, mkdtemp, @@ -165,6 +167,25 @@ describe("plugin service", () => { } }); + it("issue 4352 disabled route must not advertise transient failure", async () => { + const rootDir = await writePlugin(workDir, { + name: "bb-plugin-disabled-route", + serverSource: `export default function plugin(bb) { + bb.http.route("POST", "/v1/messages", (context) => context.json({ ok: true }), { auth: "none" }); + }`, + }); + expect((await service.installPath(rootDir)).status).toBe("running"); + const app = new Hono().basePath("/api/v1"); + registerPluginRoutes(app, { config: { serverPort: 49163 }, db }, service); + const request = () => app.request("http://localhost/api/v1/plugins/disabled-route/http/v1/messages", { method: "POST" }); + expect((await request()).status).toBe(200); + await service.setEnabled("disabled-route", false); + expect(service.getHttpRoute("disabled-route", "POST", "/v1/messages")).toMatchObject({ outcome: "not-running", status: "disabled" }); + const response = await request(); + console.log("disabled response", response.status, await response.text()); + expect(response.status).toBeLessThan(500); + }); + it("installs a path plugin, runs its factory, and reports running", async () => { const rootDir = await writePlugin(workDir, { name: "bb-plugin-greeter",