Skip to content

Reject inconsistent RTS measurement matrix rows - #4979

Merged
FlorianPfaff merged 2 commits into
mainfrom
agent/reject-rts-measurement-row-mismatch
Aug 3, 2026
Merged

Reject inconsistent RTS measurement matrix rows#4979
FlorianPfaff merged 2 commits into
mainfrom
agent/reject-rts-measurement-row-mismatch

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

RauchTungStriebelSmoother.filter() derives the measurement dimension from the normalized measurements, but previously accepted any rectangular observation matrix whose column count matched the state dimension.

For scalar measurements of a two-dimensional state, passing H = eye(2) therefore produced an innovation with shape (2,): NumPy broadcast the scalar measurement to both observation rows. The filter silently processed two identical observations instead of rejecting an inconsistent model specification.

Fix

  • require every normalized linear measurement matrix to have exact shape (measurement_dim, state_dim);
  • raise a deterministic ValueError before the Kalman update can broadcast incompatible inputs;
  • add a regression for scalar measurements paired with a two-row observation matrix.

Impact

Malformed RTS observation models now fail at the input boundary instead of silently changing the effective measurement dimension. Valid rectangular matrices such as shape (1, 2) remain supported.

Validation

  • reproduced the pre-fix broadcast in an isolated NumPy check: a (1,) measurement minus a (2,) predicted observation becomes [1.0, 1.0] with shape (2,);
  • syntax-compiled the modified smoother and regression test;
  • branch is 2 commits ahead and 0 behind main;
  • final diff is limited to 9 source lines and one 27-line regression test.

GitHub Actions provides the repository's full supported Python and backend validation matrix.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 28.69s
✅ JSON prettier 7 0 0 0 1.24s
✅ JSON v8r 7 0 0 4.91s
✅ MARKDOWN markdownlint 68 0 0 0 1.8s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 1.04s
✅ PYTHON black 1810 56 0 0 93.84s
✅ PYTHON isort 1810 88 0 0 2.8s
✅ REPOSITORY betterleaks yes no no 2.29s
✅ REPOSITORY checkov yes no no 57.65s
✅ REPOSITORY gitleaks yes no no 17.36s
✅ REPOSITORY git_diff yes no no 0.26s
✅ REPOSITORY secretlint yes no no 78.77s
✅ REPOSITORY syft yes no no 5.43s
✅ REPOSITORY trivy-sbom yes no no 7.05s
✅ REPOSITORY trufflehog yes no no 32.75s
✅ YAML prettier 11 0 0 0 0.77s
✅ YAML v8r 11 0 0 12.35s
✅ YAML yamllint 11 0 0 0.52s

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 3, 2026 08:44
@FlorianPfaff
FlorianPfaff merged commit eb80e83 into main Aug 3, 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