From 4498f68cc9bf6891724e0d0e77d093bffa0b2870 Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 23 Nov 2026 19:56:08 +0100 Subject: [PATCH] fix(mcp): end live sessions again when documents is switched off The doc-sync tools still gate on documents through instanceAddonGate, which the parity scan did not see, so documents is back on the list and the scan now reads that gate too. --- server/src/addons.ts | 1 + server/tests/unit/nest/admin.service.test.ts | 4 ++-- server/tests/unit/nest/mcp-gated-addons.parity.test.ts | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) 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; where: Map } { const ids = new Set(); const where = new Map(); 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)[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); }); });