Skip to content

Address market data backend review findings - #155

Closed
raunaksachdev wants to merge 10 commits into
ed-donner:mainfrom
raunaksachdev:fix/market-data-review
Closed

Address market data backend review findings#155
raunaksachdev wants to merge 10 commits into
ed-donner:mainfrom
raunaksachdev:fix/market-data-review

Conversation

@raunaksachdev

Copy link
Copy Markdown

Summary

  • Closes the one open coverage gap from planning/MARKET_DATA_REVIEW.md: stream.py was untested (0% on the SSE generator/route); now at 100% via generator-level and route-handler-level tests (backend/tests/market/test_stream.py). Note: the httpx ASGITransport / FastAPI TestClient recipe suggested in MARKET_DATA_DESIGN.md §12.4 deadlocks against _generate_events's infinite loop with the currently installed dependency versions (both buffer the entire ASGI response before returning control), so these tests drive the real generator and route coroutine directly instead.
  • Fixes PriceCache.update() silently replacing an explicit timestamp=0.0 with time.time() (falsy-zero bug, dormant in production but worth closing).
  • test_exception_resilience now actually injects a step() failure and asserts the simulator loop recovers, instead of just checking the task is alive.
  • Widens the timing margin in test_custom_update_interval to remove latent CI flakiness risk.
  • ruff format's the 3 previously-flagged test files.
  • Updates the stale coverage figures in planning/MARKET_DATA_SUMMARY.md and the top-level README.md to the current numbers (79 tests, 99% overall coverage).

Test plan

  • uv run pytest -v — 79 passed, 0 failed
  • uv run pytest --cov=app — 99% overall (stream.py: 100%, up from 33%)
  • uv run ruff check app/ tests/ — all checks passed
  • uv run ruff format --check app/ tests/ — all files formatted

🤖 Generated with Claude Code

Raunak Sachdev and others added 10 commits August 22, 2026 16:59
…gent tooling

README now describes what's actually built (market data subsystem only) rather
than the full target app, with planned features/API/testing sections linked
back to PLAN.md. PLAN.md updated to match decisions made since the last pass:
Angular over Next.js, free-tier OpenRouter model, ECharts, plus SQLite/avg-cost/
SSE clarifications. Adds project-level agent tooling (change-reviewer subagent,
doc-review command, marketplace.json) and its first review output.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019K6SfhrZQx6fCUASEDwJNW
…87476887332

Add Claude Code GitHub Workflow
Writes planning/MARKET_DATA_DESIGN.md as an implementation-ready
reference covering the unified MarketDataSource interface, PriceCache,
GBM simulator, Massive API client, SSE streaming, and FastAPI lifecycle
wiring. Code snippets are verified against the current backend/app/market/
implementation, correcting drift present in the older
planning/archive/MARKET_DATA_DESIGN.md (lazy-import framing for the
massive client, GBMSimulator.get_tickers() visibility, stream.py's
generator return type).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RyKr4TS8gMZPNU8roFiYUT
…dvkdo

docs: add comprehensive market data design reference
Fresh pass over backend/app/market/ and its test suite: confirms all
7 issues from the prior archived review are genuinely fixed, verifies
73/73 tests pass at 91% coverage, and surfaces a few new low-severity
findings (a dormant falsy-timestamp edge case in PriceCache, two
test-quality gaps, and stale coverage figures in MARKET_DATA_SUMMARY.md).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add independent code review of the market data backend
… fix flaky/weak tests, fix falsy-timestamp bug

- Add ASGI-route-level and generator-level tests for stream.py (0% -> 100%
  coverage on that module). Note: the httpx ASGITransport / FastAPI
  TestClient recipe suggested in MARKET_DATA_DESIGN.md deadlocks against
  _generate_events's infinite loop in the installed dependency versions
  (both buffer the full response before returning), so the tests instead
  drive the real generator and route handler coroutine directly.
- Fix PriceCache.update() treating an explicit timestamp=0.0 as falsy and
  silently replacing it with time.time().
- test_exception_resilience now actually injects a step() failure and
  asserts the loop recovers, instead of just asserting the task is alive.
- Widen the timing margin in test_custom_update_interval to remove latent
  flakiness risk.
- ruff format the 3 flagged test files.
- Add httpx as a dev dependency (needed for the new stream tests).
- Update the stale coverage figures in planning/MARKET_DATA_SUMMARY.md and
  README.md to the current 79 tests / 99% overall.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@raunaksachdev

Copy link
Copy Markdown
Author

Opened against the wrong repo by mistake (gh defaulted to upstream instead of my fork). Recreating against raunaksachdev/finally.

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.

2 participants