Skip to content

Reject non-boolean circular Fourier scaling flags - #5450

Merged
FlorianPfaff merged 3 commits into
mainfrom
fix/circular-fourier-bool-validation
Aug 28, 2026
Merged

Reject non-boolean circular Fourier scaling flags#5450
FlorianPfaff merged 3 commits into
mainfrom
fix/circular-fourier-bool-validation

Conversation

@FlorianPfaff

@FlorianPfaff FlorianPfaff commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • validate CircularFourierDistribution.multiplied_by_n as an actual boolean instead of relying on Python truthiness
  • validate store_values_multiplied_by_n in both Fourier factory paths
  • preserve support for NumPy boolean scalars
  • add regression tests for strings, integers, None, factory calls, and NumPy booleans

Why

The current implementation stores these public scaling flags without validation. Values such as multiplied_by_n="False" are truthy in Python, so they silently enable coefficient scaling and change pdf() / integrate() results instead of behaving as false or failing fast. The factory flag has the same problem and can silently choose the wrong coefficient normalization.

The fix uses a small distribution-local strict boolean validator so it does not introduce a distributions -> models -> distributions import cycle.

Testing

Added focused regressions in tests/distributions/test_circular_fourier_bool_validation.py. Full repository CI validates backend and documentation compatibility.

@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 28, 2026 07:41
@github-actions

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 7.27s
✅ JSON prettier 7 0 0 0 0.64s
✅ JSON v8r 7 0 0 4.93s
✅ MARKDOWN markdownlint 68 0 0 0 1.91s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.41s
✅ PYTHON black 2031 0 0 0 57.09s
✅ PYTHON isort 2031 1 0 0 2.75s
✅ REPOSITORY betterleaks yes no no 1.18s
✅ REPOSITORY checkov yes no no 33.03s
✅ REPOSITORY git_diff yes no no 0.13s
✅ REPOSITORY secretlint yes no no 99.57s
✅ REPOSITORY syft yes no no 2.8s
✅ REPOSITORY trivy-sbom yes no no 2.83s
✅ YAML prettier 11 0 0 0 0.61s
✅ YAML v8r 11 0 0 15.57s
✅ YAML yamllint 11 0 0 0.83s

Notices

⚠️ Your configuration references items that have been removed from MegaLinter and are ignored: MAKEFILE_CHECKMAKE. See Removed linters to find their replacements.

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.0.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

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

@FlorianPfaff
FlorianPfaff merged commit eec266f into main Aug 28, 2026
24 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