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.
This commit is contained in:
Maurice
2026-11-23 19:56:08 +01:00
parent 429a2fb017
commit 4498f68cc9
3 changed files with 6 additions and 4 deletions
+1
View File
@@ -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,
+2 -2
View File
@@ -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 () => {
@@ -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);
});
});