Skip to content

Reject undefined axial Kalman mean updates - #5236

Open
FlorianPfaff wants to merge 3 commits into
mainfrom
agent/reject-zero-axial-update
Open

Reject undefined axial Kalman mean updates#5236
FlorianPfaff wants to merge 3 commits into
mainfrom
agent/reject-zero-axial-update

Conversation

@FlorianPfaff

@FlorianPfaff FlorianPfaff commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Bug

AxialKalmanFilter.update_identity(...) always normalized the Euclidean posterior mean after the Kalman update.

For valid positive-definite state and measurement-noise covariances, the prior and innovation contributions can cancel exactly. The resulting axial mean is mathematically undefined, but floating-point arithmetic leaves a tiny residual. Normalizing that residual amplifies roundoff into an arbitrary unit direction.

A concrete two-dimensional case produces the raw mean

[-1.11022302e-15, -2.47677333e-16]

which current main normalizes to approximately

[-0.9760, -0.2177]

although no meaningful direction is defined.

Fix

  • compute the posterior mean norm once;
  • reject non-finite norms explicitly;
  • reject zero or numerically negligible posterior means before normalization;
  • leave the filter state unchanged when the update is undefined.

Regression coverage

Add a focused two-dimensional update with valid positive-definite covariance matrices that cancels the posterior mean. The regression verifies that the update raises a clear ValueError and preserves both the prior mean and covariance.

Validation

  • reproduced the arbitrary pre-fix normalized direction in an isolated NumPy calculation;
  • executed the exact patched module in a minimal backend-compatible harness;
  • verified the undefined update is rejected and state mutation is atomic;
  • syntax-compiled both changed Python files;
  • passed a focused 88-column line-length check;
  • branch is 3 commits ahead and 0 behind main.

GitHub Actions provides the authoritative full backend, lint, packaging, and integration validation.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 15.59s
✅ JSON prettier 7 0 0 0 0.59s
✅ JSON v8r 7 0 0 3.03s
✅ MARKDOWN markdownlint 68 0 0 0 1.14s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.39s
✅ PYTHON black 1866 89 0 0 56.45s
✅ PYTHON isort 1866 141 0 0 2.04s
✅ REPOSITORY betterleaks yes no no 1.53s
✅ REPOSITORY checkov yes no no 44.8s
✅ REPOSITORY gitleaks yes no no 10.98s
✅ REPOSITORY git_diff yes no no 0.16s
✅ REPOSITORY secretlint yes no no 45.76s
✅ REPOSITORY syft yes no no 3.67s
✅ REPOSITORY trivy-sbom yes no no 3.47s
✅ REPOSITORY trufflehog yes no no 16.76s
✅ YAML prettier 11 0 0 0 0.5s
✅ YAML v8r 11 0 0 7.58s
✅ YAML yamllint 11 0 0 0.38s

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

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@9.6.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_GITLEAKS,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

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

@FlorianPfaff
FlorianPfaff marked this pull request as ready for review August 7, 2026 17:59
@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 7, 2026 17:59
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