Close SPEC.md audit gaps: chat trade pricing, frontend test mocks, test layout#8
Open
kplayz wants to merge 4 commits intoed-donner:mainfrom
Open
Close SPEC.md audit gaps: chat trade pricing, frontend test mocks, test layout#8kplayz wants to merge 4 commits intoed-donner:mainfrom
kplayz wants to merge 4 commits intoed-donner:mainfrom
Conversation
… v5 + EventSource/ResizeObserver (fin-z4x)
… (fin-a3i) LLM-driven trades now read live prices from price_cache instead of the $150 hardcoded placeholder, and reuse the same validation + snapshot logic as manual trades. Extract execute_trade_core() in portfolio.py as the shared helper; chat._execute_trade() becomes a thin adapter.
The history accumulator in useMarketData pushed into the same array
reference each SSE event. Recharts' <LineChart data={...}> freezes the
incoming array for internal memoization, so the next event's .push()
threw 'Cannot add property N, object is not extensible' and the page
went blank. Build a new array each tick so the frozen prior reference
stays untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes three gaps identified by the SPEC.md audit (convoy
hq-cv-9a2s0):fin-a3i—backend/app/chat.pyauto-executed LLM trades using a hardcoded$150placeholder. Extractedexecute_trade_core()inportfolio.pyas the shared trade engine; chat now reuses it so every auto-executed trade reads the live price fromprice_cacheand goes through the same validation + snapshot path as manual trades. Adds a regression test verifying the live cache price is recorded.fin-z4x— 4 failing tests infrontend/src/__tests__/PortfolioPage.test.tsx. Updated thelightweight-chartsmock to the v5 API (addSeries(LineSeries, …)+ exportingLineSeries), fixedMockEventSourceto exposeaddEventListener/removeEventListener, and added aResizeObserverstub insetup.ts(used by recharts'ResponsiveContainer). All 37 frontend tests now pass.fin-5m5— Moveddocker-compose.test.ymlintotest/per SPEC.md §4; adjustedbuild.contextto..and the playwright volume mount to.:/work.docker compose -f test/docker-compose.test.yml configvalidates cleanly.Test plan
cd backend && uv run pytest— 48/48 passing (was 47; addedtest_chat_trade_uses_live_cache_price)cd frontend && npx vitest run— 37/37 passing (was 33/37)cd frontend && npm run build— static export succeedsdocker compose -f test/docker-compose.test.yml config— paths resolvedocker compose -f test/docker-compose.test.yml up --abort-on-container-exit(not run locally; CI should cover)🤖 Generated with Claude Code