import os

def check_file(filepath):
    try:
        with open(filepath, 'r', encoding='utf-8') as f:
            content = f.read()
            if '@TIER: CRITICAL' in content:
                if '@TEST_DATA' not in content:
                    return filepath
    except Exception as e:
        print(f"Error reading {filepath}: {e}")
    return None

missing_files = []
for root_dir in ['backend/src', 'frontend/src']:
    for dirpath, _, filenames in os.walk(root_dir):
        for name in filenames:
            ext = os.path.splitext(name)[1]
            if ext in ['.py', '.js', '.ts', '.svelte']:
                full_path = os.path.join(dirpath, name)
                res = check_file(full_path)
                if res:
                    missing_files.append(res)

print("Files missing @TEST_DATA:")
for f in missing_files:
    print(f)
