Move the enrichment switch to the domain that owns the places flags

This commit is contained in:
Maurice
2026-08-10 11:07:21 +02:00
committed by Maurice
parent e3b220603c
commit 92e4eaa476
5 changed files with 72 additions and 19 deletions
@@ -41,6 +41,9 @@ const addonsStub = () => ({
updatePlacesAutocomplete: vi.fn((enabled: boolean) => ({ enabled })),
getPlacesDetails: vi.fn(() => ({ enabled: false })),
updatePlacesDetails: vi.fn((enabled: boolean) => ({ enabled })),
// Fail-open, unlike its three neighbours — see AddonsService.getPlacesEnrich.
getPlacesEnrich: vi.fn(() => ({ enabled: true })),
updatePlacesEnrich: vi.fn((enabled: boolean) => ({ enabled })),
getCollabFeatures: vi.fn(() => ({ chat: false })),
updateCollabFeatures: vi.fn(() => ({ features: { chat: true }, changed: true })),
}) as unknown as AddonsService;
@@ -242,9 +245,16 @@ describe('AdminController feature toggles', () => {
expect(c.getPlacesPhotos()).toEqual({ enabled: false });
expect(c.getPlacesAutocomplete()).toEqual({ enabled: false });
expect(c.getPlacesDetails()).toEqual({ enabled: false });
expect(c.getPlacesEnrich()).toEqual({ enabled: true });
expect(c.getCollabFeatures()).toEqual({ chat: false });
});
it('ADMIN-TOGGLE-002b places-enrich updates through the addons domain and is audited', () => {
const c = adminCtl(svc());
expect(c.updatePlacesEnrich(user, { enabled: false }, req)).toEqual({ enabled: false });
expect(writeAudit).toHaveBeenCalledWith(expect.objectContaining({ action: 'admin.places_enrich' }));
});
it('ADMIN-TOGGLE-003 collab-features invalidates MCP sessions only when a flag flipped (#1414)', () => {
const invalidateMcpSessions = vi.fn();
const c = adminCtl(svc({ invalidateMcpSessions } as Partial<AdminService>));