From ac0f91be83569c04b84c15db948b239a96dfce6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:43:50 -0400 Subject: [PATCH 1/4] Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows (#1893) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 4.1.7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v2...v4.1.7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: danoswaltCL <97542869+danoswaltCL@users.noreply.github.com> Co-authored-by: Zack Lee <90279765+zackcl@users.noreply.github.com> --- .github/workflows/create-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 9ddaad3f90..32c154adc4 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -158,7 +158,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Download all workflow run artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.7 - uses: ncipollo/release-action@v1 with: artifacts: "**/upgrade-*.zip" From 8c892eb925864582dbeaa4228984fe1780adcc9f Mon Sep 17 00:00:00 2001 From: Vivek Fitkariwala Date: Mon, 7 Oct 2024 20:15:15 +0530 Subject: [PATCH 2/4] Decoupling join and paginated query --- .../src/api/services/FeatureFlagService.ts | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/backend/packages/Upgrade/src/api/services/FeatureFlagService.ts b/backend/packages/Upgrade/src/api/services/FeatureFlagService.ts index f2654e0639..79963fda7d 100644 --- a/backend/packages/Upgrade/src/api/services/FeatureFlagService.ts +++ b/backend/packages/Upgrade/src/api/services/FeatureFlagService.ts @@ -163,7 +163,7 @@ export class FeatureFlagService { return this.featureFlagRepository.count(); } - public findPaginated( + public async findPaginated( skip: number, take: number, logger: UpgradeLogger, @@ -172,10 +172,7 @@ export class FeatureFlagService { ): Promise { logger.info({ message: 'Find paginated Feature flags' }); - let queryBuilder = this.featureFlagRepository - .createQueryBuilder('feature_flag') - .leftJoinAndSelect('feature_flag.featureFlagSegmentInclusion', 'featureFlagSegmentInclusion') - .loadRelationCountAndMap('feature_flag.featureFlagExposures', 'feature_flag.featureFlagExposures'); + let queryBuilder = this.featureFlagRepository.createQueryBuilder('feature_flag'); if (searchParams) { const customSearchString = searchParams.string.split(' ').join(`:*&`); // add search query @@ -194,7 +191,24 @@ export class FeatureFlagService { // TODO: the type of queryBuilder.getMany() is Promise // However, the above query returns Promise<(Omit & { featureFlagExposures: number })[]> // This can be fixed by using a @VirtualColumn in the FeatureFlag entity, when we are on TypeORM 0.3 - return queryBuilder.getMany(); + const result = await queryBuilder.getMany(); + + // Get the feature flag ids + const featureFlagIds = result.map(({ id }) => id); + + // Get the relevant segment inclusion documents + const featureFlagWithInclusionSegments = await this.featureFlagRepository.find({ + select: ['id', 'featureFlagSegmentInclusion'], + where: { id: In(featureFlagIds) }, + relations: ['featureFlagSegmentInclusion'], + }); + + // Add the inclusion documents to the result + return result.map((result) => ({ + ...result, + featureFlagSegmentInclusion: featureFlagWithInclusionSegments.find(({ id }) => id === result.id) + .featureFlagSegmentInclusion, + })); } public async delete( From 47743d9601c88c7cb66045d9250aae41cdc44f79 Mon Sep 17 00:00:00 2001 From: pratik Date: Wed, 9 Oct 2024 15:06:35 +0530 Subject: [PATCH 3/4] adding exposures to the feature flag paginated query --- .../src/api/services/FeatureFlagService.ts | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/backend/packages/Upgrade/src/api/services/FeatureFlagService.ts b/backend/packages/Upgrade/src/api/services/FeatureFlagService.ts index 79963fda7d..a83d146315 100644 --- a/backend/packages/Upgrade/src/api/services/FeatureFlagService.ts +++ b/backend/packages/Upgrade/src/api/services/FeatureFlagService.ts @@ -191,10 +191,12 @@ export class FeatureFlagService { // TODO: the type of queryBuilder.getMany() is Promise // However, the above query returns Promise<(Omit & { featureFlagExposures: number })[]> // This can be fixed by using a @VirtualColumn in the FeatureFlag entity, when we are on TypeORM 0.3 - const result = await queryBuilder.getMany(); + const featureFlagsWithExposures = await queryBuilder + .loadRelationCountAndMap('feature_flag.featureFlagExposures', 'feature_flag.featureFlagExposures') + .getMany(); // Get the feature flag ids - const featureFlagIds = result.map(({ id }) => id); + const featureFlagIds = featureFlagsWithExposures.map(({ id }) => id); // Get the relevant segment inclusion documents const featureFlagWithInclusionSegments = await this.featureFlagRepository.find({ @@ -203,12 +205,20 @@ export class FeatureFlagService { relations: ['featureFlagSegmentInclusion'], }); - // Add the inclusion documents to the result - return result.map((result) => ({ - ...result, - featureFlagSegmentInclusion: featureFlagWithInclusionSegments.find(({ id }) => id === result.id) - .featureFlagSegmentInclusion, - })); + // Add the inclusion documents to the featureFlagsWithExposures + return featureFlagsWithExposures.map((featureFlag) => { + // Find the matching featureFlagSegmentInclusion for the current item + const inclusionSegment = featureFlagWithInclusionSegments.find( + ({ id }) => id === featureFlag.id + )?.featureFlagSegmentInclusion; + + // Construct the new object with conditional properties + return { + ...featureFlag, + // Only include featureFlagSegmentInclusion if inclusionSegment is defined and not empty + ...(inclusionSegment && inclusionSegment.length > 0 ? { featureFlagSegmentInclusion: inclusionSegment } : {}), + }; + }); } public async delete( From 6ccf80bbf5d6b50b4ed8cdd399c7cab0feffa14e Mon Sep 17 00:00:00 2001 From: pratik Date: Wed, 9 Oct 2024 18:26:10 +0530 Subject: [PATCH 4/4] v6-pre-release version update --- backend/package.json | 2 +- backend/packages/Scheduler/package.json | 2 +- backend/packages/Upgrade/package.json | 2 +- clientlibs/java/pom.xml | 2 +- clientlibs/js/package.json | 2 +- frontend/package.json | 2 +- package.json | 2 +- types/package.json | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/package.json b/backend/package.json index 33abc995d6..c8cd8ee4ac 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "ab_testing_backend", - "version": "6.0.0-prerelease.1", + "version": "6.0.0-prerelease.2", "description": "Backend for A/B Testing Project", "scripts": { "install:all": "npm ci && cd packages/Scheduler && npm ci && cd ../Upgrade && npm ci", diff --git a/backend/packages/Scheduler/package.json b/backend/packages/Scheduler/package.json index c4fa82a66b..3fda044e9e 100644 --- a/backend/packages/Scheduler/package.json +++ b/backend/packages/Scheduler/package.json @@ -1,6 +1,6 @@ { "name": "ppl-upgrade-serverless", - "version": "6.0.0-prerelease.1", + "version": "6.0.0-prerelease.2", "description": "Serverless webpack example using Typescript", "main": "handler.js", "scripts": { diff --git a/backend/packages/Upgrade/package.json b/backend/packages/Upgrade/package.json index e54b774353..7564dd467f 100644 --- a/backend/packages/Upgrade/package.json +++ b/backend/packages/Upgrade/package.json @@ -1,6 +1,6 @@ { "name": "ab_testing_backend", - "version": "6.0.0-prerelease.1", + "version": "6.0.0-prerelease.2", "description": "Backend for A/B Testing Project", "main": "index.js", "scripts": { diff --git a/clientlibs/java/pom.xml b/clientlibs/java/pom.xml index 6da31f6226..a6675ada40 100644 --- a/clientlibs/java/pom.xml +++ b/clientlibs/java/pom.xml @@ -9,7 +9,7 @@ at the same time that happen to rev to the same new version will be caught by a merge conflict. --> - 6.0.0-prelease.0-prerelease.1 + 6.0.0-prelease.0-prerelease.2 diff --git a/clientlibs/js/package.json b/clientlibs/js/package.json index 7c04a1f0f9..e727a222d5 100644 --- a/clientlibs/js/package.json +++ b/clientlibs/js/package.json @@ -1,6 +1,6 @@ { "name": "upgrade_client_lib", - "version": "6.0.0-prerelease.1", + "version": "6.0.0-prerelease.2", "description": "Client library to communicate with the Upgrade server", "files": [ "dist/*" diff --git a/frontend/package.json b/frontend/package.json index fab355427d..7ce540d630 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "ab-testing", - "version": "6.0.0-prerelease.1", + "version": "6.0.0-prerelease.2", "license": "MIT", "scripts": { "ng": "ng", diff --git a/package.json b/package.json index a813ee2c95..f18ca4826f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "UpGrade", - "version": "6.0.0-prerelease.1", + "version": "6.0.0-prerelease.2", "description": "This is a combined repository for UpGrade, an open-source platform to support large-scale A/B testing in educational applications. Learn more at www.upgradeplatform.org", "main": "index.js", "devDependencies": { diff --git a/types/package.json b/types/package.json index f4488fa6cf..b655e034b3 100644 --- a/types/package.json +++ b/types/package.json @@ -1,6 +1,6 @@ { "name": "upgrade_types", - "version": "6.0.0-prerelease.1", + "version": "6.0.0-prerelease.2", "description": "", "main": "src/index.ts", "types": "src/index.ts",