diff --git a/packages/kill-switch-client/src/index.test.ts b/packages/kill-switch-client/src/index.test.ts index 7ac17a3e..c39084f3 100644 --- a/packages/kill-switch-client/src/index.test.ts +++ b/packages/kill-switch-client/src/index.test.ts @@ -79,7 +79,7 @@ describe('createKillSwitchClient', () => { await ks.check(); expect(fetchMock).toHaveBeenCalledWith( - expect.stringContaining('/flags/kill-switch'), + expect.stringContaining('/settings/kill-switch'), expect.objectContaining({ headers: expect.objectContaining({ 'x-product-id': 'testapp' }), }) diff --git a/packages/kill-switch-client/src/index.ts b/packages/kill-switch-client/src/index.ts index e41339d5..de7bafab 100644 --- a/packages/kill-switch-client/src/index.ts +++ b/packages/kill-switch-client/src/index.ts @@ -1,7 +1,7 @@ /** * Browser/React Native-safe kill switch client for platform-service. * - * Checks GET /api/flags/kill-switch to determine if the app is disabled. + * Checks GET /api/settings/kill-switch to determine if the app is disabled. * Fail-open: returns { disabled: false } on any network error. * * @example @@ -49,8 +49,15 @@ export function createKillSwitchClient(config: KillSwitchClientConfig): KillSwit ? globalThis.crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`; + // Endpoint lives under /settings/kill-switch in platform-service's + // settings module (no auth required). The route reads the + // `kill_switch` feature flag from the flags container and returns + // { enabled, disabled, message }. Older versions of this client + // pointed at /flags/kill-switch which does not exist; that bug + // was masked by fail-open behavior on 404 but produced noisy + // 404s on every page load. const res = await globalThis.fetch( - `${baseUrl}/flags/kill-switch?platform=${encodeURIComponent(platform)}`, + `${baseUrl}/settings/kill-switch?platform=${encodeURIComponent(platform)}&productId=${encodeURIComponent(productId)}`, { headers: { 'x-product-id': productId, 'x-request-id': requestId }, }