Repository navigation
Harden telemetry ingestion boundary: no 0.0 fallback, TypeError-proof floatify, guarded timestamps, kalman frame-length check - #207
Draft
mrizvi96 wants to merge 1 commit into
Conversation
…ation, kalman frame guard) + property/kill tests Fixes nasa#206
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.
Fixes #206.
Changes
onair/data_handling/parser_util.pyfloatify_input(): catches(ValueError, TypeError)aroundfloat()(no more TypeError crash on
None/dict/list); non-finite results(
"nan"/"inf"strings, NaN/Inf floats) never enter the output;unparseable values — including the
"-"stale-data sentinel — aresubstituted with
math.nanplus aprint_msgWARNING naming the value(or dropped entirely when
remove_str=True). The silent0.0fallbackis removed everywhere; policy documented in the docstring.
convert_str_to_timestamp(): rejects non-strinputs up front;MM:SSfallback requires exactly two colon-separated parts, bothinteger-parseable, minute and second in 0..59 — else
ValueError."12:34:56"is no longer silently truncated; no IndexError /AttributeError leaks.
plugins/kalman/kalman_plugin.py—Plugin.update(): frames whose lengthdoes not match
len(self.headers)are rejected with a WARNING naming bothlengths; non-finite values are skipped per-attribute, so windows contain
only finite floats (a skipped sample advances no window).
mathonly; no new dependencies.mock-only behavior (every edit marked with an inline
# updated:comment;no assertions weakened).
Validation
All 371 existing tests pass on the unchanged baseline (
python -m pytest test/ -q); 401 pass with this change — 30 new tests:preservation, finite-float identity,
"-"sentinel policy, NaN/Infnormalization, timestamp validity), each at
max_examples=1000, deadline=None;RuleBasedStateMachinefeedingvalid/junk/short/long/NaN-spiked frames (invariants: update() never
raises, windows stay finite and length-aligned) plus 3 frame-rejection
properties;
exact warning text, and the frame-length guard.
Mutation testing (mutmut), before → after, two runner configurations
(legacy files only; legacy + property files derandomized), each run twice
with identical results:
parser_util.py(52 mutants)floatify_inputPlugin.update()in-scope mutantsFull evidence — survivor catalogs, pre-patch falsifying examples, kill
tables, policy semantics, legacy-test change log — included in this PR
(
doc/telemetry-hardening-report.md).Notes for reviewers
changes; happy to split into parser / kalman PRs if preferred.
MM:SSepoch uses naivedatetime.timestamp()(host-local time).This is pre-existing upstream behavior, intentionally preserved; flagged
in the report (§11.3) as a candidate decision for maintainers.