Skip to content

Harden metric parameter validation#186

Merged
FlorianPfaff merged 2 commits into
mainfrom
codex/harden-metric-parameter-validation-20260526
May 26, 2026
Merged

Harden metric parameter validation#186
FlorianPfaff merged 2 commits into
mainfrom
codex/harden-metric-parameter-validation-20260526

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Member

Summary

  • Add explicit validators for non-negative finite probability-normalization tolerance and positive-integer metric parameters.
  • Reject malformed n_bins and k values before metric computations instead of relying on implicit NumPy/Python coercions.
  • Add regression coverage for malformed tolerance, calibration-bin, and top-k parameters while preserving integer-like float inputs such as 2.0.

Validation

  • Branch diff against main: 2 commits ahead, 0 behind.
  • Focused regression tests added in tests/test_metrics.py; full validation should run in PR CI.

Risk and compatibility

  • Valid existing calls are unchanged, including integer-like float values for n_bins.
  • Invalid booleans, NaN/inf, fractional, zero, and negative parameter values now fail fast with actionable ValueErrors.

@github-actions
Copy link
Copy Markdown

Test Results

    4 files  ± 0      4 suites  ±0   1m 30s ⏱️ -14s
  658 tests +17    649 ✅ +17   9 💤 ±0  0 ❌ ±0 
2 632 runs  +68  2 596 ✅ +68  36 💤 ±0  0 ❌ ±0 

Results for commit f195b7d. ± Comparison against base commit 8545378.

@github-actions
Copy link
Copy Markdown

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 14 0 0 0.49s
✅ COPYPASTE jscpd yes no no 7.81s
⚠️ MARKDOWN markdownlint 55 0 1 0 1.77s
✅ PYTHON ruff 246 0 0 0 0.39s
✅ REPOSITORY git_diff yes no no 0.03s
✅ YAML prettier 48 0 0 0 1.61s
✅ YAML v8r 48 0 0 7.9s
✅ YAML yamllint 48 0 0 1.09s

Detailed Issues

⚠️ MARKDOWN / markdownlint - 1 error
.github/PULL_REQUEST_TEMPLATE.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Summary"]

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff FlorianPfaff merged commit 97e7abf into main May 26, 2026
15 checks passed
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.

1 participant