Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/hub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"@modelcontextprotocol/sdk": "catalog:",
"@workbench/access-policy": "workspace:*",
"@workbench/connections": "workspace:*",
"@workbench/echo": "workspace:*",
"@workbench/hub-client": "workspace:*",
"@workbench/onboarding": "workspace:*",
"@workbench/templates": "workspace:*",
Expand Down
5 changes: 0 additions & 5 deletions apps/hub/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ import {
createWorkflowArtifactRoutes,
createWorkflowRunAuthenticator,
} from "@corbits/artifacts-hub";
import { createEchoRoutes } from "@workbench/echo";
import {
createArtifactDocPersistence,
createPresenceRoomRegistry,
Expand Down Expand Up @@ -1167,10 +1166,6 @@ export async function createHub(config: HubConfig) {
// nothing reported. See `hubErrorHandler`'s own doc comment.
app.onError(hubErrorHandler());

// Extension routes mount under the tenant prefix, inside the
// platform's native tenant middleware, so every extension handler
// runs with c.get("tenant") / c.get("principal") resolved.
app.route(`${TENANT_PREFIX}/echo`, createEchoRoutes());
// One in-process presence room registry for this process, constructed
// here in the composition root — the same pattern `workbenchSubscribers`
// above uses. Presence rooms are ephemeral and process-local by design
Expand Down
15 changes: 7 additions & 8 deletions apps/hub/test/composition.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Exercises the hub's own wiring: platform routes answering at boot,
// the echo extension mounted inside the native tenant middleware, and
// an extension route mounted inside the native tenant middleware, and
// same-origin static serving. Platform behavior behind the mounted
// routes belongs to its own packages and is not re-proven here. Booting
// the hub runs package migrations, so a reachable DATABASE_URL is
Expand Down Expand Up @@ -122,23 +122,22 @@ describeIfDb("shutdown", () => {
});

describeIfDb("extension mounting", () => {
test("echo mounts inside the native tenant middleware", async () => {
test("chat mounts inside the native tenant middleware", async () => {
const hub = await bootHub();

// Anonymous request to the echo route: the platform's tenant
// Anonymous request to an extension route: the platform's tenant
// middleware answers 401 before the extension's handler runs.
const gated = await hub.app.request("/api/tenants/some-tenant/echo", {
method: "POST",
body: "hello",
});
const gated = await hub.app.request(
"/api/tenants/some-tenant/chat/workbenches",
);
expect(gated.status).toBe(401);
expect(await gated.json()).toEqual({
error: { code: "unauthorized", message: "Authentication required" },
});

// The route exists only under the tenant scope; outside it the
// path falls through to the interface shell.
const outside = await hub.app.request("/echo");
const outside = await hub.app.request("/chat/workbenches");
expect(await outside.text()).toBe("<html>shell</html>");
});

Expand Down
29 changes: 12 additions & 17 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading