Skip to content

Fix/value range detector keyerror#234

Open
viktorbeck98 wants to merge 5 commits into
developmentfrom
fix/value-range-detector-keyerror
Open

Fix/value range detector keyerror#234
viktorbeck98 wants to merge 5 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.

viktorbeck98 and others added 3 commits July 14, 2026 16:20
Add a time_dependent config that cuts StabilityClassifier segments at
equal-duration boundaries of the observed time span instead of
equal-count boundaries of the change series.

- StabilityClassifier.is_stable gains optional timestamps; boundaries
  via np.searchsorted on equal-duration cuts, count-mode fallback on
  missing/mismatched/non-finite timestamps or zero span (never raises)
- SingleStabilityTracker(time_dependent=...) stores exact per-occurrence
  timestamps; state round-trips via msgpack, legacy snapshots load
- timestamp threaded EventPersistency.ingest_event -> add_data ->
  add_value as optional trailing param; dataframe backends accept+ignore
- EventStabilityTracker(time_dependent=...) forwards via closure factory
  (survives load(), mirroring expand_value)

Default off is bit-for-bit unchanged. 17 new tests; full suite 550 pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
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