@@ -589,6 +589,42 @@ function findPathToContainer(availabilityPath) {
589589 }
590590}
591591
592+ /**
593+ * Finds the release in which this path, or one of its ancestors, was
594+ * deprecated, if such a release exists. If no such release exists, returns
595+ * undefined.
596+ */
597+ function findDeprecationRelease ( global , path , options ) {
598+ if ( path === undefined ) {
599+ return undefined ;
600+ }
601+
602+ const data = fetchAvailabilityData ( global ) ;
603+ let deprecatedRelease = undefined ;
604+ let deprecationPath = [ ...path ] ;
605+ while ( deprecatedRelease === undefined && deprecationPath != undefined ) {
606+ deprecatedRelease = findReleaseForPath (
607+ data ,
608+ [ 'deprecated' , ...deprecationPath ] ,
609+ options
610+ ) ;
611+ deprecationPath = findPathToContainer ( deprecationPath ) ;
612+ }
613+ if ( options . hash . deprecatedRelease ) {
614+ let minimalDeprecatedRelease = findReleaseByName (
615+ data ,
616+ options . hash . deprecatedRelease
617+ ) ;
618+ if (
619+ deprecatedRelease === undefined ||
620+ data . indexOf ( deprecatedRelease ) > data . indexOf ( minimalDeprecatedRelease )
621+ ) {
622+ deprecatedRelease = minimalDeprecatedRelease ;
623+ }
624+ }
625+ return deprecatedRelease ;
626+ }
627+
592628async function availability ( clusterName , options ) {
593629 const data = fetchAvailabilityData ( this . global ) ;
594630 const path = makeAvailabilityPath ( clusterName , options ) ;
@@ -636,28 +672,7 @@ async function availability(clusterName, options) {
636672 }
637673 let introducedVersions = introducedRelease ?. versions ;
638674
639- let deprecatedRelease = undefined ;
640- let deprecationPath = [ ...path ] ;
641- while ( deprecatedRelease === undefined && deprecationPath != undefined ) {
642- deprecatedRelease = findReleaseForPath (
643- data ,
644- [ 'deprecated' , ...deprecationPath ] ,
645- options
646- ) ;
647- deprecationPath = findPathToContainer ( deprecationPath ) ;
648- }
649- if ( options . hash . deprecatedRelease ) {
650- let minimalDeprecatedRelease = findReleaseByName (
651- data ,
652- options . hash . deprecatedRelease
653- ) ;
654- if (
655- deprecatedRelease === undefined ||
656- data . indexOf ( deprecatedRelease ) > data . indexOf ( minimalDeprecatedRelease )
657- ) {
658- deprecatedRelease = minimalDeprecatedRelease ;
659- }
660- }
675+ let deprecatedRelease = findDeprecationRelease ( this . global , path , options ) ;
661676 const deprecatedVersions = deprecatedRelease ?. versions ;
662677
663678 if ( introducedVersions === undefined && deprecatedVersions !== undefined ) {
@@ -842,17 +857,30 @@ function pathsEqual(path1, path2) {
842857}
843858
844859function isSupported ( cluster , options ) {
860+ // Things that are removed are not supported.
845861 if ( wasRemoved . call ( this , cluster , options ) ) {
846862 return false ;
847863 }
848864
865+ // Things that have a deprecated container and were not introduced before the
866+ // deprecation are not supported.
867+ let path = makeAvailabilityPath ( cluster , options ) ;
868+ let deprecationRelease = findDeprecationRelease ( this . global , findPathToContainer ( path ) , options ) ;
869+ if ( deprecationRelease !== undefined ) {
870+ let comparisonStatus = compareIntroductionToReferenceRelease ( this . global , path , options , deprecationRelease ) ;
871+ // The only case where we might be supported is if we have an explicit
872+ // introduction and the introduction comes before the ancestor deprecation.
873+ if ( comparisonStatus != - 1 ) {
874+ return false ;
875+ }
876+ }
877+
849878 let provisionalRelease = findReleaseForPathOrAncestorAndSection ( this . global , cluster , options , 'provisional' ) ;
850879 if ( provisionalRelease === undefined ) {
851880 // Default to enabled, even if not explicitly introduced.
852881 return true ;
853882 }
854883
855- let path = makeAvailabilityPath ( cluster , options ) ;
856884 while ( path !== undefined ) {
857885 let comparisonStatus = compareIntroductionToReferenceRelease (
858886 this . global ,
0 commit comments