Skip to content

Fix/value range detector keyerror - #234

Closed
viktorbeck98 wants to merge 6 commits into
developmentfrom
fix/value-range-detector-keyerror
Closed

Fix/value range detector keyerror#234
viktorbeck98 wants to merge 6 commits into
developmentfrom
fix/value-range-detector-keyerror

Conversation

@viktorbeck98

@viktorbeck98 viktorbeck98 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

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

  • This Pull-Request goes to the development branch.
  • I have successfully run prek locally.
  • I have added tests to cover my changes.
  • I have linked the issue-id to the task-description.
  • I have performed a self-review of my own code.

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>
@viktorbeck98
viktorbeck98 requested a review from ipmach July 21, 2026 13:27
@viktorbeck98 viktorbeck98 self-assigned this Jul 21, 2026
Base automatically changed from development to main August 10, 2026 11:25
@viktorbeck98
viktorbeck98 changed the base branch from main to development August 17, 2026 09:01
Base automatically changed from development to main August 17, 2026 11:07
@viktorbeck98
viktorbeck98 changed the base branch from main to development August 20, 2026 08:07
…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
Base automatically changed from development to main August 20, 2026 10:05
@viktorbeck98
viktorbeck98 changed the base branch from main to development August 20, 2026 10:09
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