Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

ci: preserve pnpm entry when running workspace test shards

DavidShen9daddddfb37c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bda83d213f..8f64e52e7f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -140,8 +140,8 @@ jobs:
run: pnpm install:ripgrep
- name: Run client and package unit test shard
- # 通过 pnpm 启动 runner,保留当前 pnpm 入口与 workspace 解析语义。
- run: pnpm exec node scripts/test-workspaces.mjs --tier unit
+ # package script 会传递 npm_execpath,让子进程复用当前 pnpm 入口。
+ run: pnpm run test:workspaces --tier unit
# localDb suites are outside the unit tier; exercise these DB boundaries on both OSes.
- name: Run companion database regressions
@@ -206,9 +206,9 @@ jobs:
run: pnpm install:ripgrep
- name: Run client and package unit tests
- # test:runner runs once in verify-checks. Running the root test:unit
- # script here would repeat all runner self-tests for every shard.
- run: pnpm exec node scripts/test-workspaces.mjs --tier unit
+ # test:runner 只在 verify-checks 跑一次。通过 package script 传递
+ # npm_execpath,避免 Windows 子进程退回 PATH 上的 pnpm.cmd。
+ run: pnpm run test:workspaces --tier unit
# localDb suites are outside the unit tier; exercise these DB boundaries on both OSes.
- name: Run companion database regressions
diff --git a/package.json b/package.json
index 52773a640e..c5bf3fb7aa 100644
--- a/package.json
+++ b/package.json
@@ -124,6 +124,7 @@
"lint": "pnpm -r lint",
"format": "pnpm -r format",
"test:runner": "node --test scripts/__tests__/test-workspaces.test.mjs scripts/__tests__/test-related.test.mjs scripts/__tests__/desktop-worker-benchmark.test.mjs scripts/__tests__/dev-docs-contract.test.mjs scripts/__tests__/restart-desktop-remote.test.mjs scripts/__tests__/dev-migration-policy.test.mjs scripts/__tests__/ensure-deps.test.mjs scripts/__tests__/client-endpoint-build-env.test.mjs scripts/__tests__/log-upload-build-env.test.mjs scripts/__tests__/desktop-dev-region.test.mjs scripts/__tests__/endpoint-consistency.test.mjs scripts/__tests__/endpoint-local-file.test.mjs scripts/__tests__/ensure-agent-binaries.test.mjs scripts/__tests__/ensure-android-platform-tools.test.mjs scripts/__tests__/fetch-with-timeout.test.mjs scripts/__tests__/agent-binary-cdn-fallback.test.mjs scripts/__tests__/ensure-binary-fallback.test.mjs scripts/__tests__/verify-sha256.test.mjs scripts/__tests__/codex-package-update-layout.test.mjs scripts/__tests__/pi-update-layout.test.mjs scripts/__tests__/migration-freeze.test.mjs scripts/__tests__/third-party-notices.test.mjs scripts/__tests__/brand-identity-sync.test.mjs scripts/__tests__/check-dco.test.mjs scripts/__tests__/package-args.test.mjs scripts/__tests__/notarize-mac-app.test.mjs scripts/__tests__/glossary-rules.test.mjs scripts/__tests__/design-inventory.test.mjs",
+ "test:workspaces": "node scripts/test-workspaces.mjs",
"test:unit": "pnpm test:runner && node scripts/test-workspaces.mjs --tier unit",
"test:unit:related": "node scripts/test-workspaces.mjs --tier unit --related",
"test:integration": "pnpm test:runner && node scripts/test-workspaces.mjs --tier integration",
diff --git a/scripts/__tests__/dev-docs-contract.test.mjs b/scripts/__tests__/dev-docs-contract.test.mjs
index e2f2e0f498..b4d1d8915d 100644
--- a/scripts/__tests__/dev-docs-contract.test.mjs
+++ b/scripts/__tests__/dev-docs-contract.test.mjs
@@ -292,7 +292,7 @@ test("client CI keeps the complete two-shard unit gate on Windows", () => {
assert.match(shards, /^ fail-fast: false$/m);
assert.match(shards, /^ shard: \[1, 2\]$/m);
assert.match(shards, /^ XDT_UNIT_TEST_SHARD: \$\{\{ matrix\.shard \}\}\/2$/m);
- assert.match(shards, /^ run: pnpm exec node scripts\/test-workspaces\.mjs --tier unit$/m);
+ assert.match(shards, /^ run: pnpm run test:workspaces --tier unit$/m);
assert.doesNotMatch(shards, /pnpm test:unit(?:\s|$)/);
const gate = workflowJob(workflow, "windows-unit");
@@ -319,7 +319,7 @@ test("client CI runs Linux checks and complete unit shards in parallel behind st
assert.match(shards, /^ fail-fast: false$/m);
assert.match(shards, /^ shard: \[1, 2\]$/m);
assert.match(shards, /^ XDT_UNIT_TEST_SHARD: \$\{\{ matrix\.shard \}\}\/2$/m);
- assert.match(shards, /^ run: pnpm exec node scripts\/test-workspaces\.mjs --tier unit$/m);
+ assert.match(shards, /^ run: pnpm run test:workspaces --tier unit$/m);
assert.doesNotMatch(shards, /pnpm test:(?:unit|runner)/);
const gate = workflowJob(workflow, "verify");
diff --git a/scripts/__tests__/test-workspaces.test.mjs b/scripts/__tests__/test-workspaces.test.mjs
index edfd0a4dcc..298353fe0e 100644
--- a/scripts/__tests__/test-workspaces.test.mjs
+++ b/scripts/__tests__/test-workspaces.test.mjs
@@ -83,6 +83,8 @@ test("parseWorkspacePatterns reads pnpm-workspace.yaml package globs", () => {
test("root unit and all scripts run runner self-tests before workspace sweep", () => {
const scripts = readRootScripts();
+ // CI uses the package lifecycle to propagate npm_execpath without duplicating self-tests.
+ assert.equal(scripts["test:workspaces"], "node scripts/test-workspaces.mjs");
assert.match(
scripts["test:unit"],
/^pnpm test:runner && node scripts\/test-workspaces\.mjs --tier unit$/,