@@ -2,15 +2,20 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
22import { tmpdir } from "node:os" ;
33import path from "node:path" ;
44import { describe , expect , it } from "vitest" ;
5+ import { listAvailableExtensionIds } from "../../scripts/lib/changed-extensions.mts" ;
56import {
67 createChangedExtensionFallbackShards ,
78 createChangedNodeTestShards ,
89 hasBuildArtifactAffectingChange ,
10+ hasCoreExtensionImpact ,
911 hasPromptSnapshotAffectingChange ,
1012 hasQaSmokeAffectingChange ,
1113 hasSqliteSessionLifecycleAffectingChange ,
1214} from "../../scripts/lib/ci-changed-node-test-plan.mts" ;
13- import { listExtensionTestFilesForRoots } from "../../scripts/lib/extension-test-plan.mts" ;
15+ import {
16+ listExtensionTestFilesForRoots ,
17+ resolveExtensionTestConfig ,
18+ } from "../../scripts/lib/extension-test-plan.mts" ;
1419import { hasImportGraphImpactOnTargets } from "../../scripts/test-projects.test-support.mts" ;
1520import { listGitTrackedFiles } from "../../src/test-utils/repo-files.js" ;
1621import { isGatewayServerTestFile } from "../vitest/vitest.gateway-server-paths.mjs" ;
@@ -35,6 +40,20 @@ function expectBoundedCodexFallback(
3540 expect ( new Set ( targets ) . size ) . toBe ( targets . length ) ;
3641}
3742
43+ function expectAllExtensionConfigs (
44+ shards : ReturnType < typeof createChangedExtensionFallbackShards > ,
45+ ) {
46+ const configs = new Set ( shards . flatMap ( ( shard ) => shard . configs ) ) ;
47+ const expectedConfigs = new Set (
48+ listAvailableExtensionIds ( ) . map ( ( extensionId ) =>
49+ resolveExtensionTestConfig ( `extensions/${ extensionId } ` ) ,
50+ ) ,
51+ ) ;
52+
53+ expect ( configs ) . toEqual ( expectedConfigs ) ;
54+ expect ( configs ) . toContain ( "test/vitest/vitest.extension-codex.config.ts" ) ;
55+ }
56+
3857describe ( "CI changed Node test plan" , ( ) => {
3958 it ( "routes Control UI style changes through source-scanning policy tests" , ( ) => {
4059 const shards = createChangedNodeTestShards ( [ "ui/src/styles/chat/layout.css" ] ) ;
@@ -298,6 +317,46 @@ describe("CI changed Node test plan", () => {
298317 expectBoundedCodexFallback ( createChangedExtensionFallbackShards ( changedPaths ) ) ;
299318 } ) ;
300319
320+ it ( "covers every extension config when core changes can impact extension consumers" , ( ) => {
321+ const shards = createChangedExtensionFallbackShards ( [
322+ "src/gateway/tool-resolution.ts" ,
323+ "src/agents/openclaw-tools.ts" ,
324+ "extensions/discord/src/channel.ts" ,
325+ ] ) ;
326+
327+ expectAllExtensionConfigs ( shards ) ;
328+ } ) ;
329+
330+ it ( "covers every extension config when the fallback planner itself changes" , ( ) => {
331+ expectAllExtensionConfigs (
332+ createChangedExtensionFallbackShards ( [ "scripts/lib/ci-changed-node-test-plan.mts" ] ) ,
333+ ) ;
334+ } ) ;
335+
336+ it ( "classifies core and fallback-gate extension impact" , ( ) => {
337+ expect ( hasCoreExtensionImpact ( [ "src/agents/openclaw-tools.ts" ] ) ) . toBe ( true ) ;
338+ expect ( hasCoreExtensionImpact ( [ "scripts/lib/ci-changed-node-test-plan.mts" ] ) ) . toBe ( true ) ;
339+ expect ( hasCoreExtensionImpact ( [ "scripts/lib/extension-test-plan.mts" ] ) ) . toBe ( true ) ;
340+ expect ( hasCoreExtensionImpact ( [ "extensions/discord/src/channel.ts" ] ) ) . toBe ( false ) ;
341+ expect ( hasCoreExtensionImpact ( [ "docs/ci.md" ] ) ) . toBe ( false ) ;
342+ } ) ;
343+
344+ it ( "keeps extension-only fallbacks scoped to the changed extension config" , ( ) => {
345+ expect ( createChangedExtensionFallbackShards ( [ "extensions/discord/src/channel.ts" ] ) ) . toEqual ( [
346+ {
347+ checkName : "checks-node-changed-extensions-config" ,
348+ configs : [ "test/vitest/vitest.extension-discord.config.ts" ] ,
349+ requiresDist : false ,
350+ runner : "blacksmith-8vcpu-ubuntu-2404" ,
351+ shardName : "changed-extensions-config" ,
352+ } ,
353+ ] ) ;
354+ } ) ;
355+
356+ it ( "does not create extension fallback shards for docs-only diffs" , ( ) => {
357+ expect ( createChangedExtensionFallbackShards ( [ "docs/ci.md" ] ) ) . toEqual ( [ ] ) ;
358+ } ) ;
359+
301360 it . each ( [
302361 {
303362 changedPath : "extensions/browser/src/browser/cdp.helpers.test.ts" ,
@@ -352,13 +411,8 @@ describe("CI changed Node test plan", () => {
352411 expect ( new Set ( targets ) . size ) . toBe ( targets . length ) ;
353412 } ) ;
354413
355- it ( "skips extension fallback when no extension paths changed" , ( ) => {
356- expect (
357- createChangedExtensionFallbackShards ( [
358- "packages/gateway-protocol/src/frame-guards.ts" ,
359- "src/agents/live-model-filter.ts" ,
360- ] ) ,
361- ) . toEqual ( [ ] ) ;
414+ it ( "skips extension fallback when the core-impact predicate does not fire" , ( ) => {
415+ expect ( createChangedExtensionFallbackShards ( [ "src/agents/live-model-filter.ts" ] ) ) . toEqual ( [ ] ) ;
362416 } ) ;
363417
364418 it ( "falls back to bounded Codex config shards for deleted sources" , ( ) => {
0 commit comments