Repository navigation
Description
Summary
When a jar's version has no checked-in profile, get_profile() correctly
returns (profile, exact=False) — but OpenRocketInstance.__init__ consumes
that flag, logs a warning, and discards it. Nothing on the instance says
whether it is running on an exact profile or a nearest-older fallback.
The fallback is a could not tell: orlab is telling you it does not know this
OpenRocket version and is proceeding on older facts, where "newer constants may
be missing from orlab's enums". That belongs in the object, not only in a log
line.
Reproduction
Fake jars carrying only build.properties; __init__ reads the version and
selects the profile without starting a JVM, so no OpenRocket install is needed.
i = OpenRocketInstance(jar_path=fake_jar("25.09")) # no profile for 25.09
print(i.or_version, i.profile.version_string) # 25.09 24.12=== Can a caller branch on "am I on a fallback?" ===
public attributes: MANUAL_JVM_PATH, jar_path, jvm_args, jvm_path, openrocket,
or_log_level, or_version, profile, started
attributes naming exact/fallback/approximate: NONE
The warning is the only signal, and it is suppressible
Setting the root logger to ERROR — an ordinary application choice — removes it
entirely:
(root logger set to ERROR, as an application might)
--- constructing a 25.09 instance; any warning should appear below ---
--- end ---
instance built. or_version=25.09 profile=24.12
the caller received: no exception, no return value, no attribute.
The obvious workaround is wrong
Comparing or_version to profile.version_string looks like it recovers the
flag. It does not — parse_version maps 24.12.RC.01 to (24, 12), an
exact match, while the strings differ:
| jar | truth | or_version != profile.version_string |
|---|---|---|
24.12 |
exact | exact |
25.09 |
fallback | fallback |
24.12.RC.01 |
exact | fallback — wrong |
26.xx-SNAPSHOT |
fallback | fallback |
So a consumer that reconstructs the flag gets false positives on every RC and
point-release build.
Suggested fix
Keep the value that already exists:
self.profile, self.profile_exact = get_profile(self.or_version)
if not self.profile_exact:
logger.warning(...)Additive and non-breaking. tests/test_api_surface.py freezes the public
surface, so this is a deliberate addition rather than a rename.
Worth considering alongside: Helper warns once per absent
FlightDataType/getter via _warn_absent_once, which has the same shape — the
caller learns that a requested quantity was unavailable only from a log line
that fires once per process.
Why this is filed
orlab is a heibench member, and the org contract's §3 states that degrading to
an older profile is a "could not tell" that must reach the caller as a value.
A4 in that contract recorded this as suspected but untested; this is the
test. Reproduced against main @ b0708f9.
Activity
feat: expose whether the version profile is exact (#62)
fix(events): say which event types could not be interpreted (#67)
chore(release): 0.10.0 (#68)