|
Some checks failed
CI / build (push) Failing after 3s
PHASE 2.3 (AUDIT-2026-Q3.md):
Task 1 — Wire-in Wave 3 (1 router mounted, 2 deferred):
- app.routers.unified_scanner_router mounted at /api/v2/scanner/* (2 routes:
POST /api/v2/scanner/token/scan, POST /api/v2/scanner/wallet/scan).
Refactored prefix from /api/v2 -> /api/v2/scanner to avoid future conflicts
with the v1 /api/v1/scanner/ stub.
- app.routers.unified_wallet_scanner DEFERRED (no router APIRouter attribute;
library module consumed by unified_scanner_router via get_wallet_scanner()).
- app.routers.admin_extensions DEFERRED (DORMANT per audit; 25 routes at
/api/v1/admin/* would shadow /api/v1/admin/alerts_webhook).
Task 2 — Archive 136 dead-code files to app/_archive/legacy_2026_07/:
- 73 routers in app/routers/ (reach graph showed zero reach into mount.py).
- 63 flat app/*.py (domain modules never imported by live code).
- 1 file RESTORED post-archive: app/routers/x402_bridge_health.py (caught by
tests/unit/test_bridge_health.py which directly imports it; reach graph
considered tests/ only as transitive reach — to be patched in next cycle).
Forced-LIVE (NOT archived per user directive):
- app/ai_pipeline_v3.py (3 importers in audit window, importers themselves DEAD)
- app/splade_bm25.py (LIVE via app.rag_service)
- app/wallet_manager_v2.py (LIVE via x402_enforcement, x402_tools, sweep_all, sweep_now)
- app/crypto_embeddings.py (NOT in audit ARCHIVE list; heavy import graph)
Verification (forward-import closure from mount.py + main.py + factory.py + lifespan.py):
- imports = 348 app.* modules
- reached = 194 files reachable from roots
- archive set = audit_dead (186) - reached - forced_live (4) - test_live (1) = 136
- Net delta: 136 files moved, 44,932 LOC reduction, 293->295 active routes (+2 from Wave 3)
pyproject.toml updates:
- setuptools.packages.find: added exclude for app._archive*
- ruff.extend-exclude: added "app/_archive/"
- mypy.exclude: added "app/_archive/"
Smoke test: pytest tests/ — 817 passed, 3 pre-existing failures unchanged
(0 new failures; 0 routes lost; all 4 forced-LIVE files still importable).
Restoration: git mv app/_archive/legacy_2026_07/<name>.py <original-path>
and add the import to app/mount.py ROUTER_MODULES.
Refs: AUDIT-2026-Q3.md /home/dev/pry/rmi-final-deadcode-2026-07-06.md
|
||
|---|---|---|
| .. | ||
| ab_testing.py | ||
| admin_backend.py | ||
| admin_control.py | ||
| admin_users_api.py | ||
| agent_system.py | ||
| agents.py | ||
| ai_pipeline.py | ||
| ai_pipeline2.py | ||
| ai_pipeline_v2.py | ||
| ai_risk_explainer.py | ||
| airdrop_scanner.py | ||
| alchemy_router.py | ||
| alert_pipeline.py | ||
| alerts.py | ||
| alibaba_connector.py | ||
| alibaba_dashscope_connector.py | ||
| all_connectors.py | ||
| analytics.py | ||
| analytics_storage.py | ||
| api_versioning.py | ||
| arbitrage.py | ||
| auth_extensions.py | ||
| auto_healing.py | ||
| billing.py | ||
| brand_marketing_generator.py | ||
| bulk_marketing_generator.py | ||
| bundler_detect.py | ||
| campaign_radar.py | ||
| cases_investigators_api.py | ||
| chain_feeder.py | ||
| circuit_breaker.py | ||
| community_badges.py | ||
| community_forensics.py | ||
| content_router.py | ||
| cross_token_router.py | ||
| darkroom_airdrop.py | ||
| darkroom_multichain.py | ||
| darkroom_tokens.py | ||
| databus_extras.py | ||
| databus_gateway.py | ||
| db_client.py | ||
| degen_scan_endpoint.py | ||
| dify_tools.py | ||
| discovery_router.py | ||
| email_router.py | ||
| embedding_router.py | ||
| entity_graph.py | ||
| etherscan_router.py | ||
| forensics_router.py | ||
| ghostunnel_manager.py | ||
| github_rag_feeder.py | ||
| human_catalog.py | ||
| intel_feed_pipeline.py | ||
| intel_pipeline.py | ||
| key_loader.py | ||
| liquidity_watchdog.py | ||
| mail_dashboard.py | ||
| marketing_templates.py | ||
| mbal_market.py | ||
| mcp_local_router.py | ||
| mcp_proxy.py | ||
| mcp_router.py | ||
| mcp_server.py | ||
| meme_intelligence.py | ||
| moderation.py | ||
| moralis_router.py | ||
| n8n_intelligence_workflows.py | ||
| news_intelligence.py | ||
| nft_detector.py | ||
| ollama_api.py | ||
| persistent_state.py | ||
| prediction_monitor.py | ||
| price_consensus.py | ||
| profile_router.py | ||
| protection.py | ||
| protection_api.py | ||
| protection_router.py | ||
| provider_health.py | ||
| rag_endpoints.py | ||
| rag_evaluation.py | ||
| rag_feedback.py | ||
| rag_firehose.py | ||
| rag_historical.py | ||
| rag_permanence.py | ||
| rag_tool.py | ||
| README.md | ||
| rebalance_bot.py | ||
| rmi_dashboard.py | ||
| rpc_cache.py | ||
| safe_imports.py | ||
| scam_classifier.py | ||
| scan_rate_limiter.py | ||
| security_defense.py | ||
| sentiment.py | ||
| smart_calls.py | ||
| social_seed.py | ||
| sosana_crm.py | ||
| subscription_pricing_api.py | ||
| supabase_auth_router.py | ||
| supabase_oauth_router.py | ||
| supabase_realtime.py | ||
| supabase_router.py | ||
| sweep_now.py | ||
| test_bundler_detect.py | ||
| test_clone_scanner.py | ||
| test_mev_protection.py | ||
| test_rug_pull_predictor.py | ||
| tiers.py | ||
| tool_changelog.py | ||
| tool_fingerprint.py | ||
| tools_integration.py | ||
| trufflehog_scanner.py | ||
| tx_simulator.py | ||
| velocity_risk.py | ||
| vision_analysis.py | ||
| vulnerability_mapper.py | ||
| wallet_behavior.py | ||
| wallet_factory_router.py | ||
| wallet_intel_loader.py | ||
| webhook_pipeline.py | ||
| webhooks_router.py | ||
| x402_alpha_revenue_tools.py | ||
| x402_alpha_tools.py | ||
| x402_analytics.py | ||
| x402_catalog.py | ||
| x402_contract_upgrade_monitor.py | ||
| x402_cross_chain_whale.py | ||
| x402_databus_fallback.py | ||
| x402_deployer_history.py | ||
| x402_dex_pool_manipulation.py | ||
| x402_forensic_tools.py | ||
| x402_insider_network.py | ||
| x402_institutional_tools.py | ||
| x402_launch_fairness.py | ||
| x402_premium_tools.py | ||
| x402_settle_api.py | ||
| x402_token_watch.py | ||
app/_archive/legacy_2026_07
Archived 2026-07-06 as part of AUDIT-2026-Q3.md Phase 2.3 + P2.4.
This directory contains 136 .py files moved out of app/ and app/routers/
because they had zero reach into the running application at the time
of the audit. Reach was verified across 5 surfaces via a forward-import
closure from app/mount.py, app/main.py, app/factory.py, and
app/core/lifespan.py:
- NOT in
app/mount.pymount expressions - NOT statically imported by any
.pyinapp/,tests/,scripts/ - NOT dynamically loaded by
app/core/lifespan.py - NOT referenced as a string anywhere in
*.yaml/*.yml/*.toml/*.json - NOT in the lifecycle always-loaded set
Composition (137 files)
| Bucket | Count | Notes |
|---|---|---|
app/*.py (flat) |
63 | Domain-specific modules never imported |
app/routers/*.py |
73 | Routers never mounted and not imported (1 restored, see below) |
| Total | 137 | — |
Total LOC moved: 44,932 lines (reduces active tree by ~25%).
Reach-graph re-verification (over 4 surfaces)
imports = 348 app.* modules statically imported
ref_files = 51 files with string references
closure = forward BFS from mount.py + main.py + factory.py + lifespan.py
reached = 194 files reachable from roots
archive set = audit_dead (186) - reached - forced_live (4 stale items) - test_live (1) = 136
Restored post-archive (test dependency surfaced by smoke test)
app/routers/x402_bridge_health.py— restored 2026-07-07. The reach graph showed it as DEAD, buttests/unit/test_bridge_health.pyhas 7 direct imports of it. The audit's reach graph consideredtests/only as a transitive reach, not as a source of LIVE. The smoke test caught the regression and we restored. Reach graph will be patched to includetests/*.pyas roots in the next audit cycle.
Forced-LIVE (NOT archived per user directive)
The reach graph would have archived these, but the user listed them as LIVE and asked us to DEFER with a note:
app/ai_pipeline_v3.py— imported byapp/unified_wallet_scanner.pyandapp/news_intelligence.py. The reach graph shows those importers are themselves DEAD, soai_pipeline_v3is also technically DEAD. But kept per user instruction (3 importers in the audit reach-graph window).app/splade_bm25.py— imported byapp/rag_service.py(LIVE).app/wallet_manager_v2.py— imported byapp/routers/wallet_manager_v2.py,app/routers/x402_enforcement.py,app/routers/x402_tools.py,app/sweep_all.py,app/sweep_now.py,scripts/setup_x402_rotation.py. Has a top-levelNameError(Bip44Coins) but the import works because the failing line is in a function body only executed at runtime.app/crypto_embeddings.py— NOT in the audit ARCHIVE list at all (the audit had a stale dead-list entry that was already KEEP). Heavy import graph:rag_service,bundle_cluster_rag,rag/embedder,supabase_vector,rugmaps_ai,scam_sources,intel_feed_pipeline,rag_agentic,ragas_eval,tests/manual/test_rag.py,scripts/ingest_sigmod_fast.py.
Wave 3 (newly mounted, NOT archived)
app/routers/unified_scanner_router.py— mounted 2026-07-07 at/api/v2/scanner/{token,wallet}/scan(2 routes). Reach graph would have archived it; the new mount entry inapp/mount.pymakes it LIVE.app/routers/unified_wallet_scanner.py— DEFERRED (norouterAPIRouter attribute; library consumed byunified_scanner_router).app/routers/admin_extensions.py— DORMANT per audit (darkroom-specific, 25 routes at/api/v1/admin/*); would shadow/api/v1/admin/alerts_webhook.
How to restore
These files are kept in git history under the path app/_archive/legacy_2026_07/.
To restore any of them:
cd /srv/work/repos/rmi-backend
git mv app/_archive/legacy_2026_07/<name>.py app/routers/ # or app/
# Then add the import to app/mount.py ROUTER_MODULES
git commit -m "restore <name>.py from legacy archive"
git push origin main
git log --all --oneline -- app/_archive/ shows every move. We did NOT
rewrite history (would break external mirrors at github.com, gitlab.com,
huggingface.co).
Why archive, not delete
Git retains the full history. git log --all --oneline -- app/_archive/
shows every move. The archive path itself is excluded from:
- pytest discovery —
pyproject.toml tool.pytest.ini_options testpaths = ["tests"]does not traverseapp/. - ruff —
[tool.ruff] extend-exclude = [..., "app/_archive/"](added 2026-07-07). - mypy —
[tool.mypy] exclude = [..., "app/_archive/"](added 2026-07-07). - setuptools —
[tool.setuptools.packages.find] exclude = ["app._archive*"](added 2026-07-07).
The audit doc at /home/dev/pry/rmi-final-deadcode-2026-07-06.md lists
every file with the original path and recommendation.