Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(mcp): end live sessions again when documents is switched off

Maurice4498f68cc9bf
diff --git a/server/src/addons.ts b/server/src/addons.ts
index 23a53713b..c4c45da04 100644
--- a/server/src/addons.ts
+++ b/server/src/addons.ts
@@ -44,6 +44,7 @@ export const MCP_GATED_ADDON_IDS: readonly AddonId[] = [
ADDON_IDS.COLLAB,
ADDON_IDS.COLLECTIONS,
ADDON_IDS.DAWARICH,
+ ADDON_IDS.DOCUMENTS,
ADDON_IDS.JOURNEY,
ADDON_IDS.PACKING,
ADDON_IDS.ROADTRIP,
diff --git a/server/tests/unit/nest/admin.service.test.ts b/server/tests/unit/nest/admin.service.test.ts
index e17ad7f90..3c9a40b3a 100644
--- a/server/tests/unit/nest/admin.service.test.ts
+++ b/server/tests/unit/nest/admin.service.test.ts
@@ -749,8 +749,8 @@ describe('updateAddon', () => {
if (!flip.error) expect(flip.mcpAffected).toBe(false);
}
- // documents left the list once its file tools stayed on without it
- expect(((await updateAddon('documents', { enabled: false })) as any).mcpAffected).toBe(false);
+ // the doc-sync tools gate on documents, so its flip ends the sessions too
+ expect(((await updateAddon('documents', { enabled: false })) as any).mcpAffected).toBe(true);
});
it('ADMIN-SVC-087 — refuses to enable a photo provider while journey is off', async () => {
diff --git a/server/tests/unit/nest/mcp-gated-addons.parity.test.ts b/server/tests/unit/nest/mcp-gated-addons.parity.test.ts
index 5cc99d9e5..f036eeebe 100644
--- a/server/tests/unit/nest/mcp-gated-addons.parity.test.ts
+++ b/server/tests/unit/nest/mcp-gated-addons.parity.test.ts
@@ -29,13 +29,13 @@ function walk(dir: string): string[] {
});
}
-/** Every addon id named by an addonGate(...) or collabFeatureGate(...) call. */
+/** Every addon id named by an addonGate(...), instanceAddonGate(...) or collabFeatureGate(...) call. */
function gatedInSource(): { ids: Set<string>; where: Map<string, string[]> } {
const ids = new Set<string>();
const where = new Map<string, string[]>();
for (const file of walk(SRC)) {
const text = readFileSync(file, 'utf8');
- for (const m of text.matchAll(/\baddonGate\(\s*ADDON_IDS\.([A-Z_]+)\s*\)/g)) {
+ for (const m of text.matchAll(/\b(?:addonGate|instanceAddonGate)\(\s*ADDON_IDS\.([A-Z_]+)\s*\)/g)) {
const id = (ADDON_IDS as Record<string, string>)[m[1]];
if (!id) continue;
ids.add(id);
@@ -77,5 +77,6 @@ describe('MCP-gated addons', () => {
const { ids } = gatedInSource();
expect(ids.size).toBeGreaterThanOrEqual(5);
expect(ids.has(ADDON_IDS.ROADTRIP)).toBe(true);
+ expect(ids.has(ADDON_IDS.DOCUMENTS)).toBe(true);
});
});