Propagate `RuleClassProvider#getNetworkAllowlistForTests` to the `BazelStarlarkContext` used on BUILD threads.
This is important `testing.analysis_test` can cause rule classes to be defined on BUILD threads. (Normally, Starlark-defined rule classes can be defined only on bzl threads).
@@ -673,7 +673,7 @@ public final class PackageFactory {
/* fragmentNameToClass= */ null,
new SymbolGenerator<>(pkgBuilder.getPackageIdentifier()),
/* analysisRuleLabel= */ null,
- /*networkAllowlistForTests=*/ null)
+ ruleClassProvider.getNetworkAllowlistForTests().orElse(null))
.storeInThread(thread);
// TODO(adonovan): save this as a field in BazelStarlarkContext.
