feat: expose whether the version profile is exact - #62
Conversation
get_profile already returns (profile, exact), but __init__ consumed the flag, logged a warning and discarded it. Nothing on the instance said whether it was running on the jar's own profile or a nearest-older fallback, so the one signal was a log line an application can silence by raising its log level. Store it as profile_exact. Comparing or_version to profile.version_string is not a substitute: parse_version maps 24.12.RC.01 to (24, 12), an exact match whose strings differ, so that reconstruction reports a fallback on every RC and point release. Closes #61
Review found the flag was shipped but undiscoverable, and that the docstring did not render. - The four docs that describe the fallback still taught the log warning as the mechanism. multi-version.md is the page a caller reads for this question; it now shows the flag and states why the string comparison is not equivalent. - The class docstring used an RST definition list, which griffe's sphinx parser passes through as description text and Markdown then collapses into one paragraph. Converted to :ivar:, the repo's existing style, and verified it renders as a table. - SimulationPool built an instance to validate the jar and discarded it, so a pool caller still had only the log line. It keeps the verdict now. - The RC case asserted nothing about the comparison its comment claimed to demonstrate. That claim is now an executable assertion.
Updated after independent reviewThe reviewer verified every claim in the original body (gate counts, the red-capable demonstration, the suppressed-logger reproduction, the RC trap, and that 1. The fix was undiscoverable. Four docs still taught the log warning as the mechanism — 2. The docstring did not render. 3. 4. A comment claimed a demonstration the test did not make. The RC case's comment said it showed why Also: PR title moved from Gate after the changes: Follow-ups filed separately rather than folded in here — the reviewer found other log-only sites, notably |
The previous edit put the flag in front of the parenthetical, making 'checks exactly this' read as a claim about CI coverage. canary.yml runs happy/summary/declarative_keys/motor_swap/wind_profile against the newest upstream release and asserts none of them against profile_exact -- it exercises the fallback path, it does not check the flag.
Closes #61.
get_profile()already returned(profile, exact).OpenRocketInstance.__init__consumed
exact, logged a warning, and discarded it — so no caller could tell anexact profile from a nearest-older fallback.
SimulationPoolhad the same defectone layer up: it builds an instance to validate the jar and fire that warning once
in the parent, then threw the instance away.
A log line is not a surface. An application that raises its log level silences the
only signal, leaving no exception, no return value and no attribute. And the obvious
reconstruction is wrong:
parse_versionmaps24.12.RC.01to(24, 12), an exactmatch whose version strings differ, so
or_version != profile.version_stringreportsa fallback on every RC and point release.
Adds
OpenRocketInstance.profile_exact—Truewhen a profile for the jar's exactversion is checked in,
Falseon a nearest-older fallback.SimulationPool.profile_exact— the same verdict on the pool, which is themonte-carlo path where running on stale enums matters most.
Both are additive.
tests/test_api_surface.pyfreezes module-level__all__, whichis unaffected.
Docs
Four pages described the fallback as a warning, which would have left the fix
undiscoverable to anyone not reading source.
docs/guides/multi-version.md— thepage a caller reads for this question — now shows the flag with a worked example and
states why the string comparison is not equivalent.
docs/index.md,README.mdanddocs/maintainers.mdupdated to match.The class docstring uses
:ivar:rather than an RST definition list:mkdocs.ymlsets
docstring_style: sphinx, and the definition-list form was passed through asdescription text and collapsed by Markdown into a single run-on paragraph.
mkdocs build --strictdoes not catch that.Verification
5 new test functions, 7 cases with parametrisation. Reverting both assignments and
keeping the tests:
All seven are red-capable; none is a presence check. Both directions are pinned, so a
hardcoded constant fails too, and
test_string_comparison_is_not_a_substitute_for_profile_exactalso kills the mutant that implements
profile_exactas the naive string comparison.Restored:
just check && just test— 231 passed, 2 skipped.mkdocs build --strictclean.
Not in this change
Helper.get_eventsdrops unknown flight-event types and returns a dict that lookscomplete — the same defect a layer up, filed as #63.
Helper._warn_absent_onceand_warn_on_profile_driftare weaker variants of it. One logical change per commit, and#63 needs its own decision about the return shape.