carlos / platform Public

Leak test: allow-list placeholder identifiers, name no real ones

Review P3-1: the fixture leak check listed real dev instance IDs, box
refs and IPs. It now accepts only the placeholder instance and box IDs
and documentation-range addresses.
claude agent, operated by paul@keymail.dev 580c083858de30da271ab004725a344aedf900bc parent 21acf51
1 file changed, +12 −4
  • scripts/region_group_roll_test.py +12 −4

CI passed — run details

diff --git a/scripts/region_group_roll_test.py b/scripts/region_group_roll_test.py
index 5a22411d1..5805e4fe5 100644
--- a/scripts/region_group_roll_test.py
+++ b/scripts/region_group_roll_test.py
@@ -6,6 +6,7 @@ import io
import json
import os
import random
+import re
import time
from collections import Counter
from pathlib import Path
@@ -1482,16 +1483,23 @@ class LiveFixtureTests(unittest.TestCase):
self.assertEqual(list(status["permit"]), list(expected))
def test_fixtures_contain_no_live_identifiers(self):
- forbidden = ("640012953448", "carlos-dev", "i-003449ff2ae5b7352", "i-0dd24d205739a40bd",
- "i-046c7fe43620944bc", "i-05498eada6f0afd23", "g-24eac3e7f9be8cdabc7d",
- "g-4e8c7d600945c43b3424", "oncarlos.com", "172.31.", "fe80::",
- "34.242.161.154", "34.241.111.94", "18.203.21.74", "54.77.110.223")
+ # Allow-list the placeholder shapes instead of naming real identifiers here.
+ forbidden = ("640012953448", "carlos-dev", "oncarlos.com", "172.31.", "fe80::")
+ instances = {"i-0123456789abcdef0", "i-0fedcba9876543210",
+ "i-11111111111111111", "i-22222222222222222"}
+ boxes = {"g-00000000000000000000", "g-11111111111111111111"}
+ documentation = ("192.0.2.", "198.51.100.", "203.0.113.")
for path in live.DIRECTORY.rglob("*"):
if path.is_file():
body = path.name + path.read_text()
for value in forbidden:
with self.subTest(file=path.name, forbidden=value):
self.assertNotIn(value, body)
+ with self.subTest(file=path.name, kind="identifiers"):
+ self.assertLessEqual(set(re.findall(r"\bi-[0-9a-f]{8,17}\b", body)), instances)
+ self.assertLessEqual(set(re.findall(r"\bg-[0-9a-f]{20}\b", body)), boxes)
+ for address in re.findall(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b", body):
+ self.assertTrue(address.startswith(documentation), address)
class AdapterTests(unittest.TestCase):