Skip to content

Added history recorder#1744

Open
FlorianPfaff wants to merge 15 commits intomainfrom
history_recorder
Open

Added history recorder#1744
FlorianPfaff wants to merge 15 commits intomainfrom
history_recorder

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 19, 2026

MegaLinter analysis: Error

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 11.63s
✅ JSON prettier 2 0 0 0 0.55s
✅ JSON v8r 2 0 0 2.83s
✅ MARKDOWN markdownlint 2 0 0 0 0.7s
✅ MARKDOWN markdown-table-formatter 2 0 0 0 0.21s
✅ PYTHON bandit 346 0 0 5.29s
✅ PYTHON black 346 6 0 0 8.16s
✅ PYTHON flake8 346 0 0 2.9s
✅ PYTHON isort 346 8 0 0 0.69s
✅ PYTHON mypy 346 0 0 4.99s
✅ PYTHON pylint 346 0 0 106.15s
✅ PYTHON ruff 346 8 0 0 0.07s
❌ REPOSITORY checkov yes 1 no 23.72s
✅ REPOSITORY gitleaks yes no no 6.15s
✅ REPOSITORY git_diff yes no no 0.05s
✅ REPOSITORY secretlint yes no no 6.66s
✅ REPOSITORY syft yes no no 3.43s
✅ REPOSITORY trivy-sbom yes no no 2.36s
✅ REPOSITORY trufflehog yes no no 18.03s
✅ YAML prettier 4 0 0 0 0.5s
✅ YAML v8r 4 0 0 4.91s
✅ YAML yamllint 4 0 0 0.47s

Detailed Issues

❌ REPOSITORY / checkov - 1 error
github_actions scan results:

Passed checks: 263, Failed checks: 1, Skipped checks: 0

Check: CKV_GHA_7: "The build output cannot be affected by user parameters other than the build entry point and the top-level source location. GitHub Actions workflow_dispatch inputs MUST be empty. "
	FAILED for resource: on(Check for version change, add tag, build, and publish)
	File: /.github/workflows/tags-and-publishing.yml:10-17

		10 |       dry_run:
		11 |         description: "Build only; do not push a tag or create/update a GitHub release"
		12 |         required: true
		13 |         type: boolean
		14 |         default: true
		15 | 
		16 | permissions:
		17 |   contents: write

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

github-actions bot commented Apr 19, 2026

Test Results

    12 files  ± 0     12 suites  ±0   4h 32m 34s ⏱️ + 8m 19s
   990 tests + 5    990 ✅ + 5      0 💤 ±0  0 ❌ ±0 
12 164 runs  +60  9 432 ✅ +60  2 732 💤 ±0  0 ❌ ±0 

Results for commit 924592e. ± Comparison against base commit 98a1969.

♻️ 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
@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

…event_history changes

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/cb574f77-5b76-4f66-a714-b599dd0a2a0b

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 6661f61. Merged origin/main (MegaLinter auto-formatting commit) into the branch, keeping our functional event_history/track_events changes in track_manager.py while accepting the upstream formatting fixes for both track_manager.py and multi_bernoulli_tracker.py.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

…lve track_manager.py conflict

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/1a29ba11-2f99-488f-a979-e057b279453f

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
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
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