Review: Bot detail P&L dashboard with time-series chart

review-1760-2026-07-04 Review

review needs-refinement

Verdict: NEEDS_REFINEMENT

Board item #1760 — Forgejo issue ldraney/prediction-assistant#84. Type: Feature.

Template Completeness

  • [x] Type — Feature
  • [x] Lineage — Parent and dependencies identified
  • [x] Repo — ldraney/prediction-assistant
  • [x] User Story — AI Portfolio Builder
  • [x] Context — clear motivation
  • [x] File Targets — 5 files (3 new, 2 existing)
  • [x] Feature Flag — none (appropriate for core bot detail feature)
  • [x] Acceptance Criteria — 8 criteria
  • [x] Test Expectations — present
  • [x] Constraints — no external JS, Turbo Native compatible, dark theme
  • [x] Checklist — present
  • [x] Related — present

Traceability

  • [x] story:portfolio-builder label — AI Portfolio Builder
  • [x] story note verified — found in project-prediction-assistant user-stories section
  • [x] arch:rails label — Rails Architecture
  • [x] arch note verified — arch-rails note exists in pal-e-docs (id: 2347, status: active)
  • [x] Forgejo issue — ldraney/prediction-assistant#84, state: open

File Targets

  • [x] app/views/bots/show.html.erb — verified: exists (19k), renders bot detail page with P&L display via BotPresenter
  • [x] app/views/bots/_performance_dashboard.html.erb — new partial to create (no conflict, directory exists)
  • [x] app/views/bots/_trade_history.html.erb — new partial to create (no conflict, directory exists)
  • [x] app/controllers/bots_controller.rb — verified: exists, show action already loads strategy + pnl_sum via Trade queries
  • [x] test/controllers/bots_controller_test.rb — verified: exists (15k)

Repo Placement

OK. Issue filed on ldraney/prediction-assistant, all file targets are in the same repo. Single-repo change.

Dependencies

  • SimulationResult model (issue #82, board item #1758) — in backlog. The ticket's Lineage says "Depends on: SimulationResult model (this sprint)" but #82 has no sprint label and is still in backlog. This is a real dependency: the P&L chart and trade history depend on simulated trade data. The current Trade model has no dry_run field; simulation tracking today is only via ActivityLog actions. #82 must be implemented before this ticket can be worked.
  • Activity feed (#30, board item #1717) — in todo. The issue says the dashboard goes "above the activity feed." If #30 isn't done yet, the show page layout reference point doesn't exist. However, the dashboard partial can still be added to show.html.erb at a logical position regardless.
  • Go-live activation flow (#85) — in backlog. This ticket blocks #85 per the Lineage. No action needed on this ticket's scope.

Acceptance Criteria

8 acceptance criteria. All are testable and verifiable by an agent:
  • Chart rendering — verifiable via HTML assertions on SVG/CSS elements
  • Period toggles — verifiable via Turbo Frame request/response tests
  • Summary stats — verifiable via presence of stat elements with computed values
  • Trade history table — verifiable via table row assertions
  • Pagination — verifiable via Turbo Frame page navigation
  • Empty state — verifiable with no trades in test fixture
  • Tests — meta-criterion, verifiable by test pass
Test expectations describe what to test but do not specify exact test commands. This is acceptable since the repo uses standard Rails rails test.

Blast Radius

  • BotPresenter already has pnl_display and pnl_css_class methods. This ticket extends the presenter, not replaces it. Low risk.
  • The bot index page also displays P&L (simple total). No changes needed there.
  • The "no external JS charting libraries" constraint aligns with the existing Propshaft + importmap architecture (no Node.js build step). Inline SVG/CSS is the right approach.
  • No similar P&L dashboard pattern exists elsewhere in the app to keep consistent with.

Decomposition Assessment

NEEDS DECOMPOSITION — route to skill-decompose-ticket.
  • File targets: 5 files in 1 repo — within single-repo threshold
  • Acceptance criteria: 8 ACs — exceeds the >5 threshold
  • Estimated agent work: SVG charting from scratch + Turbo Frame period toggles + trade history table + Turbo Frame pagination + 5 summary stats + empty state + tests across all — likely >5 minutes
  • Natural decomposition: (A) Performance chart + stats + period toggles (ACs 1-4), (B) Trade history table + pagination + empty state (ACs 5-7), with tests (AC 8) split across both

Recommendation

  • [DECOMPOSE] 8 ACs across 2 functional areas. Split into: (A) P&L chart with summary stats and period toggles, (B) Trade history table with pagination and empty state. Route to skill-decompose-ticket.