Skip to content

Reject non-real Bingham measurement and system vectors - #5376

Merged
FlorianPfaff merged 2 commits into
mainfrom
fix/bingham-real-vector-validation-20260821
Aug 21, 2026
Merged

Reject non-real Bingham measurement and system vectors#5376
FlorianPfaff merged 2 commits into
mainfrom
fix/bingham-real-vector-validation-20260821

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Summary

  • reject boolean, textual, and complex-valued Bingham measurement vectors before backend arithmetic
  • apply the same real-numeric validation to nonlinear Bingham system-function outputs
  • add focused regression coverage for Python boolean/text inputs and backend boolean arrays

Bug

BinghamFilter validates measurement and nonlinear system-output vectors by shape, complex dtype, finiteness, and unit norm after backend conversion. Boolean vectors therefore slip through because booleans are finite numeric values and, for example, [True, False] has norm one. The filter silently interprets that vector as [1, 0], turning an upstream type error into a valid-looking orientation measurement/state.

Textual vectors can likewise reach backend-specific numerical conversion/arithmetic instead of being rejected consistently at the API boundary.

Fix

Validate raw vector inputs as unambiguously real numeric before converting them with the active backend. This rejects booleans, text/bytes, and complex values while preserving ordinary real Python lists and backend arrays.

Regression coverage

tests/filters/test_bingham_filter_real_vector_validation.py verifies rejection of:

  • Python boolean measurement vectors
  • backend boolean measurement arrays
  • boolean nonlinear system outputs
  • textual measurement vectors
  • textual nonlinear system outputs

The branch is based directly on current main at baac3b1736bb8e81eafc1e3f69e10104636103b9 and is 2 commits ahead / 0 behind. It supersedes the earlier closed, unmerged draft #5340 with a clean branch on the current head.

@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.11s
✅ JSON prettier 7 0 0 0 0.78s
✅ JSON v8r 7 0 0 5.16s
✅ MARKDOWN markdownlint 68 0 0 0 2.06s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.43s
✅ PYTHON black 1989 15 0 0 65.7s
✅ PYTHON isort 1989 27 0 0 2.9s
✅ REPOSITORY betterleaks yes no no 1.24s
✅ REPOSITORY checkov yes no no 35.23s
✅ REPOSITORY git_diff yes no no 0.13s
✅ REPOSITORY secretlint yes no no 104.99s
✅ REPOSITORY syft yes no no 2.55s
✅ REPOSITORY trivy-sbom yes no no 2.88s
✅ YAML prettier 11 0 0 0 0.59s
✅ YAML v8r 11 0 0 16.85s
✅ YAML yamllint 11 0 0 1.01s

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 56e4539 into main Aug 21, 2026
15 of 26 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