Skip to content

Commit b2c5cf0

Browse files
committed
chore: Integrate semantic UI collision check into health suite
1 parent 846acd3 commit b2c5cf0

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

scripts/check_health.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,39 @@ def check_screenshot_staleness():
8787

8888
return all_pass
8989

90+
def check_ui_collisions():
91+
print("\n--- Checking UI Collisions ---")
92+
metadata_files = ["review/void_main.json", "review/spire_flow.json", "review/world_map.json", "review/mixing_table.json"]
93+
all_pass = True
94+
95+
# Import semantic_review logic
96+
sys.path.append("scripts")
97+
try:
98+
from semantic_review import detect_collisions
99+
except ImportError:
100+
print("[ERROR] semantic_review.py not found.")
101+
return False
102+
103+
for meta in metadata_files:
104+
if not os.path.exists(meta):
105+
print(f"[FAIL] Metadata missing: {meta}")
106+
all_pass = False
107+
continue
108+
109+
with open(meta, "r") as f:
110+
data = json.load(f)
111+
buttons = data.get("Buttons", [])
112+
collisions = detect_collisions(buttons)
113+
if collisions:
114+
print(f"[FAIL] Collisions in {meta}:")
115+
for c in collisions:
116+
print(f" - {c[0]} overlaps with {c[1]}")
117+
all_pass = False
118+
else:
119+
print(f"[SUCCESS] No collisions in {meta}")
120+
121+
return all_pass
122+
90123
def check_monoliths():
91124
print("--- Checking for Monoliths (> 250 lines) ---")
92125
monolith_count = 0
@@ -196,12 +229,13 @@ def export_shields_data(monolith_count, coverage, docs_pass, tests_pass, screens
196229
cov_val, cov_pass = parse_coverage()
197230
d_pass = check_docs_staleness()
198231
s_pass = check_screenshot_staleness()
232+
u_pass = check_ui_collisions()
199233

200234
t_pass = cov_val > 0 and cov_pass and tests_passed
201235

202236
export_shields_data(m_count, cov_val, d_pass, t_pass, s_pass)
203237

204-
if m_count > 0 or not cov_pass or not d_pass or not tests_passed or not s_pass:
238+
if m_count > 0 or not cov_pass or not d_pass or not tests_passed or not s_pass or not u_pass:
205239
print("\n[FAIL] Health checks failed.")
206240
sys.exit(1)
207241

0 commit comments

Comments
 (0)