@@ -147,6 +147,33 @@ function parseUpgradeSurvivorScenarios(raw) {
147147 ] ;
148148}
149149
150+ function parsePublishedReleaseVersion ( spec ) {
151+ const match = / ^ o p e n c l a w @ ( [ 0 - 9 ] { 4 } ) \. ( [ 0 - 9 ] + ) \. ( [ 0 - 9 ] + ) / u. exec ( String ( spec ?? "" ) ) ;
152+ if ( ! match ) {
153+ return null ;
154+ }
155+ return {
156+ year : Number ( match [ 1 ] ) ,
157+ month : Number ( match [ 2 ] ) ,
158+ day : Number ( match [ 3 ] ) ,
159+ } ;
160+ }
161+
162+ function comparePublishedReleaseVersion ( a , b ) {
163+ return a . year - b . year || a . month - b . month || a . day - b . day ;
164+ }
165+
166+ function supportsUpgradeSurvivorPluginDependencyCleanup ( baselineSpec ) {
167+ if ( ! baselineSpec ) {
168+ return true ;
169+ }
170+ const version = parsePublishedReleaseVersion ( baselineSpec ) ;
171+ if ( ! version ) {
172+ return true ;
173+ }
174+ return comparePublishedReleaseVersion ( version , { year : 2026 , month : 4 , day : 23 } ) >= 0 ;
175+ }
176+
150177function expandUpgradeSurvivorBaselineLanes ( poolLanes , rawBaselineSpecs , rawScenarios = "" ) {
151178 const baselineSpecs = parseUpgradeSurvivorBaselineSpecs ( rawBaselineSpecs ) ;
152179 const scenarios = parseUpgradeSurvivorScenarios ( rawScenarios ) ;
@@ -160,30 +187,38 @@ function expandUpgradeSurvivorBaselineLanes(poolLanes, rawBaselineSpecs, rawScen
160187 const matrixBaselines = baselineSpecs . length > 0 ? baselineSpecs : [ undefined ] ;
161188 const matrixScenarios = scenarios . length > 0 ? scenarios : [ undefined ] ;
162189 return matrixBaselines . flatMap ( ( baselineSpec ) =>
163- matrixScenarios . map ( ( scenario ) => {
164- const suffixParts = [
165- baselineSpec ? sanitizeLaneNameSuffix ( baselineSpec ) : "" ,
166- scenario && scenario !== "base" ? sanitizeLaneNameSuffix ( scenario ) : "" ,
167- ] . filter ( Boolean ) ;
168- const suffix = suffixParts . join ( "-" ) ;
169- const name = suffix ? `${ poolLane . name } -${ suffix } ` : poolLane . name ;
170- const commandPrefix = [
171- `OPENCLAW_UPGRADE_SURVIVOR_ARTIFACT_DIR="$PWD/.artifacts/upgrade-survivor/${ name } "` ,
172- baselineSpec ? `OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC=${ shellQuote ( baselineSpec ) } ` : "" ,
173- scenario ? `OPENCLAW_UPGRADE_SURVIVOR_SCENARIO=${ shellQuote ( scenario ) } ` : "" ,
174- ]
175- . filter ( Boolean )
176- . join ( " " ) ;
177- return Object . assign ( { } , poolLane , {
178- cacheKey : poolLane . cacheKey
179- ? suffix
180- ? `${ poolLane . cacheKey } -${ suffix } `
181- : poolLane . cacheKey
182- : name ,
183- command : commandPrefix ? `${ commandPrefix } ${ poolLane . command } ` : poolLane . command ,
184- name,
185- } ) ;
186- } ) ,
190+ matrixScenarios
191+ . filter (
192+ ( scenario ) =>
193+ scenario !== "plugin-deps-cleanup" ||
194+ supportsUpgradeSurvivorPluginDependencyCleanup ( baselineSpec ) ,
195+ )
196+ . map ( ( scenario ) => {
197+ const suffixParts = [
198+ baselineSpec ? sanitizeLaneNameSuffix ( baselineSpec ) : "" ,
199+ scenario && scenario !== "base" ? sanitizeLaneNameSuffix ( scenario ) : "" ,
200+ ] . filter ( Boolean ) ;
201+ const suffix = suffixParts . join ( "-" ) ;
202+ const name = suffix ? `${ poolLane . name } -${ suffix } ` : poolLane . name ;
203+ const commandPrefix = [
204+ `OPENCLAW_UPGRADE_SURVIVOR_ARTIFACT_DIR="$PWD/.artifacts/upgrade-survivor/${ name } "` ,
205+ baselineSpec
206+ ? `OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC=${ shellQuote ( baselineSpec ) } `
207+ : "" ,
208+ scenario ? `OPENCLAW_UPGRADE_SURVIVOR_SCENARIO=${ shellQuote ( scenario ) } ` : "" ,
209+ ]
210+ . filter ( Boolean )
211+ . join ( " " ) ;
212+ return Object . assign ( { } , poolLane , {
213+ cacheKey : poolLane . cacheKey
214+ ? suffix
215+ ? `${ poolLane . cacheKey } -${ suffix } `
216+ : poolLane . cacheKey
217+ : name ,
218+ command : commandPrefix ? `${ commandPrefix } ${ poolLane . command } ` : poolLane . command ,
219+ name,
220+ } ) ;
221+ } ) ,
187222 ) ;
188223 } ) ;
189224}
0 commit comments