fix: resolve review feedback I1-I7 including ISO 8601 dates, footer address, readme routes, and strict verify_counts gate
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
CONTENT_DIR = os.path.join(BASE_DIR, "refer_landing_page", "content")
|
||||
|
||||
sys.path.insert(0, os.path.join(BASE_DIR, "refer_landing_page", "scripts", "extract"))
|
||||
|
||||
def verify():
|
||||
# Import generated modules or json
|
||||
from generate_all import parse_members, parse_publications, parse_lectures, parse_standards
|
||||
|
||||
active_m, alumni_m = parse_members()
|
||||
@@ -19,15 +17,16 @@ def verify():
|
||||
total_pubs = len(intl_p) + len(dom_p) + len(pat_p)
|
||||
std_docs_count = sum(len(p["documents"]) for b in bodies for p in b["projects"])
|
||||
|
||||
print("=== DATA VERIFICATION GATE (AC-07 / AC-08) ===")
|
||||
print("=== DATA VERIFICATION GATE (AC-07 / AC-08 / AC-10 / AC-11) ===")
|
||||
print(f"Active Members: {len(active_m)} (Expected: 16)")
|
||||
print(f"Alumni: {len(alumni_m)} (Expected: 60)")
|
||||
print(f"International Papers: {len(intl_p)} (Expected: 68)")
|
||||
print(f"Domestic Papers: {len(dom_p)} (Expected: 80)")
|
||||
print(f"Patents: {len(pat_p)} (Expected: 75)")
|
||||
print(f"Total Publications: {total_pubs} (Expected: 223)")
|
||||
print(f"Lectures Semesters: {len(semesters)} (Expected: 45)")
|
||||
print(f"Standard Bodies: {len(bodies)} (Expected: 6)")
|
||||
print(f"Standard Documents: {std_docs_count} (Expected: ~55)")
|
||||
print(f"Standard Documents: {std_docs_count} (Expected: 44)")
|
||||
|
||||
errors = []
|
||||
if len(active_m) != 16:
|
||||
@@ -42,9 +41,35 @@ def verify():
|
||||
errors.append(f"Patents count mismatch: got {len(pat_p)}, expected 75")
|
||||
if total_pubs != 223:
|
||||
errors.append(f"Total Publications count mismatch: got {total_pubs}, expected 223")
|
||||
if len(semesters) != 45:
|
||||
errors.append(f"Semesters count mismatch: got {len(semesters)}, expected 45")
|
||||
if len(bodies) != 6:
|
||||
errors.append(f"Standard Bodies count mismatch: got {len(bodies)}, expected 6")
|
||||
if std_docs_count != 44:
|
||||
errors.append(f"Standard Documents count mismatch: got {std_docs_count}, expected 44")
|
||||
|
||||
# Date ISO 8601 validation (AC-11)
|
||||
content_dir = os.path.join(BASE_DIR, "content")
|
||||
for fname in ["members.ts", "publications.ts", "lectures.ts", "standards.ts"]:
|
||||
fpath = os.path.join(content_dir, fname)
|
||||
if not os.path.exists(fpath):
|
||||
errors.append(f"Missing content file: {fname}")
|
||||
continue
|
||||
with open(fpath, "r", encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
|
||||
# Check BOM (AC-10)
|
||||
if text.startswith('\ufeff'):
|
||||
errors.append(f"BOM found in {fname}")
|
||||
|
||||
# Check dates
|
||||
dates = re.findall(r'"(publishedAt|applicationAt|registrationAt|graduatedAt)": "([^"]+)"', text)
|
||||
for k, d in dates:
|
||||
if not re.match(r'^\d{4}(-\d{2})?(-\d{2})?$', d):
|
||||
errors.append(f"Non-ISO 8601 date in {fname}: {k}='{d}'")
|
||||
|
||||
if errors:
|
||||
print("\n❌ VERIFICATION FAILED:")
|
||||
print("\n❌ DATA VERIFICATION FAILED:")
|
||||
for err in errors:
|
||||
print(f" - {err}")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user