Skip to content

fix(events): say which event types could not be interpreted - #67

Merged
CameronBrooks11 merged 1 commit into
mainfrom
fix/63-events-report-what-was-dropped
Sep 6, 2026
Merged

fix(events): say which event types could not be interpreted#67
CameronBrooks11 merged 1 commit into
mainfrom
fix/63-events-report-what-was-dropped

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

get_events dropped event types this orlab has no enum member for and told the caller
only through a log line (helper.py:195-203). The returned dict then looked
complete
: a caller iterating it could not tell "this simulation had no such event"
from "orlab did not recognise the event and dropped it", and an application that raises
its log level saw nothing at all.

It matters most on exactly the jars #61 concerned. A newer OpenRocket running on a
nearest-older profile is where unknown event types appear -- so the case where rows go
missing from a result you are about to analyse is the same case where profile_exact
is already False.

Shape

get_events now returns EventTimes, a dict subclass carrying
unknown_event_types: frozenset[str].

events = orl.get_events(sim)
if events.unknown_event_types:
    print("not interpreted:", sorted(events.unknown_event_types))

The issue asked that "I could not interpret part of this result" be readable from the
return value, not only from a log
. A Helper attribute would have been the other
option and matches #61's profile_exact, but it is last-call state on an object reused
across simulations, so it would be wrong under SimulationPool. Subclassing dict
keeps it per-result and costs existing callers nothing -- indexing, == against a plain
dict, and dict(events) all behave as before, which is asserted.

The log line stays. The point is that the log can be silenced and the field cannot.

Tests

Four added to tests/test_events.py, using the existing no-JVM fakes. Three go red with
the source reverted and the tests kept; the fourth is the backward-compatibility control
and passes either way, which is what makes it a control. One of the three silences the
logger to CRITICAL and asserts the drop is still visible -- that is the precise failure
mode.

test_api_surface.py updated, since EventTimes is public API.

just check and just test green: 235 passed, 2 skipped (baseline 231).

Docs

docs/guides/multi-version.md described the old behaviour ("skipped by get_events
with a logged warning") and now shows the field.

Closes #63

get_events dropped event types this orlab has no enum member for and told
the caller only through a log line. The returned dict then looked
complete: a caller iterating it could not tell "this simulation had no
such event" from "orlab did not recognise the event and dropped it", and
an application that raises its log level saw nothing at all.

It matters most on exactly the jars #61 concerned. A newer OpenRocket
running on a nearest-older profile is where unknown event types appear,
so the case where rows go missing is the case where profile_exact is
already False.

get_events now returns EventTimes, carrying unknown_event_types. It is a
dict subclass, so callers that index or compare the result are
unaffected, and the log line stays -- but the log can be silenced and
the field cannot.

Closes #63
@CameronBrooks11
CameronBrooks11 merged commit 96a0c92 into main Sep 6, 2026
14 checks passed
@CameronBrooks11
CameronBrooks11 deleted the fix/63-events-report-what-was-dropped branch September 6, 2026 04:05
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.

get_events silently drops unknown event types: the returned dict looks complete

1 participant