Skip to content

Harden CLI config parsing with strict validation and boundary tests - #199

Draft
ch55secake with Copilot wants to merge 3 commits into
mainfrom
copilot/audit-hyperion-codebase
Draft

Harden CLI config parsing with strict validation and boundary tests#199
ch55secake with Copilot wants to merge 3 commits into
mainfrom
copilot/audit-hyperion-codebase

Conversation

Copilot AI commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Description

Daily audit requested identification and remediation of new bugs/security-quality risks. This PR addresses an untracked input-validation gap in CLI config parsing that allowed invalid runtime parameters to flow into training/simulation.

Changes in this pull request

  • CLI validation hardening (src/main.py)

    • Rejects empty/whitespace-only --intervals
    • Enforces 0 < --test-size < 1
    • Enforces --target-days > 0, --n-trials > 0
    • Enforces --transaction-cost >= 0
    • Enforces --target-down-threshold < --target-up-threshold
    • Validates --target-horizons as a non-empty comma-separated list of positive integers
    • Normalizes interval parsing to drop empty comma entries
  • Focused regression coverage (tests/test_main.py)

    • Adds parser tests for interval normalization and invalid-boundary rejection:
      • test-size = 0, 1, >1
      • target-days/n-trials = 0
      • negative transaction cost
      • inverted thresholds
      • zero/negative target horizons
if not 0 < args.test_size < 1:
    parser.error("--test-size must be between 0 and 1 (exclusive).")

if args.target_down_threshold >= args.target_up_threshold:
    parser.error("--target-down-threshold must be less than --target-up-threshold.")

Copilot AI linked an issue Apr 21, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 21, 2026 08:39
Agent-Logs-Url: https://github.com/ch55secake/hyperion/sessions/253ffb95-6d7c-4b9b-935b-26c68711d620

Co-authored-by: ch55secake <87881861+ch55secake@users.noreply.github.com>
Copilot AI changed the title [WIP] Audit Hyperion codebase for bugs and performance issues Harden CLI config parsing with strict validation and boundary tests Apr 21, 2026
Copilot AI requested a review from ch55secake April 21, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daily Audit: 2026-04-21

2 participants