Review: Bot detail P&L chart + summary stats

review-1762-2026-07-04 Review

review approved

Verdict: APPROVED

Template Completeness

  • [x] Type -- Feature
  • [x] Lineage -- Sub-issue of #84, decomposition documented
  • [x] Repo -- ldraney/prediction-assistant
  • [x] User Story -- complete As/I want/So that format
  • [x] Context -- clear background, references existing page structure
  • [x] File Targets -- 3 files (1 new, 2 modify) + explicit exclusions
  • [x] Feature Flag -- None (acceptable: internal UI enhancement, no feature flag doc in repo)
  • [x] Acceptance Criteria -- 5 verifiable criteria
  • [x] Test Expectations -- 3 tests + run command
  • [x] Constraints -- 4 constraints (inline SVG/CSS only, Turbo Frame patterns, no external JS, match styling)
  • [x] Checklist -- present
  • [x] Related -- 4 references (#84 parent, #82 dependency, #83 sibling, docs)

Traceability

  • [x] story:portfolio-builder label -- AI Portfolio Builder
  • [x] story note verified -- story-prediction-assistant-portfolio-builder exists in pal-e-docs (active user-story note)
  • [x] arch:rails label -- present on board item
  • [ ] arch note MISSING -- [SCOPE] No arch-rails note found in pal-e-docs. Systemic gap: arch:rails is used across 20+ board items but no backing note exists. Not specific to this ticket.
  • [x] Forgejo issue -- #86, open, valid URL https://forgejo.tail5b443a.ts.net/ldraney/prediction-assistant/issues/86

File Targets

  • [x] app/views/bots/_performance_dashboard.html.erb -- NEW file. Correct directory verified: sibling partials exist (_activity_feed.html.erb, _bot_card.html.erb, _config_fields.html.erb, etc.)
  • [x] app/controllers/bots_controller.rb -- verified: exists (180 lines). show action at line 26 already loads strategy and trade data. Extension point is clear.
  • [x] test/controllers/bots_controller_test.rb -- verified: exists (20k). Test patterns established for show action.

Repo Placement

OK. Issue #86 filed on ldraney/prediction-assistant. All file targets are in this repo. Single-repo change.

Dependencies

  • #82 (SimulationResult model + P&L aggregation service) -- DOCUMENTED dependency. Board item #1758, currently in backlog. SimulationResult does not exist in the codebase yet. This ticket must not move to in_progress until #82 is merged.
  • #84 (parent issue) -- in backlog. This ticket was decomposed from #84.
  • #83 (Bot card performance indicators) -- sibling feature, not a blocker.
  • #87 (Bot detail trade history table) -- sibling sub-issue, not a blocker.
All dependencies are properly documented in the issue body and Related section.

Acceptance Criteria

All 5 criteria are verifiable by an agent:
  • AC1: Check rendered HTML for performance dashboard partial above activity feed -- testable via controller test
  • AC2: Check for inline SVG markup, absence of external script tags -- testable via response body inspection
  • AC3: Verify Turbo Frame markup and period param handling -- testable (existing Turbo Frame patterns in activity.html.erb provide reference)
  • AC4: Check response body for stat labels (total P&L, win rate, total trades, best day, worst day) -- testable
  • AC5: Test with no simulation data returns 200 with empty-state content -- explicitly covered in Test Expectations
Test run command is valid: bin/rails test test/controllers/bots_controller_test.rb

Blast Radius

Low. The change adds a new partial rendered in show.html.erb (line 944 area, above the activity feed render). Does not modify existing partials or sibling concerns. The controller extension adds SimulationResult queries to show action. No downstream consumers affected. Activity feed and marketplace index are explicitly excluded from scope.
Turbo Frame patterns are well-established in the codebase (activity.html.erb, _activity_feed.html.erb) providing clear reference for the period toggle implementation.

Decomposition Assessment

3 file targets in 1 repo, 5 acceptance criteria, estimated ~5 minutes agent work. The inline SVG chart is the most complex component but is bounded by the constraint of no external libraries. No decomposition needed.

Recommendation

  • [SCOPE] Create architecture note arch-rails for the Rails application component. This is a systemic gap affecting 20+ board items, not specific to this ticket. Does not block approval.