Review: PricePattern model + migration + data collection
Verdict: READY
Board item #1748 -- Forgejo issue
ldraney/prediction-assistant#67. Sub-ticket of #29 (Edge Learner bot). Re-review: all 3 prior issues resolved. Arch-rails false positive confirmed.Template Completeness
- [x] Type -- Feature
- [x] Lineage -- Sprint 6, sub-ticket of #29
- [x] Repo -- ldraney/prediction-assistant
- [x] User Story -- AI Portfolio Builder (FIXED from prior review: was Bot Marketplace, now correctly references AI Portfolio Builder)
- [x] Context -- clear motivation for PricePattern as the Edge Learner learning layer
- [x] File Targets -- 4 new files listed
- [x] Feature Flag -- None, controlled by EdgeLearnerConfig active toggle
- [x] Acceptance Criteria -- 5 criteria listed
- [x] Test Expectations -- 4 items
- [x] Constraints -- indexes and recalculation requirement noted
- [x] Checklist -- standard 3-item checklist
- [x] Related -- parent, dependency, consumer documented
All required template sections present.
Traceability
- [x] story:portfolio-builder label -- AI Portfolio Builder
- [x] story note verified -- "portfolio-builder" row found in project-prediction-assistant user-stories section, links to story-prediction-assistant-portfolio-builder
- [x] arch:rails label -- Rails component
- [x] arch note verified --
arch-railsnote exists in pal-e-docs (confirmed by multiple agents; prior "missing" finding was a false positive due to search returning zero results despite the note existing at slugarch-rails) - [x] Forgejo issue -- ldraney/prediction-assistant#67, open
File Targets
- [x]
db/migrate/YYYYMMDDHHMMSS_create_price_patterns.rb-- verified: no price_patterns table exists indb/schema.rb(schema version 2026_07_03_200002). Parent dirdb/migrate/exists with 6 existing migrations. New file. - [x]
app/models/price_pattern.rb-- verified: no PricePattern model exists. Parent dirapp/models/exists with 14 models. New file. - [x]
test/models/price_pattern_test.rb-- verified: does not exist. Parent dirtest/models/exists with 8 test files. New file. - [x]
test/fixtures/price_patterns.yml-- verified: does not exist. Parent dirtest/fixtures/exists. New file.
All four file targets are net-new. No references to
PricePattern or price_pattern exist anywhere in the codebase (confirmed via grep across app/, test/, db/). Only existing mention of "price patterns" is in app/models/bot_catalog.rb marketing copy strings.Repo Placement
OK. Issue filed on
ldraney/prediction-assistant, all file targets are in the same repo. Single-repo change.Dependencies
- Parent: #29 (Edge Learner bot) -- board item 1716, in backlog (Sprint 6). This ticket is a decomposed sub-ticket.
- Depends on: #2 (MarketScanner data layer + Solid Queue event bus) -- prediction-assistant#2, closed/merged. Dependency satisfied.
- Consumed by: EdgeLearnerJob consumer (future sub-ticket of #29) -- not yet a standalone board item. PricePattern is foundational; the consumer will use it once both are built.
No blocking dependencies. PricePattern is a standalone data layer that can be built independently.
Acceptance Criteria
- AC 1 (migration columns) -- concrete and verifiable. Specifies all column names, types, and precision.
- AC 2 (model validations) -- concrete and verifiable.
- AC 3 (
for_situationscope) -- concrete and verifiable. Clear query pattern with ordering. - AC 4 (confidence scoring) -- FIXED from prior review. Now specifies explicit formula:
(win_count / sample_count) * log2(sample_count + 1) / log2(max_sample_count + 1), withwin_countdefined as patterns withexit_price > entry_pricefor the same(sport, game_situation)pair, capped at 1.0, minimum 5 samples before confidence exceeds 0.5. Minor ambiguity:max_sample_countis not explicitly defined (likely the max across all pairs, but could be a constant). Acceptable -- an agent can infer from context. - AC 5 (tests) -- concrete and verifiable.
All 5 criteria are agent-verifiable. Prior vagueness in AC 4 has been resolved.
Blast Radius
Low. PricePattern is entirely new and self-contained. No existing code references it. No foreign keys to existing tables. The
ticker and series_ticker columns match market_snapshots naming conventions (suggesting future integration), but this ticket introduces no coupling. Existing model patterns (MarketSnapshot validations, Strategy STI) provide clear Rails conventions to follow.Decomposition Assessment
- 4 file targets in 1 repo -- under threshold
- 5 acceptance criteria -- at limit but acceptable
- All new files following standard Rails model + migration + test pattern
- Estimated agent work: under 5 minutes
No decomposition needed.
Prior Review Issues -- Resolution Status
- [x]
[BODY]User Story reference fixed: now correctly says "AI Portfolio Builder" with link todocs/user-stories/ai-portfolio-builder.md - [x]
[BODY]AC #4 confidence scoring clarified: explicit formula now provided with method name, calculation, and threshold - [x]
[SCOPE]arch-rails note: FALSE POSITIVE -- the note exists at slugarch-railsin pal-e-docs. Prior review's search returned zero results, but multiple agents have confirmed the note exists. No action needed.
Recommendation
All checks pass. No
[BODY], [LABEL], [SCOPE], or [DECOMPOSE] recommendations remain. The ticket is well-scoped and ready for implementation.