Skip to content

Reject non-finite linear-Gaussian primitive inputs - #5435

Merged
FlorianPfaff merged 2 commits into
mainfrom
agent/fix-linear-gaussian-nonfinite-20260826
Aug 26, 2026
Merged

Reject non-finite linear-Gaussian primitive inputs#5435
FlorianPfaff merged 2 commits into
mainfrom
agent/fix-linear-gaussian-nonfinite-20260826

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Summary

  • reject NaN and infinite vectors/matrices at the backend-native linear-Gaussian primitive boundary
  • cover prediction and update inputs, including deterministic system inputs and noise covariances
  • add regressions proving failed Kalman predict/update calls leave the filter state unchanged

Bug

pyrecest.filters._linear_gaussian rejected boolean and complex inputs but still accepted NaN/Inf. Those values could propagate through linear_gaussian_predict() or linear_gaussian_update() and then be installed into a KalmanFilter state with check_validity=False, silently poisoning subsequent estimates.

The higher-level linear-Gaussian model layer already rejects non-finite values, so the primitive API had inconsistent validation depending on which entry point was used.

Fix

Add a backend-to-NumPy finiteness check after vector/matrix coercion and before any prediction, innovation, solve, or state mutation.

Tests

Added regressions for non-finite:

  • state means and covariances
  • transition and measurement matrices
  • process and measurement noise covariances
  • deterministic system inputs and measurements
  • Kalman prediction/update atomicity on validation failure

Branch is 2 commits ahead of main, 0 behind; the diff is limited to 11 source-line additions plus the focused test module.

@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 26, 2026 08:22
@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.58s
✅ JSON prettier 7 0 0 0 0.81s
✅ JSON v8r 7 0 0 4.47s
✅ MARKDOWN markdownlint 68 0 0 0 2.4s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.45s
✅ PYTHON black 2024 6 0 0 67.5s
✅ PYTHON isort 2024 8 0 0 3.0s
✅ REPOSITORY betterleaks yes no no 1.71s
✅ REPOSITORY checkov yes no no 36.2s
✅ REPOSITORY git_diff yes no no 0.18s
✅ REPOSITORY secretlint yes no no 108.78s
✅ REPOSITORY syft yes no no 2.6s
✅ REPOSITORY trivy-sbom yes no no 2.92s
✅ YAML prettier 11 0 0 0 0.98s
✅ YAML v8r 11 0 0 17.59s
✅ YAML yamllint 11 0 0 0.87s

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 cd94246 into main Aug 26, 2026
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