Skip to content

Added history recorder#1744

Merged
FlorianPfaff merged 21 commits intomainfrom
history_recorder
Apr 23, 2026
Merged

Added history recorder#1744
FlorianPfaff merged 21 commits intomainfrom
history_recorder

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 19, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 21.43s
✅ JSON prettier 2 0 0 0 0.87s
✅ JSON v8r 2 0 0 2.9s
✅ MARKDOWN markdownlint 2 0 0 0 0.68s
✅ MARKDOWN markdown-table-formatter 2 0 0 0 0.22s
✅ PYTHON bandit 363 0 0 5.51s
✅ PYTHON black 363 9 0 0 8.75s
✅ PYTHON flake8 363 0 0 3.06s
✅ PYTHON isort 363 10 0 0 0.73s
✅ PYTHON mypy 363 0 0 5.17s
✅ PYTHON pylint 363 0 0 111.53s
✅ PYTHON ruff 363 10 0 0 0.07s
✅ REPOSITORY checkov yes no no 24.71s
✅ REPOSITORY gitleaks yes no no 8.98s
✅ REPOSITORY git_diff yes no no 0.03s
✅ REPOSITORY secretlint yes no no 6.67s
✅ REPOSITORY syft yes no no 2.53s
✅ REPOSITORY trivy-sbom yes no no 2.29s
✅ REPOSITORY trufflehog yes no no 21.24s
✅ YAML prettier 4 0 0 0 0.47s
✅ YAML v8r 4 0 0 5.99s
✅ YAML yamllint 4 0 0 0.45s

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.4.0 --custom-flavor-setup --custom-flavor-linters PYTHON_PYLINT,PYTHON_BLACK,PYTHON_FLAKE8,PYTHON_ISORT,PYTHON_BANDIT,PYTHON_MYPY,PYTHON_RUFF,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,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
Copy link
Copy Markdown
Owner Author

@copilot Do not use numpy, import from pyrecest.backend instead (see other classes)

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Fix these

❌ PYTHON / flake8 - 1 error
pyrecest/filters/abstract_extended_object_tracker.py:6:1: F401 'pyrecest.backend.array' imported but unused
❌ PYTHON / pylint - 15 errors
************* Module pyrecest.filters.abstract_extended_object_tracker
pyrecest/filters/abstract_extended_object_tracker.py:6:0: W0611: Unused array imported from pyrecest.backend (unused-import)
************* Module pyrecest.filters.abstract_tracker_with_logging
pyrecest/filters/abstract_tracker_with_logging.py:32:12: W0201: Attribute 'prior_extents_over_time' defined outside init (attribute-defined-outside-init)
pyrecest/filters/abstract_tracker_with_logging.py:48:16: W0201: Attribute 'prior_extents_over_time' defined outside init (attribute-defined-outside-init)
pyrecest/filters/abstract_tracker_with_logging.py:34:12: W0201: Attribute 'posterior_extents_over_time' defined outside init (attribute-defined-outside-init)
pyrecest/filters/abstract_tracker_with_logging.py:51:16: W0201: Attribute 'posterior_extents_over_time' defined outside init (attribute-defined-outside-init)
************* Module pyrecest.tests.test_history_recorder
pyrecest/tests/test_history_recorder.py:25:4: W0246: Useless parent or super() delegation in method 'init' (useless-parent-delegation)
pyrecest/tests/test_history_recorder.py:107:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:109:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:111:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:123:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:124:8: W0212: Access to a protected member _extent of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:128:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:129:8: W0212: Access to a protected member _extent of a client class (protected-access)
************* Module pyrecest.utils.history_recorder
pyrecest/utils/history_recorder.py:10:0: R0402: Use 'from pyrecest import backend' instead (consider-using-from-import)
pyrecest/utils/history_recorder.py:79:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)


Your code has been rated at 9.99/10

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

@copilot Do not use numpy, import from pyrecest.backend instead (see other classes)

Fixed in 33a2b3d. Replaced import numpy as np with from pyrecest.backend import array, zeros and from math import nan in test_history_recorder.py, following the convention used in other filter test files.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 19, 2026

Test Results

    12 files  ± 0     12 suites  ±0   4h 3m 38s ⏱️ - 19m 52s
 1 003 tests + 6  1 003 ✅ + 6      0 💤 ±0  0 ❌ ±0 
