test: leave generic routes out of the credential scope coverage check (#6105)

CredentialScopeCoverageTest failed wherever the botocore corpus is
present: it read Account Access (account-access) as 2/3 routes served,
because AppConfig and seven other services model /applications/{id} and
over a hundred model /tags/{arn}. Floci does not implement Account
Access.

Routes that three or more signing names model are now left out of every
count. Account Access drops to one route, below MIN_ROUTES. The IoT Jobs
Data Plane routes, which the check exists for, are each shared with iot
alone and stay in.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-20 23:36:12 -04:00
1 parent 94b09ff46b
commit 3baa38a346
1 file changed
+19 -2
@@ -56,6 +56,14 @@ class CredentialScopeCoverageTest {
private static final int MIN_ROUTES = 3;
/** Fraction of a service's routes Floci must already serve before its scope is expected. */
private static final double MIN_COVERAGE = 0.6;
/**
* A route this many signing names model is generic and says nothing about which of them Floci
* serves, so it is left out of every count. Without it Account Access ({@code account-access})
* reads as 2/3 served: AppConfig and seven others model {@code /applications/{id}}, and over a
* hundred model {@code /tags/{arn}}. The IoT Jobs Data Plane's routes are each shared with
* {@code iot} alone, so they stay in.
*/
private static final int GENERIC_ROUTE_OWNERS = 3;
@Inject
ResolvedServiceCatalog catalog;
@@ -70,10 +78,19 @@ class CredentialScopeCoverageTest {
.collect(Collectors.toSet());
Set<String> flociRoutes = flociRouteTemplates();
Map<String, Set<String>> modelled = routeTemplatesBySigningName();
Map<String, Long> signingNamesPerRoute = modelled.values().stream()
.flatMap(Set::stream)
.collect(Collectors.groupingBy(route -> route, Collectors.counting()));
Map<String, String> undeclared = new TreeMap<>();
modelled.forEach((signingName, routes) -> {
if (declared.contains(signingName) || routes.size() < MIN_ROUTES) {
modelled.forEach((signingName, modelledRoutes) -> {
if (declared.contains(signingName)) {
return;
}
List<String> routes = modelledRoutes.stream()
.filter(route -> signingNamesPerRoute.get(route) < GENERIC_ROUTE_OWNERS)
.toList();
if (routes.size() < MIN_ROUTES) {
return;
}
long served = routes.stream().filter(flociRoutes::contains).count();