From b93b8e3af24aaaf4480d4b030ae52275dfa19d24 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Wed, 13 Nov 2024 01:05:40 +0200 Subject: [PATCH 01/20] ci: fix WP Core tests (#5986) * ci: fix WP Core tests * fix: copy `.env.example` to `.env` --- .github/workflows/core-tests.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/core-tests.yml b/.github/workflows/core-tests.yml index ab441d1dc5..ce8d987077 100644 --- a/.github/workflows/core-tests.yml +++ b/.github/workflows/core-tests.yml @@ -20,10 +20,13 @@ permissions: contents: read env: - LOCAL_PHP: "8.0-fpm" + LOCAL_PHP: "8.2-fpm" + LOCAL_PHP_XDEBUG: "false" + LOCAL_PHP_XDEBUG_MODE: "develop,debug" LOCAL_DB_TYPE: "mysql" - LOCAL_DB_VERSION: "8.0" + LOCAL_DB_VERSION: "8.3" LOCAL_PHP_MEMCACHED: "true" + LOCAL_WP_TESTS_DOMAIN: "example.org" PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" jobs: @@ -57,6 +60,7 @@ jobs: - name: Tweaks run: | echo "define( 'VIP_JETPACK_SKIP_LOAD', 'true' );" >> "wordpress/src/wp-content/mu-plugins/000-vip-init.php" + cp wordpress/.env.example wordpress/.env echo "GITHUB_EVENT_NAME=pull_request" >> "wordpress/.env" - name: Set up Node.js @@ -72,17 +76,10 @@ jobs: php-version: 8.0 coverage: none - # - name: Install Composer dependencies - # uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0 - # with: - # working-directory: wordpress - name: Install Composer dependencies - run: composer install -n - working-directory: wordpress - - # - name: Downgrade PHPUnit - # run: composer require --dev -n phpunit/phpunit:^9 - # working-directory: wordpress + uses: ramsey/composer-install@3.0.0 + with: + working-directory: wordpress - name: Install npm dependencies run: npm ci From 5a6d8f5028d04e6a25c83325d3443c367b7e8e8e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:06:39 -0700 Subject: [PATCH 02/20] chore(deps): Bump react-select from 5.8.1 to 5.8.3 (#5982) Bumps [react-select](https://github.com/JedWatson/react-select) from 5.8.1 to 5.8.3. - [Release notes](https://github.com/JedWatson/react-select/releases) - [Changelog](https://github.com/JedWatson/react-select/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/JedWatson/react-select/compare/react-select@5.8.1...react-select@5.8.3) --- updated-dependencies: - dependency-name: react-select dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 05ca835122..df1a081d7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23386,9 +23386,9 @@ } }, "node_modules/react-select": { - "version": "5.8.1", - "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.8.1.tgz", - "integrity": "sha512-RT1CJmuc+ejqm5MPgzyZujqDskdvB9a9ZqrdnVLsvAHjJ3Tj0hELnLeVPQlmYdVKCdCpxanepl6z7R5KhXhWzg==", + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.8.3.tgz", + "integrity": "sha512-lVswnIq8/iTj1db7XCG74M/3fbGB6ZaluCzvwPGT5ZOjCdL/k0CLWhEK0vCBLuU5bHTEf6Gj8jtSvi+3v+tO1w==", "dependencies": { "@babel/runtime": "^7.12.0", "@emotion/cache": "^11.4.0", From 4b89952890d2be92fbffee32725cd51896bcd094 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:07:06 -0700 Subject: [PATCH 03/20] chore(deps): Bump github/codeql-action from 3.27.0 to 3.27.1 (#5981) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.0 to 3.27.1. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v3.27.0...v3.27.1) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 340c2cb41f..a05889a907 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,10 +32,10 @@ jobs: uses: actions/checkout@v4.2.2 - name: Initialize CodeQL - uses: github/codeql-action/init@v3.27.0 + uses: github/codeql-action/init@v3.27.1 with: languages: ${{ matrix.language }} config-file: ./.github/codeql-config.yml - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3.27.0 + uses: github/codeql-action/analyze@v3.27.1 From e1a9b6fff0d3cc0f23631cae73a868920fa5c223 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 03:15:29 +0200 Subject: [PATCH 04/20] chore(deps-dev): Bump eslint-plugin-playwright in /__tests__/e2e (#5980) Bumps [eslint-plugin-playwright](https://github.com/playwright-community/eslint-plugin-playwright) from 1.8.1 to 2.0.1. - [Release notes](https://github.com/playwright-community/eslint-plugin-playwright/releases) - [Changelog](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/CHANGELOG.md) - [Commits](https://github.com/playwright-community/eslint-plugin-playwright/compare/v1.8.1...v2.0.1) --- updated-dependencies: - dependency-name: eslint-plugin-playwright dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- __tests__/e2e/package-lock.json | 16 +++++----------- __tests__/e2e/package.json | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/__tests__/e2e/package-lock.json b/__tests__/e2e/package-lock.json index bbe27a5fd5..89d398d708 100644 --- a/__tests__/e2e/package-lock.json +++ b/__tests__/e2e/package-lock.json @@ -15,7 +15,7 @@ "asana-phrase": "^0.0.8", "eslint": "^8.51.0", "eslint-plugin-deprecation": "^3.0.0", - "eslint-plugin-playwright": "^1.0.1", + "eslint-plugin-playwright": "^2.0.1", "typescript": "^5.2.2" } }, @@ -2200,9 +2200,9 @@ } }, "node_modules/eslint-plugin-playwright": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-playwright/-/eslint-plugin-playwright-1.8.1.tgz", - "integrity": "sha512-wzT8rUFOXN6ztRVHSAZI0QpQnxY7bbvcu2z+C/giy3zrkL8WlsFQCv7NillgLBhWnr7oZjC5Pax/GMAJmZlWHA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-playwright/-/eslint-plugin-playwright-2.0.1.tgz", + "integrity": "sha512-f4a73xgCOK5Ug/5dtC82BVvND62lLqlMqgGkZn42teyvk6ccSyybHZXRHkpE7vKZSCjV57bnbR+3ucwItOhXlA==", "dev": true, "dependencies": { "globals": "^13.23.0" @@ -2211,13 +2211,7 @@ "node": ">=16.6.0" }, "peerDependencies": { - "eslint": ">=8.40.0", - "eslint-plugin-jest": ">=25" - }, - "peerDependenciesMeta": { - "eslint-plugin-jest": { - "optional": true - } + "eslint": ">=8.40.0" } }, "node_modules/eslint-plugin-prettier": { diff --git a/__tests__/e2e/package.json b/__tests__/e2e/package.json index 053fecd01e..e7d2304f1c 100644 --- a/__tests__/e2e/package.json +++ b/__tests__/e2e/package.json @@ -18,7 +18,7 @@ "asana-phrase": "^0.0.8", "eslint": "^8.51.0", "eslint-plugin-deprecation": "^3.0.0", - "eslint-plugin-playwright": "^1.0.1", + "eslint-plugin-playwright": "^2.0.1", "typescript": "^5.2.2" } } From a5b231ce3f3e1f91050d8374e5c38793c3cef622 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 03:28:59 +0200 Subject: [PATCH 05/20] chore(deps-dev): Bump @types/node in /__tests__/e2e (#5979) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.7.7 to 22.9.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- __tests__/e2e/package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/__tests__/e2e/package-lock.json b/__tests__/e2e/package-lock.json index 89d398d708..1bab4b27c8 100644 --- a/__tests__/e2e/package-lock.json +++ b/__tests__/e2e/package-lock.json @@ -714,12 +714,12 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.7.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.7.tgz", - "integrity": "sha512-SRxCrrg9CL/y54aiMCG3edPKdprgMVGDXjA3gB8UmmBW5TcXzRUYAh8EWzTnSJFAd1rgImPELza+A3bJ+qxz8Q==", + "version": "22.9.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz", + "integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==", "dev": true, "dependencies": { - "undici-types": "~6.19.2" + "undici-types": "~6.19.8" } }, "node_modules/@typescript-eslint/eslint-plugin": { From 6c1bdd8e0cbdde848d742d06b6db29246144ca2e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 04:05:19 +0200 Subject: [PATCH 06/20] chore(deps): Bump sjinks/setup-wordpress-test-library (#5987) Bumps [sjinks/setup-wordpress-test-library](https://github.com/sjinks/setup-wordpress-test-library) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/sjinks/setup-wordpress-test-library/releases) - [Commits](https://github.com/sjinks/setup-wordpress-test-library/compare/v2.1.1...v2.1.2) --- updated-dependencies: - dependency-name: sjinks/setup-wordpress-test-library dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/actions/run-wp-tests/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/run-wp-tests/action.yml b/.github/actions/run-wp-tests/action.yml index 5e7c270d10..be9695e228 100644 --- a/.github/actions/run-wp-tests/action.yml +++ b/.github/actions/run-wp-tests/action.yml @@ -80,7 +80,7 @@ runs: uses: ramsey/composer-install@3.0.0 - name: Set up WordPress and WordPress Test Library - uses: sjinks/setup-wordpress-test-library@v2.1.1 + uses: sjinks/setup-wordpress-test-library@v2.1.2 with: version: ${{ inputs.wordpress }} From 8fb8751ac61e506c38dfb701f6cb4be682ad9f7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:10:20 +0200 Subject: [PATCH 07/20] chore(deps): Bump actions/dependency-review-action from 4.3.4 to 4.4.0 (#5951) Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.3.4 to 4.4.0. - [Release notes](https://github.com/actions/dependency-review-action/releases) - [Commits](https://github.com/actions/dependency-review-action/compare/v4.3.4...v4.4.0) --- updated-dependencies: - dependency-name: actions/dependency-review-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 3f4d6d545c..09fcc41244 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -25,4 +25,4 @@ jobs: uses: actions/checkout@v4.2.2 - name: Review dependencies - uses: actions/dependency-review-action@v4.3.4 + uses: actions/dependency-review-action@v4.4.0 From f1339bb837adb9bac94ddab46325c4b74e9ae0b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:11:55 +0200 Subject: [PATCH 08/20] chore(deps): Bump actions/checkout in /.github/actions/prepare-source (#5960) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.1 to 4.2.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4.2.1...v4.2.2) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/actions/prepare-source/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/prepare-source/action.yml b/.github/actions/prepare-source/action.yml index 03aa0e4337..57e281cbfc 100644 --- a/.github/actions/prepare-source/action.yml +++ b/.github/actions/prepare-source/action.yml @@ -4,7 +4,7 @@ runs: using: composite steps: - name: Check out mu-plugins-ext - uses: actions/checkout@v4.2.1 + uses: actions/checkout@v4.2.2 with: repository: 'Automattic/vip-go-mu-plugins-ext' path: 'vip-go-mu-plugins-ext' From 9839a61d81cbdad7e83531b4bc986a681629da97 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:24:37 +0200 Subject: [PATCH 09/20] chore(deps-dev): Bump @babel/plugin-syntax-decorators in /__tests__/e2e (#5956) Bumps [@babel/plugin-syntax-decorators](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-syntax-decorators) from 7.25.7 to 7.25.9. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.25.9/packages/babel-plugin-syntax-decorators) --- updated-dependencies: - dependency-name: "@babel/plugin-syntax-decorators" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- __tests__/e2e/package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/__tests__/e2e/package-lock.json b/__tests__/e2e/package-lock.json index 1bab4b27c8..8472a0b977 100644 --- a/__tests__/e2e/package-lock.json +++ b/__tests__/e2e/package-lock.json @@ -213,9 +213,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.7.tgz", - "integrity": "sha512-eaPZai0PiqCi09pPs3pAFfl/zYgGaE6IdXtYvmf0qlcDTd3WCtO7JWCcRd64e0EQrcYgiHibEZnOGsSY4QSgaw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", + "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", "dev": true, "engines": { "node": ">=6.9.0" @@ -319,12 +319,12 @@ } }, "node_modules/@babel/plugin-syntax-decorators": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.25.7.tgz", - "integrity": "sha512-oXduHo642ZhstLVYTe2z2GSJIruU0c/W3/Ghr6A5yGMsVrvdnxO1z+3pbTcT7f3/Clnt+1z8D/w1r1f1SHaCHw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.25.9.tgz", + "integrity": "sha512-ryzI0McXUPJnRCvMo4lumIKZUzhYUO/ScI+Mz4YVaTLt04DHNSjEUjKVvbzQjZFLuod/cYEc07mJWhzl6v4DPg==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.25.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" From 3b90e5964122cdebd3169b99960f8b59cb4652d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:25:19 +0200 Subject: [PATCH 10/20] chore(deps-dev): Bump @playwright/test in /__tests__/e2e (#5957) Bumps [@playwright/test](https://github.com/microsoft/playwright) from 1.48.1 to 1.48.2. - [Release notes](https://github.com/microsoft/playwright/releases) - [Commits](https://github.com/microsoft/playwright/compare/v1.48.1...v1.48.2) --- updated-dependencies: - dependency-name: "@playwright/test" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- __tests__/e2e/package-lock.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/__tests__/e2e/package-lock.json b/__tests__/e2e/package-lock.json index 8472a0b977..5b15325c45 100644 --- a/__tests__/e2e/package-lock.json +++ b/__tests__/e2e/package-lock.json @@ -685,12 +685,12 @@ } }, "node_modules/@playwright/test": { - "version": "1.48.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.1.tgz", - "integrity": "sha512-s9RtWoxkOLmRJdw3oFvhFbs9OJS0BzrLUc8Hf6l2UdCNd1rqeEyD4BhCJkvzeEoD1FsK4mirsWwGerhVmYKtZg==", + "version": "1.48.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.2.tgz", + "integrity": "sha512-54w1xCWfXuax7dz4W2M9uw0gDyh+ti/0K/MxcCUxChFh37kkdxPdfZDw5QBbuPUJHr1CiHJ1hXgSs+GgeQc5Zw==", "dev": true, "dependencies": { - "playwright": "1.48.1" + "playwright": "1.48.2" }, "bin": { "playwright": "cli.js" @@ -4193,12 +4193,12 @@ } }, "node_modules/playwright": { - "version": "1.48.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.1.tgz", - "integrity": "sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==", + "version": "1.48.2", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.2.tgz", + "integrity": "sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ==", "dev": true, "dependencies": { - "playwright-core": "1.48.1" + "playwright-core": "1.48.2" }, "bin": { "playwright": "cli.js" @@ -4211,9 +4211,9 @@ } }, "node_modules/playwright-core": { - "version": "1.48.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.1.tgz", - "integrity": "sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==", + "version": "1.48.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.2.tgz", + "integrity": "sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA==", "dev": true, "bin": { "playwright-core": "cli.js" From 6ac5d1f92c94d96898978ee31e3c129293d47477 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:39:28 +0200 Subject: [PATCH 11/20] chore(deps): Bump cookie and express in /search/search-dev-tools (#5977) Bumps [cookie](https://github.com/jshttp/cookie) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together. Updates `cookie` from 0.6.0 to 0.7.1 - [Release notes](https://github.com/jshttp/cookie/releases) - [Commits](https://github.com/jshttp/cookie/compare/v0.6.0...v0.7.1) Updates `express` from 4.21.0 to 4.21.1 - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md) - [Commits](https://github.com/expressjs/express/compare/4.21.0...4.21.1) --- updated-dependencies: - dependency-name: cookie dependency-type: indirect - dependency-name: express dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- search/search-dev-tools/package-lock.json | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/search/search-dev-tools/package-lock.json b/search/search-dev-tools/package-lock.json index 6ab96337dc..fe04ca5c0b 100644 --- a/search/search-dev-tools/package-lock.json +++ b/search/search-dev-tools/package-lock.json @@ -4183,11 +4183,10 @@ "license": "MIT" }, "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -6108,9 +6107,9 @@ } }, "node_modules/express": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz", - "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==", + "version": "4.21.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", + "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", "dev": true, "dependencies": { "accepts": "~1.3.8", @@ -6118,7 +6117,7 @@ "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", From 61cb023db37f1e3ecdf8f3fa42140dc24ec1dfbd Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Wed, 13 Nov 2024 18:47:43 +0200 Subject: [PATCH 12/20] ci: use preconfigured WP image if available (#5989) --- .github/workflows/e2e.yml | 1 + __tests__/e2e/bin/setup-env.sh | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 3fc35179b2..fa771d496c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -60,6 +60,7 @@ jobs: playwright.azureedge.net:443 production.cloudflare.docker.com:443 public-api.wordpress.com:443 + raw.githubusercontent.com:443 registry-1.docker.io:443 registry.npmjs.org:443 s.w.org:443 diff --git a/__tests__/e2e/bin/setup-env.sh b/__tests__/e2e/bin/setup-env.sh index 0d363af1a2..96e832d078 100755 --- a/__tests__/e2e/bin/setup-env.sh +++ b/__tests__/e2e/bin/setup-env.sh @@ -22,14 +22,26 @@ if [ -z "${version}" ]; then version=${WORDPRESS_VERSION:-latest} fi +if [ "${version}" = "latest" ]; then + WPVER="$(wget https://github.com/Automattic/vip-container-images/raw/refs/heads/master/wordpress/versions.json -O - | jq -r '[.[] | select(.prerelease == false)] | max_by(.tag) | .tag')" +else + WPVER="$(wget https://github.com/Automattic/vip-container-images/raw/refs/heads/master/wordpress/versions.json -O - | jq -r --arg ref_value "${version}" '.[] | select(.ref == $ref_value) | .tag')" +fi + +if [ -z "${WPVER}" ]; then + WPVER=trunk +fi + # Destroy existing test site vip dev-env destroy --slug=e2e-test-site || true # Create and run test site -vip --slug=e2e-test-site dev-env create --title="E2E Testing site" --mu-plugins="${pluginPath}" --mailpit false --wordpress=trunk --multisite=false --app-code="${clientCodePath}" --php 8.2 --xdebug false --phpmyadmin false --elasticsearch true < /dev/null +vip --slug=e2e-test-site dev-env create --title="E2E Testing site" --mu-plugins="${pluginPath}" --mailpit false --wordpress="${WPVER}" --multisite=false --app-code="${clientCodePath}" --php 8.2 --xdebug false --phpmyadmin false --elasticsearch true < /dev/null vip dev-env start --slug e2e-test-site --skip-wp-versions-check -vip dev-env shell --root --slug e2e-test-site -- chown -R www-data:www-data /wp +vip dev-env shell --root --slug e2e-test-site -- chown -R www-data:www-data /wp/wp-content/plugins vip dev-env exec --slug e2e-test-site --quiet -- wp plugin install --activate classic-editor -vip dev-env exec --slug e2e-test-site --quiet -- wp core update --force --version="${version}" -vip dev-env exec --slug e2e-test-site --quiet -- wp core update-db +if [ "${WPVER}" = 'trunk' ]; then + vip dev-env exec --slug e2e-test-site --quiet -- wp core update --force --version="${version}" + vip dev-env exec --slug e2e-test-site --quiet -- wp core update-db +fi vip dev-env exec --slug e2e-test-site --quiet -- wp rewrite structure '/%postname%/' From 05a72c573a36387a7cc72372cd6f46d6b6d1b8af Mon Sep 17 00:00:00 2001 From: Mehmood Ahmad <31419912+mehmoodak@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:55:33 +0500 Subject: [PATCH 13/20] Refactor Tracks events props to util functions (#5966) - Refactor Tracks events props to util functions for easy use. - Add following properties in each track event ```php [ 'hosting_provider' => get_hosting_provider(), 'is_vip_user' => false, 'is_multisite' => is_multisite(), 'wp_version' => get_bloginfo( 'version' ), ] ``` --- 000-vip-init.php | 1 + telemetry/tracks/class-tracks-event-dto.php | 4 - telemetry/tracks/class-tracks-event.php | 62 +++------- telemetry/tracks/tracks-utils.php | 128 ++++++++++++++++++++ tests/telemetry/test-class-tracks.php | 3 + tests/telemetry/test-tracks-utils.php | 84 +++++++++++++ vip-support/class-vip-support-user.php | 7 +- 7 files changed, 236 insertions(+), 53 deletions(-) create mode 100644 telemetry/tracks/tracks-utils.php create mode 100644 tests/telemetry/test-tracks-utils.php diff --git a/000-vip-init.php b/000-vip-init.php index e47492d3fa..dce6df9fa4 100644 --- a/000-vip-init.php +++ b/000-vip-init.php @@ -244,6 +244,7 @@ __DIR__ . '/telemetry/tracks/class-tracks-event-dto.php', __DIR__ . '/telemetry/tracks/class-tracks-event.php', __DIR__ . '/telemetry/tracks/class-tracks-client.php', + __DIR__ . '/telemetry/tracks/tracks-utils.php', ]; // If there is a missing file, the loop will break and the telemetry files will not be loaded at all diff --git a/telemetry/tracks/class-tracks-event-dto.php b/telemetry/tracks/class-tracks-event-dto.php index 4520abe7b1..e5dad8253f 100644 --- a/telemetry/tracks/class-tracks-event-dto.php +++ b/telemetry/tracks/class-tracks-event-dto.php @@ -10,10 +10,6 @@ namespace Automattic\VIP\Telemetry\Tracks; use AllowDynamicProperties; -use stdClass; -use WP_Error; -use Automattic\VIP\Support_User\User as Support_User; -use function Automattic\VIP\Logstash\log2logstash; /** * Class that holds necessary properties of Tracks events. diff --git a/telemetry/tracks/class-tracks-event.php b/telemetry/tracks/class-tracks-event.php index 8d49c93740..160d0a1281 100644 --- a/telemetry/tracks/class-tracks-event.php +++ b/telemetry/tracks/class-tracks-event.php @@ -11,7 +11,6 @@ use Automattic\VIP\Telemetry\Telemetry_Event; use WP_Error; -use Automattic\VIP\Support_User\User as Support_User; use function Automattic\VIP\Logstash\log2logstash; /** @@ -153,24 +152,19 @@ protected function process_properties( unset( $event->_via_ip ); } - // Set VIP environment if it exists. - if ( defined( 'VIP_GO_APP_ENVIRONMENT' ) ) { - $app_environment = constant( 'VIP_GO_APP_ENVIRONMENT' ); - if ( is_string( $app_environment ) && '' !== $app_environment ) { - $event->vipgo_env = $app_environment; - } + $base_props = get_base_properties_of_track_event(); + + if ( isset( $base_props['vipgo_env'] ) ) { + $event->vipgo_env = $base_props['vipgo_env']; } - // Set VIP organization if it exists. - if ( defined( 'VIP_ORG_ID' ) ) { - $org_id = constant( 'VIP_ORG_ID' ); - if ( is_integer( $org_id ) && $org_id > 0 ) { - $event->vipgo_org = $org_id; - } + if ( isset( $base_props['vipgo_org'] ) ) { + $event->vipgo_org = $base_props['vipgo_org']; } - // Check if the user is a VIP user. - $event->is_vip_user = Support_User::user_has_vip_support_role( get_current_user_id() ); + if ( isset( $base_props['is_vip_user'] ) ) { + $event->is_vip_user = $base_props['is_vip_user']; + } return $event; } @@ -183,44 +177,16 @@ protected function process_properties( * @return Tracks_Event_DTO The new event object including identity information. */ protected static function set_user_properties( Tracks_Event_DTO $event ): Tracks_Event_DTO { - $wp_user = wp_get_current_user(); - - // Only track logged-in users. - if ( 0 === $wp_user->ID ) { - return $event; - } + $base_props = get_base_properties_of_track_user(); - // Set anonymized event user ID; it should be consistent across environments. - // VIP_TELEMETRY_SALT is a private constant shared across the platform. - if ( defined( 'VIP_TELEMETRY_SALT' ) ) { - $salt = constant( 'VIP_TELEMETRY_SALT' ); - $tracks_user_id = hash_hmac( 'sha256', $wp_user->user_email, $salt ); - - $event->_ui = $tracks_user_id; - $event->_ut = 'vip:user_email'; - - return $event; + if ( isset( $base_props['_ui'] ) ) { + $event->_ui = $base_props['_ui']; } - // Users in the VIP environment. - if ( defined( 'VIP_GO_APP_ID' ) ) { - $app_id = constant( 'VIP_GO_APP_ID' ); - if ( is_integer( $app_id ) && $app_id > 0 ) { - $event->_ui = sprintf( '%s_%s', $app_id, $wp_user->ID ); - $event->_ut = 'vip_go_app_wp_user'; - - return $event; - } + if ( isset( $base_props['_ut'] ) ) { + $event->_ut = $base_props['_ut']; } - // All other environments. - $event->_ui = wp_hash( sprintf( '%s|%s', get_option( 'home' ), $wp_user->ID ) ); - - /** - * @see \Automattic\VIP\Parsely\Telemetry\Tracks_Event::annotate_with_id_and_type() - */ - $event->_ut = 'anon'; // Same as the default value in the original code. - return $event; } diff --git a/telemetry/tracks/tracks-utils.php b/telemetry/tracks/tracks-utils.php new file mode 100644 index 0000000000..5f7ec1200e --- /dev/null +++ b/telemetry/tracks/tracks-utils.php @@ -0,0 +1,128 @@ + The base properties. + */ +function get_base_properties_of_track_event(): array { + $props = [ + 'hosting_provider' => get_hosting_provider(), + 'is_vip_user' => Support_User::user_has_vip_support_role( get_current_user_id() ), + 'is_multisite' => is_multisite(), + 'wp_version' => get_bloginfo( 'version' ), + ]; + + // Set VIP environment if it exists. + if ( defined( 'VIP_GO_APP_ENVIRONMENT' ) ) { + $app_environment = constant( 'VIP_GO_APP_ENVIRONMENT' ); + if ( is_string( $app_environment ) && '' !== $app_environment ) { + $props['vipgo_env'] = $app_environment; + } + } + + // Set VIP organization if it exists. + if ( defined( 'VIP_ORG_ID' ) ) { + $org_id = constant( 'VIP_ORG_ID' ); + if ( is_integer( $org_id ) && $org_id > 0 ) { + $props['vipgo_org'] = $org_id; + } + } + + return $props; +} + +/** + * Check if the site is hosted on VIP. + */ +function is_wpvip_site(): bool { + if ( is_wpvip_sandbox() ) { + return false; + } + + return defined( 'WPCOM_IS_VIP_ENV' ) && constant( 'WPCOM_IS_VIP_ENV' ) === true; +} + +/** + * Check if the site is hosted on VIP sandbox. + */ +function is_wpvip_sandbox(): bool { + return defined( 'WPCOM_SANDBOXED' ) && constant( 'WPCOM_SANDBOXED' ) === true; +} + +/** + * Get the hosting provider. + */ +function get_hosting_provider(): string { + if ( is_wpvip_sandbox() ) { + return 'wpvip_sandbox'; + } + + if ( is_wpvip_site() ) { + return 'wpvip'; + } + + return 'other'; +} + +/** + * Returns the base properties for a track user. + * + * @return array The base properties. + */ +function get_base_properties_of_track_user(): array { + $props = []; + + // Only track logged-in users. + $wp_user = wp_get_current_user(); + if ( 0 === $wp_user->ID ) { + return $props; + } + + // Set anonymized event user ID; it should be consistent across environments. + // VIP_TELEMETRY_SALT is a private constant shared across the platform. + if ( defined( 'VIP_TELEMETRY_SALT' ) ) { + $salt = constant( 'VIP_TELEMETRY_SALT' ); + $tracks_user_id = hash_hmac( 'sha256', $wp_user->user_email, $salt ); + + $props['_ui'] = $tracks_user_id; + $props['_ut'] = 'vip:user_email'; + } elseif ( defined( 'VIP_GO_APP_ID' ) ) { + // Users in the VIP environment. + $app_id = constant( 'VIP_GO_APP_ID' ); + if ( is_integer( $app_id ) && $app_id > 0 ) { + $props['_ui'] = sprintf( '%s_%s', $app_id, $wp_user->ID ); + $props['_ut'] = 'vip_go_app_wp_user'; + } + } else { + // All other environments. + $props['_ui'] = wp_hash( sprintf( '%s|%s', get_option( 'home' ), $wp_user->ID ) ); + + /** + * @see \Automattic\VIP\Parsely\Telemetry\Tracks_Event::annotate_with_id_and_type() + */ + $props['_ut'] = 'anon'; // Same as the default value in the original code. + } + + return $props; +} + +/** + * Get the core properties for a Tracks event. + * + * @return array The core properties. + */ +function get_tracks_core_properties(): array { + return array_merge( get_base_properties_of_track_event(), get_base_properties_of_track_user() ); +} diff --git a/tests/telemetry/test-class-tracks.php b/tests/telemetry/test-class-tracks.php index 8fe36475da..ea7a521f3e 100644 --- a/tests/telemetry/test-class-tracks.php +++ b/tests/telemetry/test-class-tracks.php @@ -5,6 +5,7 @@ namespace Automattic\VIP\Telemetry; use Automattic\VIP\Telemetry\Tracks\Tracks_Event; +use PHPUnit\Framework\MockObject\MockObject; use WP_UnitTestCase; class Tracks_Test extends WP_UnitTestCase { @@ -12,6 +13,7 @@ public function test_event_queued() { $user = $this->factory()->user->create_and_get(); wp_set_current_user( $user->ID ); + /** @var MockObject|Telemetry_Event_Queue */ $queue = $this->getMockBuilder( Telemetry_Event_Queue::class ) ->disableOriginalConstructor() ->getMock(); @@ -28,6 +30,7 @@ public function test_event_queued() { ->willReturn( true ); $tracks = new Tracks( 'test_', [], $queue ); + $this->assertTrue( $tracks->record_event( 'cool_event', [ 'foo' => 'bar' ] ) ); } diff --git a/tests/telemetry/test-tracks-utils.php b/tests/telemetry/test-tracks-utils.php new file mode 100644 index 0000000000..6f3d3d4c12 --- /dev/null +++ b/tests/telemetry/test-tracks-utils.php @@ -0,0 +1,84 @@ +assertEquals( false, is_wpvip_site() ); + } + + public function test_is_wpvip_site_returns_false_on_sandbox(): void { + Constant_Mocker::define( 'WPCOM_IS_VIP_ENV', true ); + Constant_Mocker::define( 'WPCOM_SANDBOXED', true ); + + $this->assertEquals( false, is_wpvip_site() ); + } + + public function test_is_wpvip_site_returns_true(): void { + Constant_Mocker::define( 'WPCOM_IS_VIP_ENV', true ); + Constant_Mocker::define( 'WPCOM_SANDBOXED', false ); + + $this->assertEquals( true, is_wpvip_site() ); + } + + public function test_is_wpvip_sandbox_returns_true(): void { + Constant_Mocker::define( 'WPCOM_SANDBOXED', true ); + + $this->assertEquals( true, is_wpvip_sandbox() ); + } + + public function test_is_wpvip_sandbox_returns_false(): void { + Constant_Mocker::define( 'WPCOM_SANDBOXED', false ); + + $this->assertEquals( false, is_wpvip_sandbox() ); + } + + public function test_get_hosting_provider_returns_wpvip_on_VIP_hosting(): void { + Constant_Mocker::define( 'WPCOM_IS_VIP_ENV', true ); + Constant_Mocker::define( 'WPCOM_SANDBOXED', false ); + + $this->assertEquals( 'wpvip', get_hosting_provider() ); + } + + public function test_get_hosting_provider_returns_wpvip_sandbox_on_sandbox(): void { + Constant_Mocker::define( 'WPCOM_SANDBOXED', true ); + + $this->assertEquals( 'wpvip_sandbox', get_hosting_provider() ); + } + + public function test_get_hosting_provider_returns_other_on_non_VIP_hosting(): void { + $this->assertEquals( 'other', get_hosting_provider() ); + } + + public function test_track_core_properties(): void { + wp_set_current_user( 1 ); + $output = get_tracks_core_properties(); + + $props = [ + 'hosting_provider' => 'other', + 'is_vip_user' => false, + 'is_multisite' => is_multisite(), + 'wp_version' => get_bloginfo( 'version' ), + '_ut' => 'anon', + '_ui' => wp_hash( sprintf( '%s|%s', get_option( 'home' ), 1 ) ), + ]; + $this->assertEquals( $props, $output ); + } +} diff --git a/vip-support/class-vip-support-user.php b/vip-support/class-vip-support-user.php index 1173eadbb1..cffeb36dbe 100644 --- a/vip-support/class-vip-support-user.php +++ b/vip-support/class-vip-support-user.php @@ -190,7 +190,12 @@ public function __construct() { * user edit and profile screens. */ public function action_admin_head() { - if ( in_array( get_current_screen()->base, array( 'user-edit', 'profile' ) ) ) { + $current_screen = get_current_screen(); + if ( ! $current_screen ) { + return; + } + + if ( in_array( $current_screen->base, array( 'user-edit', 'profile' ) ) ) { ?>