Review: Per-bot live activity feed -- Turbo Streams

review-1717-2026-07-04 Review

review approved

Verdict: APPROVED

Re-review of review-1717-2026-07-03 (NEEDS_REFINEMENT). All four [BODY] fixes have been correctly applied. The issue spec now matches the actual codebase schema.

Template Completeness

  • [x] Type -- Feature
  • [x] Lineage -- Sprint 4, depends on #26 and bots running
  • [x] Repo -- ldraney/prediction-assistant
  • [x] User Story -- Bot Marketplace
  • [x] Context -- detailed background with references
  • [x] File Targets -- 7 files listed (3 pre-existing, 4 to create)
  • [x] Feature Flag -- None (integral to UI, acceptable)
  • [x] Acceptance Criteria -- 10 criteria
  • [x] Test Expectations -- model, channel, system tests listed
  • [x] Constraints -- Action Cable, strategy scoping, append-only, throttling
  • [x] Checklist -- 11 items
  • [x] Related -- dependencies listed with issue refs
All required sections present per template-issue-feature.

Traceability

  • [x] story:bot-marketplace label -- Bot Marketplace user story
  • [x] story note verified -- found in project-prediction-assistant user-stories section (key: bot-marketplace, links to story-prediction-assistant-bot-marketplace)
  • [x] arch:frontend label -- frontend component
  • [ ] arch note MISSING -- [SCOPE] Create architecture note arch-frontend for component frontend (carried forward from review-1717-2026-07-03; non-blocking for issue spec)
  • [x] Forgejo issue -- ldraney/prediction-assistant#30, open

File Targets

  • [x] app/models/activity_log.rb -- EXISTS, schema now matches AC #1 exactly (strategy_id, bot_name, ticker, action, side, price, quantity, status, message, metadata)
  • [x] db/migrate/20260703200001_create_activity_logs.rb -- EXISTS
  • [x] app/channels/bot_activity_channel.rb -- does not exist yet, to be created (correct)
  • [x] app/views/bots/_activity_feed.html.erb -- does not exist yet, to be created (correct)
  • [x] app/views/activity_logs/_activity_log.html.erb -- does not exist yet, to be created (correct)
  • [x] test/models/activity_log_test.rb -- EXISTS with 14 tests covering validations, scopes (for_bot, recent, successes, failures), associations, metadata defaults
  • [x] test/channels/bot_activity_channel_test.rb -- does not exist yet, to be created (correct)

Previous Review Fix Verification

All four [BODY] recommendations from review-1717-2026-07-03 verified as correctly applied:
  • [x] AC #1 fields updated -- now lists strategy_id, bot_name (not bot_type), correct action enum values, message (not rationale), metadata (jsonb). No user_id or timestamp. Matches db/schema.rb and activity_log.rb model constants exactly.
  • [x] AC #6 scoping updated -- now says "scoped to strategy_id (user-level scoping deferred until User model lands)". No user_id reference.
  • [x] AC #8 field name updated -- display list now says "message" not "rationale".
  • [x] AC #9 reframed -- prefixed with "Pre-existing:" and reworded as "verify integration and ensure all bots write correctly".

Repo Placement

OK -- issue filed on ldraney/prediction-assistant, all file targets in that repo. Single-repo scope.

Dependencies

  • #26 (Bot Detail pages) -- validation column, merged. app/views/bots/show.html.erb exists on disk. SATISFIED.
  • #23 (OrderService) -- validation column. OrderService confirmed to call ActivityLog.create! in app/services/order_service.rb. SATISFIED.
  • #27 (Pregame Stacker) -- validation column, merged. SATISFIED.
  • #28 (Bulk Sweep) -- validation column, merged. SATISFIED.
  • #29 (Edge Learner) -- in backlog (sprint:6). NOT blocking -- feed works with whatever bots exist.
  • #48 (Hotwire conversion) -- validation column. Action Cable configured: config/cable.yml uses solid_cable adapter, application.rb requires action_cable/engine, application_cable/ directory exists with channel.rb and connection.rb. SATISFIED.

Acceptance Criteria

  • AC #1 (model fields) -- now matches actual schema. Verified against db/schema.rb and model ACTIONS/STATUSES constants.
  • AC #2 (Kalshi market link) -- testable, straightforward
  • AC #3 (feed partial on detail page) -- testable, show.html.erb exists to embed it
  • AC #4 (per-bot filtering) -- testable, for_bot scope exists and tested
  • AC #5 (Turbo Streams real-time) -- testable, Action Cable + solid_cable fully configured
  • AC #6 (channel scoped to strategy_id) -- correctly scoped, user_id deferred
  • AC #7 (pagination) -- testable
  • AC #8 (entry display fields) -- now uses correct field names (message, not rationale)
  • AC #9 (pre-existing integration) -- correctly reframed as verification of existing OrderService integration
  • AC #10 (reverse chronological) -- testable, recent scope exists and tested
All criteria are accurate and agent-verifiable.

Blast Radius

  • OrderService already creates ActivityLog entries -- adding after_create broadcast will fire on every trade execution across all bots
  • BulkSweepJob processes many markets rapidly -- broadcasting per-entry could flood the cable. Constraints section mentions throttling but no specific mechanism prescribed (acceptable at 2pt scope -- agent can choose debounce/batch strategy)
  • Action Cable uses solid_cable (database-backed pub/sub) -- performance under high-frequency broadcasting should be monitored
  • No cross-user leakage concern currently since there is no multi-user model yet

Decomposition Assessment

7 file targets (3 already exist), 10 acceptance criteria (2 pre-existing, effective count ~8). 1 repo. Remaining work is 4 new files + wiring. Standard Rails patterns (channel, partials, Turbo Streams). 2 story points. No decomposition needed.

Recommendation

  • [SCOPE] Create architecture note arch-frontend for component frontend (carried forward from previous review; non-blocking -- "frontend" is a broad architectural label, and the issue spec is self-contained and implementable without it).
No further [BODY] or [LABEL] fixes needed. Issue is ready for implementation.