Skip to content

Batch 1: foundation (package layout, cuts, one-click install, tests, CI) - #1

Merged
Arvi23 merged 2 commits into
mainfrom
batch-1-foundation
Nov 4, 2026
Merged

Arvi23 merged 2 commits into
mainfrom
batch-1-foundation

Conversation

@Arvi23

@Arvi23 Arvi23 commented Nov 4, 2026

Copy link
Copy Markdown
Owner

First of five batches turning the hackathon prototype into a personal tool. Plan and status: docs/HANDOFF.md. Rationale: docs/DECISIONS.md.

What changed

  • Structure: main.py split into the watchstock/ package. All network access goes through watchstock/providers/ (yfinance, OpenRouter). See docs/ARCHITECTURE.md.
  • Cut: accounts/login, 8 admin endpoints, sentence-transformers + PyTorch (~2 GB), NewsAPI, Elasticsearch docs.
  • Install: start.bat is now the only step. It installs uv, which fetches Python and the pinned deps (uv.lock). The server listens on 127.0.0.1 only.
  • Bugs fixed:
    • Data was served from the DB forever. It now expires after 4h, the UI shows its age, and a REFRESH button forces a fetch.
    • Failed fetches and failed LLM replies were cached. They're now reported as errors and never stored.
    • Yahoo and LLM calls blocked the server. They run in threads now.
    • Chat sent each question twice.
    • Links in AI reports rendered as "undefined".
  • UX: the dashboard appears as soon as data is in, and the AI report generates in the background.
  • Tests: 40 pytest tests with fake providers (no network), ruff, CI on Ubuntu + Windows.

Not in this batch (on purpose)

Scoring formulas are unchanged except the news penalty, which needed the embedding model. Formula fixes are batch 2. Frontend split, vendored libs and DOMPurify are batch 3.

Needs live testing on Windows

Checklist in docs/HANDOFF.md under "Needs live testing".


Generated by Claude Code

Arvi23 and others added 2 commits November 4, 2026 03:04
Restructure the hackathon prototype into a maintainable personal app.

- Split the 2,100-line main.py into the watchstock/ package: app factory,
  routes (stocks, market, personal), services (snapshot freshness), scoring
  (pure functions), analysis (LLM prompts), store/db (SQL + migrations), and
  providers/ as the only network layer (yahoo via yfinance, openrouter).
- Remove multi-user accounts/login, admin CRUD endpoints, sentence-transformers
  (+PyTorch), NewsAPI and the Elasticsearch-era docs. News now comes from
  yfinance; search and screeners go through yfinance too.
- Fix: data was served from the DB forever. Snapshots now expire after 4h,
  carry `as_of`, and fall back to the last snapshot (flagged stale) if Yahoo fails.
- Fix: failed fetches and failed/invalid LLM replies were persisted. They are
  now returned as 502s with a readable message and never stored.
- Fix: yfinance and LLM calls blocked the event loop. They run in threads.
- Fix: chat sent the question twice. Fix: AI report links rendered as
  "undefined" (marked >= 13 renderer API).
- AI reports are stored separately with model + timestamp; the UI requests one
  after the dashboard loads instead of blocking the search on the LLM.
- Packaging: pyproject + uv.lock; start.bat installs uv and runs the app, uv
  fetches Python itself. Server binds 127.0.0.1 only, no auto-reload.
- 40 pytest tests with fake providers, ruff, GitHub Actions on Ubuntu + Windows.
- scripts/fake_server.py + scripts/ui_smoke.js for UI work without network.
- Docs: CLAUDE.md, docs/HANDOFF.md, docs/ARCHITECTURE.md, docs/DECISIONS.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TW7cJeWrcBW5SJHr4ZKtSH
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TW7cJeWrcBW5SJHr4ZKtSH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant