Review: Per-sport analytics: track Live Edge performance by sport type

review-1851-2026-07-10 Review

review needs-refinement

Verdict: NEEDS_REFINEMENT

Template Completeness

  • [x] Type -- Feature
  • [x] Lineage
  • [x] Repo
  • [x] User Story
  • [x] Context
  • [x] File Targets
  • [x] Feature Flag
  • [x] Acceptance Criteria
  • [x] Test Expectations
  • [x] Constraints
  • [x] Checklist
  • [x] Related

Traceability

  • [x] story:bot-strategy label -- "As a bot operator, I want to identify and exploit profitable trading conditions..."
  • [x] story note verified -- found in project-botfire user-stories section
  • [x] arch:bots label -- bots component
  • [ ] arch note MISSING -- [SCOPE] Create architecture note arch-bots for component bots
  • [x] Forgejo issue -- ldraney/botfire#20, open

File Targets

  • [x] app/services/scoreboard.rb -- verified: file exists, currently has no sport_type grouping, valid target for modification
  • [ ] app/views/dashboard/index.html.erb -- ISSUE: Dashboard ALREADY has full per-sport analytics. Existing features include: Sport filter buttons (line 119-122), "P&L by Sport" panel (line 136-139), SPORT_LABELS mapping (line 188-194), sport column in Open Positions and Recent Exits tables, calcBreakdown for sport grouping (line 544). The dashboard controller already passes sport: g.sport_type in the data response (dashboard_controller.rb line 21). This file target is invalid -- the described dashboard work is already complete.
  • [ ] test/services/scoreboard_test.rb -- ISSUE: Referenced in Test Expectations but does not exist yet. Should be listed as a file to CREATE in File Targets, not just referenced in tests.

Repo Placement

OK -- all work is in ldraney/botfire, matching the Forgejo issue repo.

Dependencies

  • Issue #19 (scanner bug, board item #1850) is correctly identified as a dependency in the Lineage section. It is in backlog. This ticket can proceed independently -- the scoreboard changes work with whatever BotFire records exist, and basketball records will flow once #19 is fixed.
  • No other blocking dependencies found on the board.

Acceptance Criteria

  • [ ] AC1: "Dashboard shows trade count, win rate, and P&L grouped by sport_type" -- ALREADY SATISFIED. The dashboard's "P&L by Sport" panel already shows this breakdown with wins/losses, win rate, and P&L per sport. An agent implementing this AC would make no changes.
  • [x] AC2: "Scoreboard service outputs per-sport stats in its log/display" -- Valid, not yet implemented. Scoreboard currently only groups by bot, not by sport.
  • [x] AC3: "When a sport has 0 trades, it doesn't appear in the breakdown" -- Valid for scoreboard. Dashboard already handles this (calcBreakdown only includes groups with data).
  • [x] AC4: "All-sport totals still displayed alongside per-sport breakdown" -- Valid for scoreboard. Dashboard already shows this via summary cards.
Net: 3 of 4 AC are already satisfied on the dashboard side. Only scoreboard work remains.

Blast Radius

Scoreboard is consumed by two callers:
  • bot_engine.rb line 269 -- prints Scoreboard.report to terminal log periodically
  • dashboard_controller.rb line 36 -- uses Scoreboard.new.bot_summary(bot) for bot card data
Changes to scoreboard report format will affect terminal log output. Adding a new method (e.g., sport_summary) is safe. Modifying bot_summary return hash could break the dashboard controller if keys change. No other downstream consumers found.

Decomposition Assessment

After correcting scope: 1 file to modify (scoreboard.rb), 1 file to create (scoreboard_test.rb), 3 effective AC, single repo. Well within single-agent pass. No decomposition needed.

Recommendation

  • [BODY] Remove app/views/dashboard/index.html.erb from File Targets -- the dashboard already has per-sport analytics (sport filter, "P&L by Sport" panel, sport columns in tables). No dashboard changes needed.
  • [BODY] Rewrite AC1 or remove it -- "Dashboard shows trade count, win rate, and P&L grouped by sport_type" is already satisfied. Replace with scoreboard-specific AC or remove entirely.
  • [BODY] Add test/services/scoreboard_test.rb to File Targets as a file to CREATE (currently only referenced in Test Expectations).
  • [BODY] Reduce points from 3 to 2 -- with dashboard work removed, this is a single-service change plus test.
  • [SCOPE] Create architecture note arch-bots for component bots.