diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 958791659..75fd26501 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,19 +38,19 @@ jobs: services: flagd: - image: ghcr.io/open-feature/flagd-testbed:v0.4.11 + image: ghcr.io/open-feature/flagd-testbed:v0.5.1 ports: - 8013:8013 flagd-unstable: - image: ghcr.io/open-feature/flagd-testbed-unstable:v0.4.11 + image: ghcr.io/open-feature/flagd-testbed-unstable:v0.5.1 ports: - 8014:8013 sync: - image: ghcr.io/open-feature/sync-testbed:v0.4.11 + image: ghcr.io/open-feature/sync-testbed:v0.5.1 ports: - 9090:9090 sync-unstable: - image: ghcr.io/open-feature/sync-testbed-unstable:v0.4.11 + image: ghcr.io/open-feature/sync-testbed-unstable:v0.5.1 ports: - 9091:9090 diff --git a/libs/providers/flagd-web/src/lib/flagd-web-provider.spec.ts b/libs/providers/flagd-web/src/lib/flagd-web-provider.spec.ts index 943afa22d..4a5b4156e 100644 --- a/libs/providers/flagd-web/src/lib/flagd-web-provider.spec.ts +++ b/libs/providers/flagd-web/src/lib/flagd-web-provider.spec.ts @@ -10,8 +10,8 @@ import { StandardResolutionReasons, } from '@openfeature/web-sdk'; import fetchMock from 'jest-fetch-mock'; -import { Service } from '../proto/ts/schema/v1/schema_connect'; -import { AnyFlag, EventStreamResponse, ResolveAllResponse } from '../proto/ts/schema/v1/schema_pb'; +import { Service } from '../proto/ts/flagd/evaluation/v1/evaluation_connect'; +import { AnyFlag, EventStreamResponse, ResolveAllResponse } from '../proto/ts/flagd/evaluation/v1/evaluation_pb'; import { FlagdWebProvider } from './flagd-web-provider'; const EVENT_CONFIGURATION_CHANGE = 'configuration_change'; diff --git a/libs/providers/flagd-web/src/lib/flagd-web-provider.ts b/libs/providers/flagd-web/src/lib/flagd-web-provider.ts index b1bd6354f..4558864b0 100644 --- a/libs/providers/flagd-web/src/lib/flagd-web-provider.ts +++ b/libs/providers/flagd-web/src/lib/flagd-web-provider.ts @@ -16,8 +16,8 @@ import { StandardResolutionReasons, TypeMismatchError, } from '@openfeature/web-sdk'; -import { Service } from '../proto/ts/schema/v1/schema_connect'; -import { AnyFlag } from '../proto/ts/schema/v1/schema_pb'; +import { Service } from '../proto/ts/flagd/evaluation/v1/evaluation_connect'; +import { AnyFlag } from '../proto/ts/flagd/evaluation/v1/evaluation_pb'; import { FlagdProviderOptions, getOptions } from './options'; export const ERROR_DISABLED = 'DISABLED'; diff --git a/libs/providers/flagd/schemas b/libs/providers/flagd/schemas index 6a1e94c36..255224792 160000 --- a/libs/providers/flagd/schemas +++ b/libs/providers/flagd/schemas @@ -1 +1 @@ -Subproject commit 6a1e94c36c2fa170dbdbb5215d0afe5c99b41996 +Subproject commit 255224792987875f34bc3254cbe7e1b415412714 diff --git a/libs/providers/flagd/src/e2e/step-definitions/flagd.spec.ts b/libs/providers/flagd/src/e2e/step-definitions/flagd.spec.ts index 1b7bc86e6..783d5f62c 100644 --- a/libs/providers/flagd/src/e2e/step-definitions/flagd.spec.ts +++ b/libs/providers/flagd/src/e2e/step-definitions/flagd.spec.ts @@ -38,13 +38,17 @@ defineFeature(feature, (test) => { test('Flag change event', ({ given, when, and, then }) => { let ran = false; - let eventDetails: EventDetails | undefined; + let flagsChanged: string[]; aFlagProviderIsSet(given); when('a PROVIDER_CONFIGURATION_CHANGED handler is added', () => { client.addHandler(ProviderEvents.ConfigurationChanged, async (details) => { ran = true; - eventDetails = details; + // file writes are not atomic, so we get a few events in quick succession from the testbed + // some will not contain changes, this tolerates that; at least 1 should have our change + if (details?.flagsChanged?.length) { + flagsChanged = details?.flagsChanged; + } }); }); and(/^a flag with key "(.*)" is modified$/, async () => { @@ -55,7 +59,7 @@ defineFeature(feature, (test) => { expect(ran).toBeTruthy(); }); and(/^the event details must indicate "(.*)" was altered$/, (flagName) => { - expect(eventDetails?.flagsChanged).toContain(flagName); + expect(flagsChanged).toContain(flagName); }); }); diff --git a/libs/providers/flagd/src/lib/flagd-provider.spec.ts b/libs/providers/flagd/src/lib/flagd-provider.spec.ts index 6747f645d..66d52b18a 100644 --- a/libs/providers/flagd/src/lib/flagd-provider.spec.ts +++ b/libs/providers/flagd/src/lib/flagd-provider.spec.ts @@ -24,7 +24,7 @@ import { ResolveStringRequest, ResolveStringResponse, ServiceClient, -} from '../proto/ts/schema/v1/schema'; +} from '../proto/ts/flagd/evaluation/v1/evaluation'; import { EVENT_CONFIGURATION_CHANGE, EVENT_PROVIDER_READY } from './constants'; import { FlagdProvider } from './flagd-provider'; import { FlagChangeMessage, GRPCService } from './service/grpc/grpc-service'; diff --git a/libs/providers/flagd/src/lib/service/grpc/grpc-service.ts b/libs/providers/flagd/src/lib/service/grpc/grpc-service.ts index a76a5c2c2..dc45c290f 100644 --- a/libs/providers/flagd/src/lib/service/grpc/grpc-service.ts +++ b/libs/providers/flagd/src/lib/service/grpc/grpc-service.ts @@ -27,7 +27,7 @@ import { ResolveStringRequest, ResolveStringResponse, ServiceClient, -} from '../../../proto/ts/schema/v1/schema'; +} from '../../../proto/ts/flagd/evaluation/v1/evaluation'; import { Config } from '../../configuration'; import { DEFAULT_MAX_CACHE_SIZE, EVENT_CONFIGURATION_CHANGE, EVENT_PROVIDER_READY } from '../../constants'; import { FlagdProvider } from '../../flagd-provider'; diff --git a/libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.spec.ts b/libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.spec.ts index b0ff56d26..5568f6c3b 100644 --- a/libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.spec.ts +++ b/libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.spec.ts @@ -1,6 +1,6 @@ import { GrpcFetch } from './grpc-fetch'; import { Config } from '../../../configuration'; -import { FlagSyncServiceClient, SyncFlagsResponse, SyncState } from '../../../../proto/ts/sync/v1/sync_service'; +import { FlagSyncServiceClient, SyncFlagsResponse } from '../../../../proto/ts/flagd/sync/v1/sync'; import { ConnectivityState } from '@grpc/grpc-js/build/src/connectivity-state'; let watchStateCallback: () => void = () => ({}); @@ -70,7 +70,7 @@ describe('grpc fetch', () => { done(err); }); - onDataCallback({ flagConfiguration, state: SyncState.SYNC_STATE_ALL }); + onDataCallback({ flagConfiguration }); }); it('should handle data sync reconnection', (done) => { @@ -86,13 +86,13 @@ describe('grpc fetch', () => { .then(() => { try { // Updated flags - onDataCallback({ flagConfiguration: updatedFlagConfig, state: SyncState.SYNC_STATE_ALL }); + onDataCallback({ flagConfiguration: updatedFlagConfig }); // Stream error onErrorCallback(new Error('Some connection error')); // Force clearing watchStateCallback(); // Reconnect - onDataCallback({ flagConfiguration: reconnectFlagConfig, state: SyncState.SYNC_STATE_ALL }); + onDataCallback({ flagConfiguration: reconnectFlagConfig }); // Callback assertions expect(dataCallback).toHaveBeenCalledTimes(3); @@ -117,7 +117,7 @@ describe('grpc fetch', () => { dataCallback.mockReturnValue(['test']); // First connection - onDataCallback({ flagConfiguration: initFlagConfig, state: SyncState.SYNC_STATE_ALL }); + onDataCallback({ flagConfiguration: initFlagConfig }); }); it('should handle error and watch channel for reconnect', (done) => { diff --git a/libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.ts b/libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.ts index 34540a74f..a4b231262 100644 --- a/libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.ts +++ b/libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.ts @@ -1,7 +1,7 @@ import { ClientReadableStream, ServiceError, credentials } from '@grpc/grpc-js'; import { Logger } from '@openfeature/core'; import { GeneralError } from '@openfeature/server-sdk'; -import { FlagSyncServiceClient, SyncFlagsRequest, SyncFlagsResponse } from '../../../../proto/ts/sync/v1/sync_service'; +import { FlagSyncServiceClient, SyncFlagsRequest, SyncFlagsResponse } from '../../../../proto/ts/flagd/sync/v1/sync'; import { Config } from '../../../configuration'; import { DataFetch } from '../data-fetch'; import { closeStreamIfDefined } from '../../common';