Review: Bot card performance indicators on marketplace grid

review-1759-2026-07-04 Review

review ready

Verdict: READY

Template Completeness

  • [x] Type -- Feature
  • [x] Lineage -- present, documents parent (Paper trading dashboard S7) and dependency (SimulationResult model)
  • [x] Repo -- ldraney/prediction-assistant
  • [x] User Story -- references AI Portfolio Builder
  • [x] Context -- clear motivation for adding performance badges
  • [x] File Targets -- 5 files listed
  • [x] Feature Flag -- none (enhancement to existing bot card)
  • [x] Acceptance Criteria -- 6 criteria
  • [x] Test Expectations -- unit, integration, N+1 described
  • [x] Constraints -- read-only display, dark-theme CSS compatibility
  • [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 (key: portfolio-builder, role: Trader (Lucas))
  • [x] arch:rails label -- Rails architecture component
  • [x] arch note verified -- arch-rails note exists in pal-e-docs (id: 2347, status: active). Note: search_notes does not surface this note but get_note with exact slug confirms it exists.
  • [x] Forgejo issue -- ldraney/prediction-assistant#83, state: open

File Targets

  • [x] app/views/bots/_bot_card.html.erb -- verified: exists, contains bot card template with stats section (expected_return, trades, P&L). Adding a performance badge here is consistent.
  • [x] app/presenters/bot_presenter.rb -- verified: exists, BotPresenter class with pnl_display/pnl_css_class methods. Adding daily_pnl/weekly_pnl/pnl_trend follows established pattern.
  • [x] app/views/bots/index.html.erb -- verified: exists, renders _bot_card partial at line 270. Presenter wiring change may be needed here or in controller.
  • [x] test/presenters/bot_presenter_test.rb -- verified: exists, has comprehensive presenter tests for pnl formatting and status display.
  • [x] test/controllers/bots_controller_test.rb -- verified: exists, has integration tests for bot pages.

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) -- documented in Lineage section. Currently in backlog. The SimulationResult model does not yet exist in the codebase. This ticket cannot be implemented until #82 lands, but the dependency is properly documented. This is an ordering concern for sprint planning, not a scope defect.
  • No other blocking dependencies identified on the board.
  • This ticket blocks nothing (per Lineage).

Acceptance Criteria

6 criteria, all agent-verifiable:
  • AC 1-3: badge rendering (positive/negative/no-data/trend) -- verifiable via view tests
  • AC 4: presenter methods (daily_pnl, weekly_pnl, pnl_trend) -- verifiable via unit tests
  • AC 5: N+1 query prevention -- verifiable via query count assertion
  • AC 6: test coverage for all badge states -- meta-criterion, verifiable by running test suite
Test expectations describe what to test (unit + integration + N+1). Standard Rails test runner (bin/rails test).

Blast Radius

  • BotPresenter is used in: bots_controller.rb (3 instantiation sites), 4 config partials (comments only), _bot_card partial, index view.
  • _bot_card partial is only rendered from bots/index.html.erb -- no other consumers.
  • Changes are additive -- new methods on presenter, new HTML in partial. Existing functionality is not affected.
  • The presenter currently takes pnl_sum as a constructor argument. New daily/weekly P&L data will likely follow the same passive-data pattern (computed in controller, passed to presenter). No architectural change required.
  • No sibling services or downstream consumers affected.

Decomposition Assessment

5 file targets across 1 repo (under threshold). 6 acceptance criteria (technically >5 threshold, but all are tightly coupled to a single small feature -- adding a badge to a card). Estimated agent work: well under 5 minutes. No decomposition needed.

Recommendation

No action needed.