Review: Strategy engine -- database schema for strategies and trades (re-review)
Verdict: APPROVED
Re-review of board item #1688 after refinement. Previous review (
review-1688-2026-07-02) found two missing architecture backing notes. Both have been created and verified.Previous Findings -- Resolution
- [x]
[SCOPE]Create architecture note arch-rails -- FIXED.arch-railsexists (note_type=architecture, status=active, project=kalshi-assistant). Contains Rails 8 component diagram, service objects, Solid Queue/Cable decisions. - [x]
[SCOPE]Create architecture note arch-postgres -- FIXED.arch-postgresexists (note_type=architecture, status=active, project=kalshi-assistant). Contains ER diagram with strategies, trades, markets, portfolios. Includes CNPG and jsonb strategy polymorphism decisions.
Template Completeness
- [x] Type -- Feature
- [x] Lineage -- Depends on ldraney/kalshi-assistant #1 (Rails scaffold)
- [x] Repo -- ldraney/kalshi-assistant
- [x] User Story -- As a developer / I want a database schema / So that strategies are data-driven
- [x] Context -- Strategy explanation with doc references
- [x] File Targets -- 6 files to create
- [x] Feature Flag -- none
- [x] Acceptance Criteria -- 6 criteria
- [x] Test Expectations -- Unit tests, rails test command
- [x] Constraints -- 3 constraints listed
- [x] Checklist -- PR/tests/no unrelated changes
- [x] Related -- kalshi-assistant project
Traceability
- [x] story:portfolio-builder label -- AI Portfolio Builder
- [x] story note verified -- found in project-kalshi-assistant user-stories section (key: portfolio-builder, links to story-kalshi-assistant-portfolio-builder)
- [x] arch:rails label -- Rails framework
- [x] arch note verified --
arch-railsnote exists in pal-e-docs (note_type=architecture, status=active, project=kalshi-assistant) - [x] arch:postgres label -- PostgreSQL database
- [x] arch note verified --
arch-postgresnote exists in pal-e-docs (note_type=architecture, status=active, project=kalshi-assistant) - [x] Forgejo issue -- https://forgejo.tail5b443a.ts.net/ldraney/kalshi-assistant/issues/3, open
File Targets
All file targets are files to CREATE. The repo is currently docs-only because this ticket depends on #1 (Rails scaffold, sprint:1, backlog). File targets cannot be verified against existing code but are standard Rails conventions.
- [x] app/models/strategy.rb -- to create: name, thresholds, allocation percentages
- [x] app/models/pick.rb -- to create: belongs_to strategy, market ticker, implied_prob
- [x] app/models/trade.rb -- to create: belongs_to pick, side, contracts, price, status
- [x] app/models/outcome.rb -- to create: settlement result, P&L
- [x] db/migrate/ -- to create: all migrations
- [x] db/seeds.rb -- to create: seed Option D and Watchdog strategies
Repo Placement
OK. Issue #3 is filed on ldraney/kalshi-assistant and all work targets that same repo. Single repo, no cross-repo concerns.
Dependencies
- Documented: Depends on #1 (Rails scaffold, item #1686, sprint:1, backlog). Correctly sequenced -- this ticket is sprint:2.
- Downstream consumers: #1689 Watchdog (sprint:3) and #1690 Option D sizing engine (sprint:3) both build on models created here. #1687 Market scanner (sprint:2) may interact with Pick model for storing scan results.
- Dependencies are properly documented in the Lineage section.
Acceptance Criteria
6 criteria, all agent-verifiable:
- Strategy/Pick/Trade/Outcome model fields -- verifiable via schema inspection and model attribute checks
- Seeds -- verifiable via rails runner or db:seed + query
Strategy.find_by(name: 'watchdog').confidence_thresholdreturns 0.85 -- very specific, directly testable
Values verified against docs:
- 83/17 split: confirmed in docs/strategy/sizing-models.md ("83% YES / 17% NO hedge on all picks")
- 0.85 confidence threshold: confirmed in docs/strategy/core-strategy.md ("85%+ implied probability")
- Watchdog strategy: docs/strategy/watchdog-strategy.md exists in the repo
Blast Radius
Minimal. Greenfield project -- no existing code to break. Models created here become the foundation for sprint 3 tickets (watchdog, sizing engine). No external services consumed by this ticket directly.
Decomposition Assessment
6 file targets in 1 repo. 6 acceptance criteria (marginally over 5 threshold). However, this is standard Rails model/migration/seed work -- well under 5 minutes for an agent. All targets are in one repo and belong to a single domain (data models). No decomposition needed.
Recommendation
No action needed. All previous findings resolved.