read.markets/app/routers
Giorgio Gilestro 833d1775ab routers: extract chat + ops from api.py
api.py was 933 lines mixing four distinct concerns: indicators +
news + strategic log (the JSON/HTMX API proper), the chat endpoint
+ its three private helpers (~200 lines), and the two HTML-only ops
endpoints /markets-bar + /health (~150 lines).

Extracted:
- app/routers/chat.py — POST /api/chat + _latest_quotes_by_group_chat,
  _thesis_headlines_for_chat, _month_spend
- app/routers/ops.py — GET /api/markets-bar + GET /api/health +
  _fmt_price helper

Both new routers use the same dependencies=[Depends(require_token)]
as api.py and are mounted at the /api prefix in app/main.py.
URL surface is byte-identical with no externally-visible change.

api.py shrinks to ~620 lines focused on indicators+news+log+settings.

Helpers shared with the original api.py (_md_to_html, _resolve_tone_param)
are imported from app.routers.api where needed in chat.py to avoid
duplication.

Also updated tests/test_chat_and_log_gates.py to mount chat_router
in its local test app, since /api/chat now lives there.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 21:43:17 +02:00
..
__init__.py initial commit — cassandra v0.1 2026-05-15 21:56:10 +01:00
api.py routers: extract chat + ops from api.py 2026-05-27 21:43:17 +02:00
auth.py ui: collapsible settings sections + welcome-email + larger auth inputs 2026-05-26 22:32:59 +02:00
chat.py routers: extract chat + ops from api.py 2026-05-27 21:43:17 +02:00
email.py email: tighten unsubscribe — test isolation, accurate comments, tighter assertion 2026-05-25 23:10:29 +02:00
ops.py routers: extract chat + ops from api.py 2026-05-27 21:43:17 +02:00
pages.py log: remove dead _resolve_log_content helper from pages.py 2026-05-27 20:39:28 +02:00
polar_webhook.py stripe: per-cadence cooling-off + manage-subscription button 2026-05-26 20:06:19 +02:00
public.py stripe: wire checkout, customer portal, and webhook for read.markets 2026-05-26 18:45:13 +02:00
stripe_billing.py referrals: close D.3 — both parties get 45 days credit on conversion 2026-05-26 23:05:29 +02:00
sync.py sync: detect orphaned blobs (pepper rotation) + fix AESGCM arg order 2026-05-25 12:49:11 +02:00
ticker_validate.py ticker-validate: add /api/ticker/historical with weekend-walkback 2026-05-27 14:45:52 +02:00
universe.py cleanup: drop stale tombstones and dead config fields 2026-05-27 19:25:33 +02:00