Fix/value range detector keyerror - #234
Closed
viktorbeck98 wants to merge 6 commits into
Closed
Conversation
cast_val_to_numeric used a hard configured_variables[k] lookup, but in the detection path k comes from variables learned during training. For variable-length events, the current line can legitimately lack that variable (get_configured_variables skips positions beyond the line's variable count), raising KeyError. The detect loop already intends to skip absent vars via .get() and `value is None`, but the crash happened first. Guard the lookup so the helper is consistent with that contract. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e-detector-keyerror # Conflicts: # src/detectmatelibrary/utils/persistency/event_data_structures/trackers/stability/stability_classifier.py # src/detectmatelibrary/utils/persistency/event_data_structures/trackers/stability/stability_tracker.py # tests/test_persistency/test_time_dependent_stability.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task
#233
Description
KeyError on variable-length events: cast_val_to_numeric did a hard configured_variables[k] lookup for training-learned vars that the current line may lack → added if k not in configured_variables: return False so the detector skips them instead of crashing.
How Has This Been Tested?
Checklist