mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
chore(tooling): gate partition literals in src/main against a per-file baseline (#4270)
P0 of the multi-partition plan. tools/partition/partition_literals.py inventories the arn:aws: prefixes, amazonaws.com hosts, hosted-zone ids and hand-rolled partition regexes in src/main/java per file against tools/partition/baseline.tsv. A literal in a new file fails, growth in an existing file fails, and a drop fails until the baseline is regenerated, so the remaining count only shrinks. Escapes are a `// partition-literal: <reason>` comment or an allowlist.yaml entry. Makefile targets (partition-check, partition-baseline, partition-audit, partition-test), a python-only workflow, AGENTS.md and CONTRIBUTING.md paragraphs, and the ResourceExplorer2 assertion now checks the partition against the ARN's region instead of a literal arn:aws:.
This commit is contained in:
1 parent
836161e1ff
commit
0a601d54eb
10 files changed
+1062
-3
No files matched your search
+13
-2
@@ -1,5 +1,8 @@
|
||||
package io.github.hectorvent.floci.services.resourceexplorer2;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils.Arn;
|
||||
import io.github.hectorvent.floci.core.common.AwsRegions;
|
||||
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
@@ -1503,8 +1506,16 @@ class ResourceExplorer2IntegrationTest {
|
||||
for (var resource : resources) {
|
||||
String arn = (String) resource.get("Arn");
|
||||
String service = (String) resource.get("Service");
|
||||
assertTrue(arn.startsWith("arn:aws:"),
|
||||
"ARN must start with arn:aws:, got: " + arn);
|
||||
Arn parsed = AwsArnUtils.parse(arn);
|
||||
String expectedPartition = AwsRegions.partitionFor(parsed.region());
|
||||
// Only commercial regions are held to their partition here: resources another test
|
||||
// leaves in a China or GovCloud region are still minted arn:aws: by build sites that
|
||||
// have not moved to Arn.of yet, which the partition plan's build-site phase fixes and
|
||||
// then tightens this assertion to every region.
|
||||
if ("aws".equals(expectedPartition)) {
|
||||
assertEquals(expectedPartition, parsed.partition(),
|
||||
"ARN partition must be the one its region belongs to, got: " + arn);
|
||||
}
|
||||
assertTrue(arn.contains(service),
|
||||
"ARN should contain service '" + service + "', got: " + arn);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user