Review: Fix EdgeLearnerConfig max_group_size validation

review-1753-2026-07-04 Review

review ready

Verdict: READY

Template Completeness

  • [x] Type -- Bug
  • [x] Lineage -- Sprint 6 sub-ticket of #29, regression from #3
  • [x] Repo -- ldraney/prediction-assistant
  • [x] What Broke -- EdgeLearnerConfig validates max_group_size as positive integer, but spec defines it as enum
  • [x] Repro Steps -- 4 clear steps to reproduce
  • [x] Expected Behavior -- enum values should pass validation
  • [x] Environment -- file, line, commit, spec reference all provided
  • [x] Acceptance Criteria -- 5 criteria, all verifiable
  • [x] Related -- parent and introducing issue identified

Traceability

  • [x] story:portfolio-builder label -- AI Portfolio Builder
  • [x] story note verified -- found in project-prediction-assistant user-stories section
  • [x] arch:rails label -- Rails Architecture
  • [x] arch note verified -- arch-rails note exists in pal-e-docs (architecture, active)
  • [x] Forgejo issue -- ldraney/prediction-assistant#72, open

File Targets

  • [x] app/models/edge_learner_config.rb:24 -- verified: validate_positive_integer("max_group_size") is the bug
  • [x] docs/bots/edge-learner.md:72 -- verified: spec defines max_group_size as enum with values "pairs", "triples", "uncapped"
  • [x] app/models/bot_catalog.rb:248-249 -- verified: CONFIG_SCHEMAS has type: :number, default: 3 (needs updating to type: :select, default: "triples")
  • [x] test/models/strategy_test.rb:47 -- verified: "max_group_size" => 4 (integer, needs enum value)
  • [x] test/controllers/bots_controller_test.rb:53 -- verified: "max_group_size" => 3 (integer, needs enum value)
  • [x] test/controllers/bots_controller_test.rb:343 -- verified: max_group_size: "3" (string integer, needs enum value)
  • [x] test/services/position_tracker_test.rb:43 -- verified: "max_group_size" => 4 (integer, needs enum value)

Repo Placement

OK. Issue filed on ldraney/prediction-assistant, all file targets are in the same repo. Single-repo fix.

Dependencies

  • Parent: #29 (Edge Learner bot, board item 1716, backlog) -- not blocking; this is an independent bug fix
  • Introduced by: #3 (EdgeLearnerConfig STI, board item 1688, validation) -- original source of the bug
  • No items on the board are blocked by this ticket
  • No undocumented dependencies found

Acceptance Criteria

5 criteria, all agent-verifiable:
  • AC1: Change validate_positive_integer to validate_inclusion -- verifiable by code inspection
  • AC2: Test enum acceptance/rejection -- verifiable by running test suite
  • AC3: BotCatalog CONFIG_SCHEMAS update -- verifiable by code inspection
  • AC4: Test helper updates across 3 test files -- verifiable by running test suite
  • AC5: Migration if schema change needed -- JSONB config column stores values as JSON; changing from integer to string values does not require a schema migration. This criterion is correctly conditional.

Blast Radius

  • validate_positive_integer is used correctly in 4 other locations (BulkSweepConfig, LateGameLockConfig, StackerConfig, EdgeLearnerConfig's own min_simultaneous_markets) for fields that are genuinely integers. No same-bug pattern elsewhere.
  • All max_group_size references in test fixtures use integer values (3 or 4) that will need updating to enum strings -- the issue correctly identifies all 3 affected test files.
  • No downstream consumers of max_group_size outside the identified files. GroupBuilder service (mentioned in Related) is not yet implemented (part of #29).

Decomposition Assessment

No decomposition needed. 3 source files + 3 test files, all in one repo. 5 acceptance criteria (at boundary but straightforward). Estimated agent work well under 5 minutes -- this is a validation type swap with test fixture updates.

Recommendation

No action needed.