A third party ATProto appview
1#!/usr/bin/env python3
2"""
3Verification script - run this inside the Docker container to check if the fix is applied
4Usage: docker-compose exec python-backfill-worker python verify_code.py
5"""
6
7import inspect
8import importlib.util
9
10def check_code():
11 """Check if the fixed code is present"""
12 print("="*60)
13 print("CODE VERIFICATION SCRIPT")
14 print("="*60)
15
16 # Load the module
17 spec = importlib.util.spec_from_file_location("unified_worker", "/app/unified_worker.py")
18 module = importlib.util.module_from_spec(spec)
19
20 try:
21 spec.loader.exec_module(module)
22 print("\n✓ Module loaded successfully")
23 except Exception as e:
24 print(f"\n✗ Failed to load module: {e}")
25 return
26
27 # Get the source code of create_post_viewer_state
28 try:
29 source = inspect.getsource(module.UnifiedWorker.create_post_viewer_state)
30 print("\n" + "="*60)
31 print("SOURCE CODE OF create_post_viewer_state:")
32 print("="*60)
33 print(source[:1000]) # Print first 1000 chars
34
35 # Check for the problematic patterns
36 if "$NULL" in source or "$false" in source or ".replace" in source:
37 print("\n❌ OLD CODE DETECTED!")
38 print("The container is running the OLD buggy code.")
39 print("Found problematic patterns:")
40 if "$NULL" in source:
41 print(" - Found '$NULL'")
42 if "$false" in source:
43 print(" - Found '$false'")
44 if ".replace" in source:
45 print(" - Found '.replace'")
46 elif "{like_param}" in source and "{repost_param}" in source:
47 print("\n✅ NEW CODE DETECTED!")
48 print("The container is running the FIXED code.")
49 else:
50 print("\n⚠ UNKNOWN CODE VERSION")
51 print("Cannot determine if this is the old or new code.")
52
53 except Exception as e:
54 print(f"\n✗ Failed to get source: {e}")
55
56if __name__ == '__main__':
57 check_code()