Add no-op trimming flag.

Subsequent safety changes will use this flag before the flag has any effect;
for now, it is a no-op, equivalent to specifying --experimental_dynamic_configs
equal to notrim (the default).

Progress on #6524.

PiperOrigin-RevId: 242741331
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
index 6bc26ec..73fbc53 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
@@ -828,13 +828,24 @@
 
     /** Values for --experimental_dynamic_configs. */
     public enum ConfigsMode {
-      /** Only include the configuration fragments each rule needs. */
+      /**
+       * Deprecated mode: Each configured target is evaluated with only the configuration fragments
+       * it needs by loading the target graph and examining the transitive requirements for each
+       * target before analysis begins.
+       *
+       * <p>To become a no-op soon: b/129289764
+       */
       ON,
-      /** Always including all fragments known to Blaze. */
+      /** Default mode: Each configured target is evaluated with all fragments known to Blaze. */
       NOTRIM,
+      /**
+       * Experimental mode: Each configured target is evaluated with only the configuration
+       * fragments it needs by visiting them with a full configuration to begin with and collapsing
+       * the configuration down to the fragments which were actually used.
+       */
+      RETROACTIVE;
     }
 
-
     /**
      * Converter for --experimental_dynamic_configs.
      */
@@ -1758,6 +1769,14 @@
   }
 
   /**
+   * Returns whether we should trim configurations to only include the fragments needed to correctly
+   * analyze a rule.
+   */
+  public boolean trimConfigurationsRetroactively() {
+    return options.configsMode == Options.ConfigsMode.RETROACTIVE;
+  }
+
+  /**
    * Returns compilation mode.
    */
   public CompilationMode getCompilationMode() {