Skip to content
Closed
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
24 changes: 24 additions & 0 deletions apps/loopover-miner-ui/src/vite-chat-action-plugins.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { describe, expect, it } from "vitest";

import { chatDiscoverAttemptActionsPlugin } from "../vite-chat-discover-attempt-actions";
import { chatGovernorActionsPlugin } from "../vite-chat-governor-actions";

// #7228: the app's documented persistent-service path (README + systemd/loopover-miner-ui.service.example) runs
// `npm run build && npm run preview`, and `vite preview` fires ONLY `configurePreviewServer`, never
// `configureServer`. These two chat-action plugins used to implement `configureServer` alone, so their governor
// and discover/attempt actions were silently unregistered in production — unlike every sibling vite-*-api.ts
// plugin, which registers for both hooks. Lock in that both plugins now wire both hooks.
describe("chat-action vite plugins register for dev AND preview servers (#7228)", () => {
const cases = [
["chatGovernorActionsPlugin", chatGovernorActionsPlugin],
["chatDiscoverAttemptActionsPlugin", chatDiscoverAttemptActionsPlugin],
] as const;

for (const [label, factory] of cases) {
it(`${label} implements both configureServer and configurePreviewServer`, () => {
const plugin = factory();
expect(plugin.configureServer).toBeTypeOf("function");
expect(plugin.configurePreviewServer).toBeTypeOf("function");
});
}
});
15 changes: 12 additions & 3 deletions apps/loopover-miner-ui/vite-chat-discover-attempt-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ import type { Plugin } from "vite";
// vite-chat-governor-actions.ts).

export function chatDiscoverAttemptActionsPlugin(): Plugin {
// Register on BOTH dev (`configureServer`) and preview (`configurePreviewServer`) start — `vite preview` (the
// persistent-service path in this app's README and systemd unit) only runs the preview hook, so without it
// these actions were silently missing in production, unlike every sibling vite-*-api.ts plugin (#7228).
const register = () => {
void import("./src/lib/chat-discover-attempt-actions").then((mod) => {
mod.registerDiscoverAttemptChatActions();
});
};
return {
name: "loopover-miner-chat-discover-attempt-actions",
configureServer() {
void import("./src/lib/chat-discover-attempt-actions").then((mod) => {
mod.registerDiscoverAttemptChatActions();
});
register();
},
configurePreviewServer() {
register();
},
};
}
16 changes: 13 additions & 3 deletions apps/loopover-miner-ui/vite-chat-governor-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ import type { Plugin } from "vite";
// buttons. No new /api/governor/* route is added here.

export function chatGovernorActionsPlugin(): Plugin {
// Register into the shared registry on BOTH dev (`configureServer`) and preview (`configurePreviewServer`)
// start. `vite preview` — the persistent-service path in this app's README and systemd unit — only runs the
// preview hook, so without it these actions were silently missing in production, unlike every sibling
// vite-*-api.ts plugin (which registers for both) (#7228).
const register = () => {
void import("./src/lib/chat-governor-actions").then((mod) => {
mod.registerGovernorChatActions();
});
};
return {
name: "loopover-miner-chat-governor-actions",
configureServer() {
void import("./src/lib/chat-governor-actions").then((mod) => {
mod.registerGovernorChatActions();
});
register();
},
configurePreviewServer() {
register();
},
};
}
Loading