12 320 runs  +72  9 516 ✅ +68  2 804 💤 +4  0 ❌ ±0 

Results for commit 191df81. ± Comparison against base commit 89819a9.

♻️ This comment has been updated with latest results.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Fix this

************* Module pyrecest.filters.abstract_extended_object_tracker
pyrecest/filters/abstract_extended_object_tracker.py:6:0: W0611: Unused array imported from pyrecest.backend (unused-import)
************* Module pyrecest.filters.abstract_tracker_with_logging
pyrecest/filters/abstract_tracker_with_logging.py:32:12: W0201: Attribute 'prior_extents_over_time' defined outside init (attribute-defined-outside-init)
pyrecest/filters/abstract_tracker_with_logging.py:48:16: W0201: Attribute 'prior_extents_over_time' defined outside init (attribute-defined-outside-init)
pyrecest/filters/abstract_tracker_with_logging.py:34:12: W0201: Attribute 'posterior_extents_over_time' defined outside init (attribute-defined-outside-init)
pyrecest/filters/abstract_tracker_with_logging.py:51:16: W0201: Attribute 'posterior_extents_over_time' defined outside init (attribute-defined-outside-init)
************* Module pyrecest.tests.test_history_recorder
pyrecest/tests/test_history_recorder.py:28:4: W0246: Useless parent or super() delegation in method 'init' (useless-parent-delegation)
pyrecest/tests/test_history_recorder.py:110:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:112:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:114:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:126:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:127:8: W0212: Access to a protected member _extent of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:131:8: W0212: Access to a protected member _estimate of a client class (protected-access)
pyrecest/tests/test_history_recorder.py:132:8: W0212: Access to a protected member _extent of a client class (protected-access)
************* Module pyrecest.utils.history_recorder
pyrecest/utils/history_recorder.py:10:0: R0402: Use 'from pyrecest import backend' instead (consider-using-from-import)
pyrecest/utils/history_recorder.py:79:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)


auto-merge was automatically disabled April 20, 2026 02:12

Head branch was pushed to by a user without write access

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot Fix these

❌ PYTHON / flake8 - 1 error
...

Fixed in 4dc1dd1:

  • Removed unused array import from abstract_extended_object_tracker.py
  • Initialized prior_extents_over_time/posterior_extents_over_time to None in AbstractTrackerWithLogging.__init__
  • Changed import pyrecest.backend as backend to from pyrecest import backend in history_recorder.py
  • Added return None for consistent return statements in clear()
  • Removed useless __init__ from _DummyFilter
  • Renamed _estimate/_extent to public estimate/extent in dummy test classes

@copilot Fix this

************* Module pyrecest.filters.abstract_extended_object_tracker
...

Fixed in 4dc1dd1. All the listed pylint warnings have been addressed.

@FlorianPfaff FlorianPfaff enabled auto-merge (squash) April 20, 2026 02:22
@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Fix this

=================================== FAILURES ===================================
___ HistoryRecorderTest.test_filter_helpers_record_state_and_point_estimate ____

self = <pyrecest.tests.test_history_recorder.HistoryRecorderTest testMethod=test_filter_helpers_record_state_and_point_estimate>

def test_filter_helpers_record_state_and_point_estimate(self):
  filter_obj = _DummyFilter(_DummyBelief([1.0, 2.0]))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

E TypeError: Can't instantiate abstract class _DummyFilter without an implementation for abstract method 'init'

pyrecest/tests/test_history_recorder.py:94: TypeError

auto-merge was automatically disabled April 20, 2026 05:52

Head branch was pushed to by a user without write access

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Adaptations for new TrackManager in latest main:

@@
@DataClass
class Track:
@@

  • history: List[Dict[str, Any]] = field(default_factory=list)
  • event_history: List[Dict[str, Any]] = field(default_factory=list)

@@ class TrackManager.init
self.tracks: List[Track] = []
self._next_track_id = 0
self._current_step = -1

  •    if self.keep_history and "track_events" not in self.history:
    
  •        self.history.register("track_events")
    

