@@ -10,10 +10,31 @@ import {
1010 hasQaSmokeAffectingChange ,
1111 hasSqliteSessionLifecycleAffectingChange ,
1212} from "../../scripts/lib/ci-changed-node-test-plan.mts" ;
13+ import { listExtensionTestFilesForRoots } from "../../scripts/lib/extension-test-plan.mts" ;
1314import { hasImportGraphImpactOnTargets } from "../../scripts/test-projects.test-support.mts" ;
1415import { listGitTrackedFiles } from "../../src/test-utils/repo-files.js" ;
1516import { isGatewayServerTestFile } from "../vitest/vitest.gateway-server-paths.mjs" ;
1617
18+ const CODEX_TEST_PROCESS_FILE_LIMIT = 40 ;
19+
20+ function expectBoundedCodexFallback (
21+ shards : ReturnType < typeof createChangedExtensionFallbackShards > ,
22+ ) {
23+ const targets = shards . flatMap ( ( shard ) => shard . includePatterns ?? [ ] ) ;
24+
25+ expect ( shards . length ) . toBeGreaterThan ( 1 ) ;
26+ expect (
27+ shards . every (
28+ ( shard ) =>
29+ shard . configs [ 0 ] === "test/vitest/vitest.extension-codex.config.ts" &&
30+ ( shard . includePatterns ?. length ?? 0 ) > 0 &&
31+ ( shard . includePatterns ?. length ?? 0 ) <= CODEX_TEST_PROCESS_FILE_LIMIT ,
32+ ) ,
33+ ) . toBe ( true ) ;
34+ expect ( targets ) . toEqual ( listExtensionTestFilesForRoots ( [ "extensions/codex" ] ) ) ;
35+ expect ( new Set ( targets ) . size ) . toBe ( targets . length ) ;
36+ }
37+
1738describe ( "CI changed Node test plan" , ( ) => {
1839 it ( "routes Control UI style changes through source-scanning policy tests" , ( ) => {
1940 const shards = createChangedNodeTestShards ( [ "ui/src/styles/chat/layout.css" ] ) ;
@@ -274,15 +295,7 @@ describe("CI changed Node test plan", () => {
274295 ] ;
275296
276297 expect ( createChangedNodeTestShards ( changedPaths ) ) . toBeNull ( ) ;
277- expect ( createChangedExtensionFallbackShards ( changedPaths ) ) . toEqual ( [
278- {
279- checkName : "checks-node-changed-extensions-config" ,
280- configs : [ "test/vitest/vitest.extension-codex.config.ts" ] ,
281- requiresDist : false ,
282- runner : "blacksmith-8vcpu-ubuntu-2404" ,
283- shardName : "changed-extensions-config" ,
284- } ,
285- ] ) ;
298+ expectBoundedCodexFallback ( createChangedExtensionFallbackShards ( changedPaths ) ) ;
286299 } ) ;
287300
288301 it . each ( [
@@ -348,22 +361,14 @@ describe("CI changed Node test plan", () => {
348361 ) . toEqual ( [ ] ) ;
349362 } ) ;
350363
351- it ( "falls back to the affected extension config for deleted sources" , ( ) => {
364+ it ( "falls back to bounded Codex config shards for deleted sources" , ( ) => {
352365 const cwd = mkdtempSync ( path . join ( tmpdir ( ) , "openclaw-ci-extension-fallback-" ) ) ;
353366 try {
354- expect (
367+ expectBoundedCodexFallback (
355368 createChangedExtensionFallbackShards ( [ "extensions/codex/src/deleted-session-runtime.ts" ] , {
356369 cwd,
357370 } ) ,
358- ) . toEqual ( [
359- {
360- checkName : "checks-node-changed-extensions-config" ,
361- configs : [ "test/vitest/vitest.extension-codex.config.ts" ] ,
362- requiresDist : false ,
363- runner : "blacksmith-8vcpu-ubuntu-2404" ,
364- shardName : "changed-extensions-config" ,
365- } ,
366- ] ) ;
371+ ) ;
367372 expect (
368373 createChangedExtensionFallbackShards (
369374 [ "extensions/codex/src/deleted-session-runtime.test.ts" ] ,
0 commit comments