Review: Edge Learner bot -- multi-event consumer with learning
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
All 12 required sections present per template-issue-feature.
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 type)
- [x] arch:rails label -- Rails component
- [ ] arch note MISSING -- [SCOPE] Create architecture note arch-rails for component rails. Search for "arch-rails" returned no results.
- [x] Forgejo issue -- ldraney/prediction-assistant#29, state: open
File Targets
- [x]
app/jobs/edge_learner_job.rb-- new file, pattern consistent with existing jobs (bulk_sweep_job.rb, pregame_threshold_job.rb) - [x]
app/models/price_pattern.rb-- new file, pattern consistent with existing models - [x]
app/services/group_builder.rb-- new file, pattern consistent with existing services - [x]
test/jobs/edge_learner_job_test.rb-- new file - [x]
test/models/price_pattern_test.rb-- new file - [x]
test/services/group_builder_test.rb-- new file - [ ] MISSING:
db/migrate/YYYYMMDDHHMMSS_create_price_patterns.rb-- PricePattern model requires a database table but no migration is listed. Schema needs columns for sport, game_situation, entry_price, exit_price, hold_duration, confidence, etc. - [ ] MISSING:
app/jobs/price_update_job.rb-- currently a stub ("bot consumers implement in Sprint 4"). Needs modification to fan out to EdgeLearnerJob. - [ ] MISSING:
app/jobs/time_update_job.rb-- currently a stub ("bot consumers implement in Sprint 4"). Needs modification to fan out to EdgeLearnerJob. - [ ] MISSING:
app/jobs/sweep_eligible_job.rb-- has comment "Edge Learner will be added in Sprint 4 (#29)". Needs modification to fan out to EdgeLearnerJob alongside BulkSweepJob.
Repo Placement
OK -- issue filed on ldraney/prediction-assistant, ### Repo field says ldraney/prediction-assistant. Single repo, no cross-repo concerns.
Dependencies
- #2 (MarketScanner emitting events) -- board item 1687, validation column. Code exists, not yet validated.
- #23 (OrderService) -- board item 1710, validation column. Code exists at app/services/order_service.rb.
- #24 (PositionTracker) -- board item 1711, validation column. Code exists at app/services/position_tracker.rb.
- #3 (EdgeLearnerConfig STI) -- board item 1688, validation column. Code exists at app/models/edge_learner_config.rb.
All 4 dependencies are correctly documented. All are in validation column (code exists, awaiting final validation). Not blocking implementation.
Acceptance Criteria
15 acceptance criteria. All are individually testable by an agent (group counts are deterministic, risk levels have clear behavior, OrderService usage is greppable). However, 15 AC is 3x the decomposition threshold (5). The criteria span 4 independent sub-systems (Group Builder, Portfolio Monitor, Predictive Entry, Risk-Adjusted Closer) plus infrastructure (fan-out wiring, PricePattern model/migration).
Blast Radius
- EdgeLearnerConfig.max_group_size validation bug: The existing model (from #3) validates max_group_size as a positive_integer, but both the issue spec and docs/bots/edge-learner.md define it as an enum ("pairs", "triples", "uncapped"). This mismatch will cause validation failures when the job tries to use string values. Needs fix in edge_learner_config.rb line 25.
- Fan-out jobs: 3 existing fan-out jobs (price_update_job.rb, time_update_job.rb, sweep_eligible_job.rb) need modification to dispatch to EdgeLearnerJob. These are not listed as file targets.
- No downstream consumers affected: Edge Learner is a leaf consumer -- it reads events and places orders, no other bots depend on it.
- Lineage inconsistency: Issue body says "Sprint 5" but board item label says sprint:6.
Decomposition Assessment
NEEDS DECOMPOSITION -- route to skill-decompose-ticket.
- 6 new file targets + 3 missing modification targets + 1 missing migration = 10 files total
- 15 acceptance criteria (3x the 5-AC threshold)
- 4 independent sub-systems (Group Builder, Portfolio Monitor, Predictive Entry, Risk-Adjusted Closer)
- Estimated agent work: 20-30 minutes for a single pass (well over 5-minute rule)
Suggested decomposition: split into sub-tickets per sub-system (Group Builder, Portfolio Monitor, Predictive Entry + PricePattern model, Risk-Adjusted Closer) plus a wiring ticket for fan-out job updates and EdgeLearnerJob shell.
Recommendation
[BODY]Add migration file target:db/migrate/YYYYMMDDHHMMSS_create_price_patterns.rb-- PricePattern model needs a database table[BODY]Add fan-out job modification targets:app/jobs/price_update_job.rb,app/jobs/time_update_job.rb,app/jobs/sweep_eligible_job.rb[BODY]Fix Lineage: says "Sprint 5" but board item is labeled sprint:6[BODY]Note pre-existing bug: EdgeLearnerConfig validates max_group_size as positive_integer but spec requires enum ("pairs", "triples", "uncapped") -- fix needed in edge_learner_config.rb[SCOPE]Create architecture note arch-rails for component rails[DECOMPOSE]15 AC across 4 sub-systems + infrastructure, estimated 20-30 min agent work. Route to skill-decompose-ticket.