SciDEX grows fast — 367 Python files, 124K LOC, 30K-line god file, 48 duplicate
function definitions. This quest applies conservative, continuous pressure to improve
code quality without removing important functionality or destabilizing the system.
Principles:
Recurring Sweep ──> (informs priorities for all below)
Fix Migrations (independent, quick win)
Add Linting (independent, infrastructure)
Archive Dead Code ──> Organize File Sprawl
Consolidate DB Patterns ──┐
├──> Break Apart api.py
Consolidate Utility Fns ──┘Every code health change MUST:
# Is this file imported anywhere?
grep -r "import filename" --include="*.py" .
grep -r "from filename" --include="*.py" .
# Is it in a systemd service?
grep -r "filename" /etc/systemd/system/scidex-*.service
# Is it in a cron job?
crontab -l | grep filenamefor page in / /exchange /analyses/ /graph /gaps /senate /forge; do
code=$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:8000${page}")
echo "${code} ${page}"
done
curl -s http://localhost:8000/api/status | python3 -m json.toolarchive/ directory, not deletedquality_gates.py — existing pre-merge quality gates (extend, don't replace)quality_review.py — existing syntax validation for core filesapi.py — primary refactoring target (30K lines)tools.py — second largest file (3,337 lines)