@@ -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,53 @@ 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 ( "covers every extension config when the extension inventory changes" , ( ) => {
337+ expectAllExtensionConfigs (
338+ createChangedExtensionFallbackShards ( [ "scripts/lib/changed-extensions.mts" ] ) ,
339+ ) ;
340+ } ) ;
341+
342+ it ( "classifies core and fallback-gate extension impact" , ( ) => {
343+ expect ( hasCoreExtensionImpact ( [ "src/agents/openclaw-tools.ts" ] ) ) . toBe ( true ) ;
344+ expect ( hasCoreExtensionImpact ( [ "scripts/lib/changed-extensions.mts" ] ) ) . toBe ( true ) ;
345+ expect ( hasCoreExtensionImpact ( [ "scripts/lib/ci-changed-node-test-plan.mts" ] ) ) . toBe ( true ) ;
346+ expect ( hasCoreExtensionImpact ( [ "scripts/lib/extension-test-plan.mts" ] ) ) . toBe ( true ) ;
347+ expect ( hasCoreExtensionImpact ( [ "extensions/discord/src/channel.ts" ] ) ) . toBe ( false ) ;
348+ expect ( hasCoreExtensionImpact ( [ "docs/ci.md" ] ) ) . toBe ( false ) ;
349+ } ) ;
350+
351+ it ( "keeps extension-only fallbacks scoped to the changed extension config" , ( ) => {
352+ expect ( createChangedExtensionFallbackShards ( [ "extensions/discord/src/channel.ts" ] ) ) . toEqual ( [
353+ {
354+ checkName : "checks-node-changed-extensions-config" ,
355+ configs : [ "test/vitest/vitest.extension-discord.config.ts" ] ,
356+ requiresDist : false ,
357+ runner : "blacksmith-8vcpu-ubuntu-2404" ,
358+ shardName : "changed-extensions-config" ,
359+ } ,
360+ ] ) ;
361+ } ) ;
362+
363+ it ( "does not create extension fallback shards for docs-only diffs" , ( ) => {
364+ expect ( createChangedExtensionFallbackShards ( [ "docs/ci.md" ] ) ) . toEqual ( [ ] ) ;
365+ } ) ;
366+
301367 it . each ( [
302368 {
303369 changedPath : "extensions/browser/src/browser/cdp.helpers.test.ts" ,
@@ -352,13 +418,8 @@ describe("CI changed Node test plan", () => {
352418 expect ( new Set ( targets ) . size ) . toBe ( targets . length ) ;
353419 } ) ;
354420
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 ( [ ] ) ;
421+ it ( "skips extension fallback when the core-impact predicate does not fire" , ( ) => {
422+ expect ( createChangedExtensionFallbackShards ( [ "src/agents/live-model-filter.ts" ] ) ) . toEqual ( [ ] ) ;
362423 } ) ;
363424
364425 it ( "falls back to bounded Codex config shards for deleted sources" , ( ) => {
0 commit comments