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

Commit 2b6541c

Browse files
debug: replicate exact CI environment, check json monkey-patching
1 parent bfbacc0 commit 2b6541c

1 file changed

Lines changed: 80 additions & 30 deletions

File tree

.github/workflows/debug_raw_githubusercontent.yaml

Lines changed: 80 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,92 @@ jobs:
77
debug:
88
runs-on: ubuntu-latest
99
steps:
10-
- name: Test raw.githubusercontent.com responses
11-
run: |
12-
for URL in \
13-
"https://raw.githubusercontent.com/balancer/bal_addresses/refs/heads/main/extras/chains.json" \
14-
"https://raw.githubusercontent.com/balancer/bal_addresses/main/extras/chains.json" \
15-
"https://raw.githubusercontent.com/BalancerMaxis/bal_addresses/main/extras/chains.json"; do
16-
echo "=== $URL ==="
17-
echo "--- Headers ---"
18-
curl -sI "$URL"
19-
echo "--- Status code ---"
20-
curl -s -o /dev/null -w "HTTP %{http_code}\n" "$URL"
21-
echo "--- First 200 bytes ---"
22-
curl -s "$URL" | head -c 200
23-
echo ""
24-
echo ""
25-
done
26-
27-
- name: Test Python requests behavior
10+
- name: Checkout
11+
uses: actions/checkout@v6
12+
13+
- name: Setup Python 3.10
14+
uses: actions/setup-python@v6
15+
with:
16+
python-version: "3.10"
17+
18+
- name: Install dependencies (same as trigger_fee_collection)
19+
run: pip3 install -r requirements.txt
20+
21+
- name: Debug
2822
run: |
29-
pip3 install requests
30-
python3 -c "
23+
python3 << 'PYEOF'
24+
import sys, json
25+
print(f"Python: {sys.version}")
26+
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
3142
import requests
43+
print(f"\n=== requests JSON backend ===")
44+
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
50+
try:
51+
import simplejson
52+
print(f"simplejson: {simplejson.__version__}")
53+
except ImportError:
54+
print("simplejson not installed")
55+
56+
# Test the exact URLs used at import time
57+
print(f"\n=== Testing raw.githubusercontent.com URLs ===")
3258
urls = [
33-
'https://raw.githubusercontent.com/balancer/bal_addresses/refs/heads/main/extras/chains.json',
34-
'https://raw.githubusercontent.com/balancer/bal_addresses/main/extras/chains.json',
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",
3562
]
3663
for url in urls:
37-
print(f'=== {url} ===')
3864
resp = requests.get(url)
39-
print(f'Status: {resp.status_code}')
40-
print(f'Content-Type: {resp.headers.get(\"content-type\")}')
41-
print(f'Body[:200]: {resp.text[:200]}')
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])}")
4270
try:
4371
resp.json()
44-
print('json(): OK')
72+
print(f" json(): OK")
4573
except Exception as e:
46-
print(f'json(): FAILED - {e}')
47-
print()
48-
"
74+
print(f" json(): FAILED - {e}")
75+
76+
# Test the actual import chain that fails in CI
77+
print(f"\n=== Importing bal_tools (the first thing that crashes) ===")
78+
try:
79+
from bal_tools.utils import CHAINS
80+
print(f"OK - keys: {list(CHAINS.keys())}")
81+
except Exception as e:
82+
print(f"FAILED: {type(e).__name__}: {e}")
83+
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}")
90+
91+
# Test the exact import main_combined.py does
92+
print(f"\n=== Importing fee_allocator (exact CI import chain) ===")
93+
try:
94+
from fee_allocator.fee_allocator import FeeAllocator
95+
print("OK")
96+
except Exception as e:
97+
print(f"FAILED: {type(e).__name__}: {e}")
98+
PYEOF

0 commit comments

Comments
 (0)