@@
def _record_history(self, track: Track, step: int, event: str, **payload) -> None:
if not self.keep_history:
return

  •    event_record = {"step": int(step), "event": event}
    
  •    event_record = {"track_id": track.track_id, "step": int(step), "event": event}
       event_record.update(payload)
    
  •    track.history.append(event_record)
    
  •    track.event_history.append(copy.deepcopy(event_record))
    
  •    self.record_history("track_events", event_record, copy_value=True)
    
  • def clear_history(self, name=None):

  •    super().clear_history(name)
    
  •    if name is None or name == "track_events":
    
  •        for track in self.tracks:
    
  •            track.event_history.clear()
    

Copilot AI and others added 2 commits April 20, 2026 06:23
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 06b3e0e. Merged origin/main (which added the new pyrecest/smoothers/ module) into the branch, keeping our event_history/track_events changes in track_manager.py and bringing in the new smoother files cleanly.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot resolve the merge conflicts in this pull request

The branch is already up-to-date with origin/main — the last merge commit (06b3e0e) already incorporated the latest main (4832ce7 Added first smoothers). There are no merge conflicts to resolve.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Can you fix this?

❌ PYTHON / flake8 - 10 errors
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'AssociationResult' from line 59
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'Track' from line 59
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'TrackManager' from line 59
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'TrackManagerStepResult' from line 59
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'TrackStatus' from line 59
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'build_global_nearest_neighbor_associator' from line 59
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'build_kalman_measurement_initiator' from line 59
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'build_linear_gaussian_predictor' from line 59
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'build_linear_gaussian_updater' from line 59
pyrecest/filters/init.py:73:1: F811 redefinition of unused 'solve_global_nearest_neighbor' from line 59
❌ PYTHON / mypy - 1 error
pyrecest/utils/history_recorder.py:34: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
pyrecest/smoothers/unscented_rauch_tung_striebel_smoother.py:50: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
pyrecest/filters/track_manager.py:201: error: Unsupported right operand type for in ("Any | None") [operator]
Found 1 error in 1 file (checked 346 source files)
❌ PYTHON / pylint - 11 errors
************* Module pyrecest.filters
pyrecest/filters/init.py:73:0: W0404: Reimport 'AssociationResult' (imported line 59) (reimported)
pyrecest/filters/init.py:73:0: W0404: Reimport 'Track' (imported line 59) (reimported)
pyrecest/filters/init.py:73:0: W0404: Reimport 'TrackManager' (imported line 59) (reimported)
pyrecest/filters/init.py:73:0: W0404: Reimport 'TrackManagerStepResult' (imported line 59) (reimported)
pyrecest/filters/init.py:73:0: W0404: Reimport 'TrackStatus' (imported line 59) (reimported)
pyrecest/filters/init.py:73:0: W0404: Reimport 'build_global_nearest_neighbor_associator' (imported line 59) (reimported)
pyrecest/filters/init.py:73:0: W0404: Reimport 'build_kalman_measurement_initiator' (imported line 59) (reimported)
pyrecest/filters/init.py:73:0: W0404: Reimport 'build_linear_gaussian_predictor' (imported line 59) (reimported)
pyrecest/filters/init.py:73:0: W0404: Reimport 'build_linear_gaussian_updater' (imported line 59) (reimported)
pyrecest/filters/init.py:73:0: W0404: Reimport 'solve_global_nearest_neighbor' (imported line 59) (reimported)
************* Module pyrecest.filters.track_manager
pyrecest/filters/track_manager.py:155:4: R0914: Too many local variables (17/15) (too-many-locals)


Your code has been rated at 9.99/10

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot Can you fix this?

❌ PYTHON / flake8 - 10 errors
...

Fixed in 0ff1ff5:

  • Removed the duplicate from .track_manager import (...) block at line 73 in pyrecest/filters/__init__.py (was identical to the one at line 59) — resolves all 10 flake8 F811 and pylint W0404 errors
  • Replaced the getattr-based defensive pattern with direct self.history access in TrackManager.__init__ — fixes the mypy Unsupported right operand type for in ("Any | None") error and eliminates the tracker_history/register intermediate locals, bringing the variable count from 17 to 15

@FlorianPfaff FlorianPfaff force-pushed the main branch 4 times, most recently from 7b21428 to 429a157 Compare April 21, 2026 13:50
@FlorianPfaff FlorianPfaff enabled auto-merge (squash) April 23, 2026 15:00
@FlorianPfaff FlorianPfaff merged commit 1e7418a into main Apr 23, 2026
17 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.

2 participants