Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Commit 993dfad

Browse files
Merge pull request #313 from balancer/debug/raw-githubusercontent-v3
Debug/raw githubusercontent v3
2 parents 65d3c59 + 5a19c70 commit 993dfad

1 file changed

Lines changed: 31 additions & 57 deletions

File tree

.github/workflows/debug_raw_githubusercontent.yaml

Lines changed: 31 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -21,78 +21,52 @@ jobs:
2121
- name: Debug
2222
run: |
2323
python3 << 'PYEOF'
24-
import sys, json
25-
print(f"Python: {sys.version}")
24+
import sys, json, importlib, traceback
25+
print(f"python: {sys.version}")
2626
27-
# Check if json module has been monkey-patched
28-
print(f"\n=== json module identity ===")
29-
print(f"json module: {json}")
30-
print(f"json.loads: {json.loads}")
31-
print(f"json.JSONDecoder: {json.JSONDecoder}")
32-
33-
# Check if json_fix is installed and what it does
34-
try:
35-
import json_fix
36-
print(f"json_fix version: {json_fix.__version__ if hasattr(json_fix, '__version__') else 'unknown'}")
37-
print(f"json.loads after json_fix: {json.loads}")
38-
except ImportError:
39-
print("json_fix not installed")
40-
41-
# Check what requests uses for JSON
27+
# 1) Baseline: test URL fetch with just requests (before any bal_* imports)
4228
import requests
43-
print(f"\n=== requests JSON backend ===")
4429
print(f"requests: {requests.__version__}")
45-
from requests.compat import complexjson
46-
print(f"complexjson: {complexjson}")
47-
print(f"complexjson.loads: {complexjson.loads}")
48-
49-
# Check if simplejson is available
30+
url = "https://raw.githubusercontent.com/balancer/bal_addresses/refs/heads/main/extras/chains.json"
31+
resp = requests.get(url)
32+
print(f"\npre-import fetch: status={resp.status_code} len={len(resp.content)}")
33+
print(f" bytes[:50] = {resp.content[:50]}")
5034
try:
51-
import simplejson
52-
print(f"simplejson: {simplejson.__version__}")
53-
except ImportError:
54-
print("simplejson not installed")
35+
resp.json()
36+
print(f" json(): OK")
37+
except Exception as e:
38+
print(f" json(): FAILED - {e}")
5539
56-
# Test the exact URLs used at import time
57-
print(f"\n=== Testing raw.githubusercontent.com URLs ===")
58-
urls = [
59-
"https://raw.githubusercontent.com/balancer/bal_addresses/refs/heads/main/extras/chains.json",
60-
"https://raw.githubusercontent.com/balancer/bal_addresses/main/extras/chains.json",
61-
"https://raw.githubusercontent.com/balancer/bal_addresses/main/extras/func_desc_by_name.json",
62-
]
63-
for url in urls:
64-
resp = requests.get(url)
65-
print(f"\n{url}")
66-
print(f" Status: {resp.status_code}")
67-
print(f" Encoding: {resp.encoding}")
68-
print(f" Bytes[:20]: {resp.content[:20]}")
69-
print(f" Text[:100]: {repr(resp.text[:100])}")
40+
# 2) Import every dep that gets loaded before bal_tools.utils
41+
# to see if any of them break json/requests
42+
print("\n--- importing deps one by one ---")
43+
for mod in ["web3", "gql", "pydantic", "munch", "dotmap", "json_fix", "lxml", "pandas", "numpy"]:
7044
try:
71-
resp.json()
72-
print(f" json(): OK")
45+
importlib.import_module(mod)
46+
print(f" {mod}: OK")
7347
except Exception as e:
74-
print(f" json(): FAILED - {e}")
48+
print(f" {mod}: FAILED ({e})")
7549
76-
# Test the actual import chain that fails in CI
77-
print(f"\n=== Importing bal_tools (the first thing that crashes) ===")
50+
# 3) After all deps loaded, test the same URL again
51+
resp2 = requests.get(url)
52+
print(f"\npost-import fetch: status={resp2.status_code} len={len(resp2.content)}")
53+
print(f" bytes[:50] = {resp2.content[:50]}")
7854
try:
79-
from bal_tools.utils import CHAINS
80-
print(f"OK - keys: {list(CHAINS.keys())}")
55+
resp2.json()
56+
print(f" json(): OK")
8157
except Exception as e:
82-
print(f"FAILED: {type(e).__name__}: {e}")
58+
print(f" json(): FAILED - {e}")
8359
84-
print(f"\n=== Importing bal_addresses ===")
85-
try:
86-
from bal_addresses import AddrBook
87-
print(f"OK - chains: {list(AddrBook.chain_ids_by_name.keys())[:5]}")
88-
except Exception as e:
89-
print(f"FAILED: {type(e).__name__}: {e}")
60+
# 4) Check if json.loads itself was modified
61+
print(f"\njson.loads is stdlib: {json.loads.__module__ == 'json'}")
62+
print(f"json.loads: {json.loads}")
9063
91-
# Test the exact import main_combined.py does
92-
print(f"\n=== Importing fee_allocator (exact CI import chain) ===")
64+
# 5) Try the actual import that crashes in CI
65+
print("\n=== from fee_allocator.fee_allocator import FeeAllocator ===")
9366
try:
9467
from fee_allocator.fee_allocator import FeeAllocator
9568
print("OK")
9669
except Exception as e:
9770
print(f"FAILED: {type(e).__name__}: {e}")
71+
traceback.print_exc()
9872
PYEOF

0 commit comments

Comments
 (0)