Skip to content

Commit d703905

Browse files
Gui-FernandesBRgithub-actions[bot]claudethc1006wuisabel-gif
authored
Updates master with develop before releasing v1.14.0 (#1194)
* DOC: Update Changelog for PR #1081 * Merge pull request #1082 from RocketPy-Team/enh/llm-changelog-automation CI: make changelog automation LLM-based (Gemini) and race-safe * DOC: update changelog for PR #1082 * ENH: Resolve pressure_ISA discretization bounds TODO (#1056) * ENH: Resolve pressure_ISA discretization bounds TODO (#1056) * TST: Fix test_flight and environment interpolation due to new ISA bounds * MNT: self-document pressure_ISA bounds and strengthen discretization test Derive the pressure_ISA discretization bounds from the standard-atmosphere layer table (geopotential_height[0]/[-1]) instead of hardcoding -2000/80000, and document why the grid is split around sea level. Strengthen the discretization test with physical-sanity assertions (strictly increasing altitude, strictly decreasing pressure, sea level sampled). No change in numeric output. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * TST: update density doctest for new pressure_ISA discretization The finer spline knots shift density at 1000 m by ~1e-4 (density at sea level is unchanged since 0 m is still sampled exactly). Update the calculate_density_profile doctest expected value accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * TST: relax noisy stream_velocity_z apogee tolerance stream_velocity_z at apogee is a residual of the apogee-time estimation: it is physically ~0 but swings by ~1e-4 m/s across platforms/NumPy versions and atmosphere discretizations (e.g. -8.9e-8 on py3.10 with the new ISA grid, -2.0e-4 with the old grid, +2.6e-4 on py3.14). The previous atol=1e-5 was tighter than this numerical noise, making the assertion flaky. Use atol=1e-3, which is physically negligible (vertical speed peaks above 200 m/s) while still catching real regressions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * STY: apply ruff markdown formatting to README code blocks CI installs ruff unpinned; ruff 0.16 formats fenced Python blocks in Markdown by default, so `ruff format --check .` now flags README.md on every PR. Reformat the affected snippets (indentation, quotes, call wrapping) to unblock the lint check. No semantic changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * MNT: satisfy pylint on the pressure_ISA discretization changes CI runs pylint unpinned; three messages were attributable to this PR: - C0415 import-outside-toplevel: move the tools import to the test module top level. - R0915 too-many-statements: keep the discretization block compact so pressure_ISA stays within the 25-statement limit. - C0302 too-many-lines: the terser block keeps environment.py under the 3050-line module limit. np.append over two linspaces yields the same grid as the previous np.concatenate, so all numeric results are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ENH: Add native Meteomatics API support to the Environment class (#1079) * ENH: Add native Meteomatics API support to the Environment class Adds a new "meteomatics" atmospheric model to Environment.set_atmospheric_model, porting and generalizing the implementation from the EuRoC-Dev repository. - fetchers.py: fetch_meteomatics_token + fetch_atmospheric_data_from_meteomatics authenticate with username/password (short-lived token), query temperature, pressure and wind components by height above ground level, grouping the parameters to respect the account's per-request limit. - environment.py: process_meteomatics_atmosphere converts the height-AGL data to above-sea-level profiles using the Environment elevation; set_atmospheric_model gains username/password kwargs (falling back to METEOMATICS_USERNAME / METEOMATICS_PASSWORD env vars); save/load handles the new model type. - Network requests use timeouts, do not retry deterministic 4xx failures, and surface actionable RuntimeError messages. - Tests fully mock the API (no real requests, no charges); docs and changelog updated. Closes #545 * MNT: simplify Meteomatics fetcher and profile assembly Follow-up cleanups from the code review of the Meteomatics support: - Collapse the duplicated request/error ladder of the login and data endpoints into a single `_meteomatics_request_json` helper. - Have `_build_meteomatics_parameters` return a {parameter: (profile, height)} mapping so the response parser no longer regex-parses back the strings this module just built. Drops the regex constant and the variable-to-profile table. - Generalize `to_profile_array` to several profiles at once, so the wind u/v grid intersection reuses it instead of repeating it inline. - Reuse the existing `__validate_datetime` helper for the launch-date check, and simplify the model default to `model or "mix"`. - Normalize `atmospheric_model_type` once in `from_dict`. The type is stored as the user spelled it, so the previously case-sensitive `match` and `== "ensemble"` branches silently dropped the ensemble arrays for an Environment built with `type="Ensemble"`. - Trim the elevation warning and raise it before the API call, so it is shown even when the request later fails. * MNT: address Meteomatics review comments Two points raised in the PR review: - `fetch_atmospheric_data_from_meteomatics` stamped the instant with a trailing "Z" without normalizing the timezone, so an aware datetime in a non-UTC zone was sent as the wrong instant. Aware datetimes are now converted to UTC; naive ones are documented as assumed UTC. - Degenerate sampling arguments (`query_limit=0`, resolutions below 2) reached `range()`/`linspace()` and failed with an opaque low-level error after the login had already been paid for. They are now validated up front by `_validate_meteomatics_sampling`. - `process_meteomatics_atmosphere` silently coerced any non-string model to "mix", hiding a mistake such as passing a Dataset or a path as `file` and querying the wrong model. It now accepts None (default) or a string, and raises otherwise. * ENH: Refactor Meteomatics integration into MeteomaticsFetcher class and clean up environment method * ENH: Decompose fetchers.py into rocketpy/environment/fetchers package with dedicated submodules * DOC: make the CustomSampler examples answer to their seed (#1097) Both examples build a generator with np.random.default_rng(seed) and drop it, then sample from the process-global np.random. reset_seed is a no-op, so a sampler written by following this page ignores random_seed. The study runs and the numbers look reasonable; only a second run with the same seed shows they were never reproducible. The bivariate generator needs two more things. It caches 1000 samples, so reset_seed has to discard them or the first 1000 draws after a reseed still come from the generator that was replaced. And its refill test compares samples_generated against used_samples, which only becomes true after the cache has run out, so a study longer than the cache silently got short lists: sample(n_samples=1) returns [] at simulation 1001 and dict_generator raises IndexError on [0]. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * CI: force software rendering to fix flaky VTK off-screen bus error (#1078) (#1084) Isolates the three VTK/PyVista off-screen animation tests into their own workflow step so a native crash in one of them no longer kills the whole integration run, adds a bounded retry for the crash, forces Mesa software rendering on Linux, and sets fail-fast: false so one platform no longer cancels the rest of the matrix. Closes #1078 * BUG: rocket with a late-starting thrust curve never leaves the rail (#411) (#1085) A motor whose thrust curve starts at t > 0 never left the rail: the rail phase's only time nodes were [t=0, max_time], so LSODA (max_step defaults to inf) took one huge step over the entire burn and the rocket never accelerated. __setup_phase_time_nodes now forces solver stops at ignition and burn-out when burn_start_time > 0, leaving ordinary motors byte-for-byte unchanged. Also moves Codecov's coverage config out of .github/workflows/codecov.yml (where Actions was trying to execute it as a workflow, failing on every run) to .codecov.yml. Closes #411 * BUG: fly the parachute the simulation sampled (#1098) StochasticRocket.create_object built a Parachute from the full sampled draw, then discarded it and built a second one from six of its ten fields. radius, height, porosity and drag_coefficient never reached the rocket: the second Parachute re-derived radius from cd_s and the default drag coefficient, and height fell back to that radius. Attaching the sampled object itself fixes it and stops Parachute.__init__ running twice per parachute per simulation. Breaking: radius and height feed the parachute added-mass term in flight.py, so descent dynamics and landing points change for any study whose parachute carries geometry. Closes #1094 * MNT: do not let one Python version cancel the other in the slow matrix (#1100) * MNT: do not let one Python version cancel the other in the slow matrix #1084 added fail-fast: false to the main test matrix while this was open, so the only half left is the slow one. Same reason: 3.10 failing says nothing about 3.14, so cancelling it costs a result and saves nothing worth having. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * MNT: retry the VTK tests on SIGSEGV, not only on macOS SIGBUS #1084 retries the animation tests when they die on 138, which is SIGBUS on macOS. Counting the last 40 Tests runs, the crash was 139 eight times and 138 twice, so the common case fell straight through the retry. Linux SIGBUS is 135 rather than 138, so that missed as well. Also sets fail-fast: false on the slow matrix, which #1084 left out. 3.10 failing says nothing about 3.14, so cancelling it costs a result and saves nothing worth having. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> --------- Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> * ENH: Add Qodo PR-Agent workflow using Google Gemini (#1089) * ENH: Add Qodo PR-Agent workflow using Google Gemini * FIX: point PR Agent workflow at the renamed action repo Codium-ai/pr-agent-action no longer exists (the project moved to the-pr-agent/pr-agent), which made the "Run PR Agent" check fail with "Unable to resolve action". Updates the action reference, grants the contents: write permission it now requires, and sets the Gemini key via the GOOGLE_AI_STUDIO.GEMINI_API_KEY env var per the new action's docs. * DOC: update changelog for PR #1089 * CI: build the docs for pull requests into develop as well (#1104) * CI: build the docs for pull requests into develop as well `branches` filters on a pull request's base, and almost every PR here is opened against develop: 25 of the last 30, with 3 against master. So the build that runs with -W --keep-going saw a docs change for the first time in a release batch, well away from whatever caused it. The path filter already keeps this off PRs that cannot affect the docs, and `rocketpy/**` is in it because docstrings feed the autodoc reference, so a docstring edit merged into develop could break the API pages unnoticed too. `push` is left on master alone. The pull request check is where the feedback is worth having, and running both would double the cost for a second opinion on the same commit. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * Apply suggestion from @Gui-FernandesBR --------- Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> * BUG: give each CustomSampler its own stream instead of the model's seed Every sampler on a model was reset with the model's seed, so two backed by default_rng started from identical state and drew identical underlying values. Not nearly identical, the same to every digit: two Gaussians with different means and spreads both produced the deviate 0.466220770577340. A study varying two parameters that way is varying one, and the correlation it reports between them is an artefact of the seeding. Each sampler now gets a child derived from the model's seed and the input's name. Keyed by name rather than position so declaring another parameter does not move the streams of the ones already there, and crc32 rather than hash because hash is not stable across processes. The documented wind X/Y wrappers are unaffected. Their correlation comes from sharing one samples_list, not from sharing a seed, so handing them separate children leaves it intact: measured 0.7010 against the covariance's 0.6981. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * BUG: make the sampler key collision-free and the shared case order-free Two problems with the first version of this, both found in review. CRC32 is 32 bits, and a collision puts two samplers back on one stream, which is the bug the keying exists to prevent. `wd4s4xka50` and `p56cjcee10` are both valid identifiers with CRC32 1560575156, and both derived the same seed. The name is length-prefixed into spawn-key words now, which no two names share, and the child is kept at its full 128 bits to match the Monte Carlo seeding rather than being cut to 64. Samplers can also share one generator on purpose, as the documented wind pair does, and each reset overwrites the last. With one seed per name, whichever was reset last decided the stream, so the same seed meant different runs depending on the order the model was declared in. Seeding is its own pass over sorted names now. The pass is separate from the validation loop deliberately. That loop's order sets __dict__, and so the order every other input is drawn in, so sorting it would have moved the samples of every model with a tuple in it. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * BUG: seed a shared generator once between its samplers, not once each Two wrappers can share one generator on purpose, as the documented wind pair do. One seed per name reset that generator once per wrapper, so every seed but the last was discarded and the group's stream was decided by whichever member sorted last. Adding a third wrapper to the same generator therefore moved the first two, which name keying is meant to prevent. CustomSampler gains a `seed_group` property, `self` by default, so a wrapper can say which generator it shares. Members of a group are seeded once between them, with the seed derived from all their names rather than from whichever went last. The documented wind wrappers declare it. Before, resetting six times for three wrappers and moving the pair when a third arrived. After, once, and adding an independent sampler leaves the group where it was. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * BUG: name the sampler when its generator refuses the seed Only RuntimeError was caught, and the seed handed over is now 128 bits, which the legacy numpy.random.RandomState refuses: ValueError: Seed must be between 0 and 2**32 - 1 Before this branch a sampler received the model's seed, usually a small int, so RandomState took it. A sampler built on RandomState therefore breaks here, and used to break with a bare ValueError that named nothing. The seed stays 128 bits, since that is what keeps the streams apart and what default_rng, the documented choice, takes. The error now says which input the sampler belongs to and keeps the original as its cause. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * MNT: reset the group itself, and stop the example filling a cache it discards Three things from review, all small. The documented bivariate generator filled a 1000-pair cache inside reset_seed. With per-index seeding that reset happens once per simulation, so a study built on this example generated a thousand pairs and used one, every time. 0.099 ms each, about 10 s over 100k simulations. `top_up` already fills the shortfall on first use, so the eager fill is gone and the cache starts empty. The group reset went through the first member rather than the group, which assumes every member resets identically and keeps nothing of its own. The group holds the shared state, so it is reset directly when it knows how, and the member is the fallback. `_sampler_seed` now sorts the names itself. The caller does today, and a future one that forgets would hand a single group two different seeds. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * DOC: say what owning a seed group means Two rules the property invites breaking, both silent. Identity has to be stable. Building the answer on each call, which returning from a property makes easy, gives every member a different identity and puts each back in a group of its own: a two-member group goes from one reset to two. A group belongs to one model. Declaring the same generator on two models has them both seed it, and the later one wins, which is the overwrite the grouping exists to prevent. The documented wind pair already returns a stored attribute, so the example teaches the stable form. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * DOC: add the changelog entry for this branch The automation that normally writes it cannot run on a pull request from a fork, which is #1101, so this one is by hand. It is a breaking change and the entry says so: fixed-seed CustomSampler baselines move, and a sampler built on the legacy RandomState has to move to default_rng because the seed it now receives is 128 bits wide. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * MNT: declare dependency floors the package can actually run on (#1108) `scipy>=1.0` is not true. `monte_carlo.py` imports `scipy.stats.bootstrap` at module level, and the SciPy 1.7.0 release notes are where that arrives, so anything from 1.0 to 1.6 satisfies the floor and then fails on `import rocketpy`. `numpy>=1.13` is not true either, and the binding constraint turned out to be a sibling rather than NumPy itself: `matplotlib>=3.9.0` requires `numpy>=1.23`. SciPy then has to be new enough to allow that, and 1.7.2 caps NumPy at `<1.23.0`, so 1.8 is the first that composes. Verified rather than reasoned. On Python 3.10 with numpy 1.23.0 and scipy 1.8.0 pinned and everything else current, `import rocketpy` works and `tests/unit/simulation` with `tests/unit/stochastic` is 162 passed, 5 skipped. At numpy 1.21.3, which is where NumPy's own cp310 wheels start, matplotlib refuses to import. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * BUG: accept the callable parachute triggers the docstring promises (#1103) * BUG: accept the callable parachute triggers the docstring promises The `or` sat inside the isinstance call rather than beside it: isinstance(member, (str, int, float) or callable(member)) A non-empty type tuple is truthy, so the expression short-circuited to the tuple and callable(member) was never evaluated. The check reduced to isinstance(member, (str, int, float)), and a callable is none of those. Parachute takes a callable trigger and Flight calls it, and the docstring three lines above says "a list of callables, string 'apogee' or ints/floats". Only the stochastic wrapper refused one. The two non-callable forms passed throughout, which is why the tests never caught it. Left as an assert to match the other fourteen in these two modules, and because raising a different type would break anyone catching AssertionError. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * BUG: refuse the trigger forms Parachute cannot use Moving the `or` let callables through, but left four things the check should never have accepted. `["banana"]` passed here and then `Parachute` raised ValueError, so the wrapper only moved the failure to create time. `[True]` is worse: bool is an int, so it went through as a height of one metre. `[]` passed because `all([])` is True. And `numbers.Real` replaces `(int, float)`, which took numpy.float64 because it subclasses float and refused numpy.int64 because it subclasses neither. The check is raised rather than asserted. `python -O` strips an assert outright, and this is the only thing between those triggers and a Parachute that either refuses them later or misreads them. Still an AssertionError, so nothing that catches it has to change. The docstring claimed a tuple form that was never implemented; it now describes what the code does. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * BUG: do not accept numpy integers the Parachute will refuse Widening the height check to numbers.Real was the same mistake as accepting "banana": Parachute checks isinstance(trigger, (int, float)), so numpy.float64 passes because it subclasses float and numpy.int64 raises ValueError because it subclasses neither. Letting them through here only moved the failure to create_object. Back to (int, float), matching that check rather than improving on it, and the test that asserted numpy.int64 was accepted now asserts both ends refuse it. The asymmetry is Parachute's rather than this wrapper's and is worth fixing there, where widening the check would not strand anything downstream. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * TST: use the state length Flight actually passes The trigger tests built a 14-element state. Flight passes 13: x y z vx vy vz e0 e1 e2 e3 wx wy wz. Only y[5] is read, so both worked, but the test is there to document the contract and was documenting it wrongly. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * DOC: add the changelog entry for this branch By hand, because the automation cannot run on a pull request from a fork (#1101). No documented API breaks, but the observable behaviour does: an invalid string, an empty list or a boolean trigger now fails during StochasticParachute validation rather than later in Parachute construction, or silently becoming a one-metre height trigger. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> --------- Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * ENH: Add simplified opening shock force estimation (#1092) * ENH: Add opening shock force estimation to Parachute class (#1050) Adds an opening_shock_coefficient parameter and a calculate_opening_shock_force method to estimate the peak transient force during parachute inflation, following the simplified model in Knacke's Parachute Recovery Systems Design Manual (1992, Section 5.5). Closes #161 Co-authored-by: ArthurJWH <167456467+ArthurJWH@users.noreply.github.com> * ENH: Moving opening shock force function to utilities * DOC: Updated the CHANGELOG * DOC: Removed cross-reference from previous Parachute method --------- Co-authored-by: Matanski <Matangrod@outlook.co.il> * DOC: add the changelog entries the fork-PR bug dropped #1104 and #1108 both came from a fork, so `Populate Changelog` failed on `RELEASE_TOKEN` being withheld and neither got an entry. #1101 tracks the workflow bug; these two lines are the entries it would have written. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Raise the sampler type check rather than asserting it Gui's point on the review. `python -O` strips an assert, and this is what keeps a non-sampler out of the model, so it has to be a raise. Same shape as #1103, which took the identical route for the parachute triggers. AssertionError is kept rather than swapped for TypeError, because the docstring on develop already documents it and a caller catching it should keep working. Two tests. One is the behaviour; the other runs a child interpreter under -O, since that is the mechanism and the plain test passes either way. Note this module carries thirteen more asserts on develop, none of them mine. Happy to send them separately if you want the same treatment there. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * Validation in stochastic/ that survives python -O (#1111) `stochastic_model.py` has carried this as a TODO: # TODO: Stop using assert in production code. Use exceptions instead. The reason it matters is that the optimiser removes them, so the checks stop running and malformed input reaches the model: StochasticModel(obj, mass=("not a number", 0.5)) python AssertionError python -O accepted, mass = ('not a number', 0.5, <Generator.normal>) That model then fails somewhere later with something that does not point back at the tuple that caused it. Twenty one of them, all in stochastic/: thirteen in stochastic_model.py, three each in stochastic_environment.py and stochastic_flight.py, one in stochastic_aero_surfaces.py, and the one in stochastic_parachute.py that #1103 did not reach. Converted mechanically through the AST, so the condition and the message are the ones that were there. AssertionError is kept rather than swapped for TypeError or ValueError. The docstrings document it, and callers catching it should keep working. Changing the type is a separate decision from making the check run at all. Two kinds of test. One reads each module and fails on a reintroduced `assert`, which is the mechanism. The other runs a child interpreter under -O, because in process the assert is still compiled in and the check would pass either way. Also moves two imports in test_custom_sampler.py to the top of the file, which pylint flags as C0415 on develop today. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * ENH: Support for Open-Meteo API in the `Environment` class (#1119) * ENH: add Open-Meteo API fetchers for forecast, history and ensemble Wraps the three Open-Meteo endpoints RocketPy needs to build atmospheric profiles: the forecast API, the historical-forecast API (for past launch dates) and the ensemble API. All of them serve pressure-level data as plain JSON over HTTPS, with no API key and no netCDF/OPeNDAP dependency. Note that Open-Meteo's ERA5 archive endpoint is deliberately not used: it serves surface variables only and answers with nulls at every pressure level, so the historical-forecast API (available from 2021 onwards) is the only archive that can feed a vertical profile. Ensemble models are restricted to the ones that actually publish pressure-level data (gfs05, ecmwf_ifs025, gem_global); the others return HTTP 200 with null values, which would otherwise surface as an opaque failure much later in the parsing step. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * ENH: support Open-Meteo atmospheric models in the Environment class Adds two new atmospheric model types to set_atmospheric_model: env.set_atmospheric_model("open_meteo") # best_match env.set_atmospheric_model("open_meteo", file="ecmwf_ifs025") env.set_atmospheric_model("open_meteo_ensemble", file="gfs05") Both build the usual pressure, temperature and wind profiles from Open-Meteo pressure-level data, so no external files and no netCDF/OPeNDAP libraries are involved. When the launch date is in the past, "open_meteo" transparently queries Open-Meteo's historical-forecast archive instead of the live forecast, which is what makes past-launch reconstruction work without downloading reanalysis files by hand. The ensemble processor stores every member, so select_ensemble_member() and plots.ensemble_member_comparison() work exactly as they do for GEFS. The unsuffixed control run is kept as member 0, matching the documented convention that member 0 is the unperturbed control. Open-Meteo reports wind as speed/direction rather than u/v components, so convert_wind_speed_direction_to_components is added to environment.tools; it converts the meteorological blows-from convention into RocketPy's East/North components. Temperatures are converted from Celsius to Kelvin and pressure levels from hPa to Pa. The model-type gates in the prints and plots classes were comparing capitalised literals ("Ensemble"), which never matched a lower-case type even though set_atmospheric_model documents the argument as case-insensitive. They now compare case-insensitively, so both the new Open-Meteo types and a lower-case "ensemble" report their time period and member count. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * TST: cover the Open-Meteo atmospheric models Adds 44 offline unit tests (tests/unit/environment/test_open_meteo.py) and 6 live integration tests marked slow. The unit tests patch the fetchers, so the whole module runs without network access: verified by re-running the suite with socket.connect blocked, where all 44 still pass. They cover the unit conversions (hPa to Pa, Celsius to Kelvin, speed/direction to u/v), the nearest-hour selection, skipping levels a model does not resolve, altitude sorting, the ensemble member layout with the control run as member 0, the endpoint routing for past versus future dates, error payload handling, and to_dict/from_dict round trips. The wind-component conversion is tested against the four cardinal directions and round-tripped through calculate_wind_heading, since getting that convention wrong would silently flip the wind by 180 degrees. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * FIX: drop gem_global from the usable Open-Meteo ensemble models Verifying the ensemble models against the live API showed gem_global cannot feed a RocketPy profile: it publishes temperature and geopotential height at pressure levels but no pressure-level winds at all (168/168 hours null for wind_speed and wind_direction at every level, at three different launch sites). The earlier check only probed temperature, which is why it looked usable. Accepting it meant "Open-Meteo returned fewer than two usable pressure levels" at profile-build time instead of an actionable message naming the model, so it is now rejected up front alongside gfs025, icon_global and bom_access_global_ensemble. gfs05 (31 members) and ecmwf_ifs025 (51 members) are the two that publish the full set; both member counts are confirmed against the API. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * DOC: document the Open-Meteo atmospheric models Adds docs/user/environment/1-atm-models/open_meteo.rst, covering the forecast, past-launch and ensemble workflows, the model tables, and the caveats worth knowing: coverage of pressure levels varies per model, the historical archive only reaches back to 2021, and Open-Meteo's ERA5 endpoint cannot be used because it serves no pressure-level data. Cross-references were added from the forecast, reanalysis and ensemble pages, since Open-Meteo is the lighter alternative in each of those cases -- notably for ensembles, where the GEFS shortcut is currently unavailable. Every code block in the new page runs as part of the docs build; all five were executed against the live API to confirm they work. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * ENH: warn when a launch date predates the Open-Meteo archive Open-Meteo answers historical requests for unsupported dates with HTTP 200 and null values at every pressure level, so a pre-archive launch date used to surface only as a generic "fewer than two usable pressure levels" error, with no hint that the date itself was the problem. Such dates now raise a warning naming the archive start and pointing at the reanalysis and sounding models. The cutoff was probed against the live API rather than assumed: 2021-03-15 comes back empty while 2021-03-23 is complete, so the archive starts in March 2021 and not in January as the previous constant implied. The constant is now a date instead of a year, and the docs state March 2021. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * MNT: satisfy pylint on the Open-Meteo code paths The CI lint job runs pylint, not just ruff, and flagged the new code: - process_open_meteo_atmosphere and process_open_meteo_ensemble exceeded the statement limit. Rather than suppress it, the profile-storing and member-stacking blocks were extracted into helpers, mirroring the existing _store_meteomatics_* pattern. The two processors now read as a sequence of named steps. - set_atmospheric_model exceeded the branch limit, since the two new model cases added to an already long match. The self-contained pressure_conversion_factor validation moved to a private validator next to the other validators, which also flattens its nested ifs. - Unused-argument and missing-docstring warnings in the new tests, from fakes that deliberately accept the real signature. Behaviour is unchanged: the pressure_conversion_factor error messages and the Open-Meteo profiles were re-verified against the original, and the full unit suite still passes (1954 passed, 16 skipped). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * DOC: update changelog for PR #1119 * MNT: the docker/ files still use the paths they had before the 2024 move (#1139) * docker: mount the repository root in compose, not the docker folder #732 moved docker-compose.yml into docker/. Compose resolves relative host paths against the compose file's own directory, so `- .:/app` mounts docker/, which has no pyproject.toml and no requirements-tests.txt for the services to install. * docker: raise the compose service to the python floor the package declares #857 moved requires-python to >=3.10; pip declines the install on 3.9. Renamed the service key so it does not outlive the version again. * docker: pin the base image to python:3.14 python:latest and python:3.14 are the same digest today, so the image does not change. 3.14 is the ceiling of the test matrix, and a pinned tag is one renovate can see and bump. * docs: describe the docker layout as it is after #732 The build command needs a repository-root context to find requirements.txt, compose runs from inside docker/, and the file tests 3.10 and 3.12 rather than 3.9 and 3.12. * Fix operating_temperature init values (#1118) Docstring states that the sensor default operating_temperature in K is assumed to be 25 C = 25+273.15 = 298.15 K. The initialization value, however, was set to "25" and never converted from C to K creating a contradiction. Set new operating_temperature init values to 298.15 across Sensor classes. * CI: make the Gemini PR reviewer actually review (#1140) The job has never posted a review. It passed the Gemini API key but never set a model, so PR-Agent kept its OpenAI defaults (`gpt-5.6`, falling back to `gpt-5.6-terra`) and every call failed with AuthenticationError - Incorrect API key provided: dummy_key PR-Agent swallows that error, so the run still went green and the failure was invisible. Setting `config.model` / `config.fallback_models` to Gemini models is the actual fix. Three other reasons it never worked: - `pull_request` gives no secrets to fork PRs, and most contributions are fork PRs (23 of the 27 currently open). Those runs sat in `action_required` (22 of the last 60) and would have had an empty key even once approved. `pull_request_target` is safe here because the job never checks the PR out. - `synchronize` is not in PR-Agent's `pr_actions`, so every push logged "Skipping action: synchronize" after a ~30 s image build - 38 of the last 60 runs were that no-op. - `issue_comment` runs the workflow from the default branch, and this file only exists on `develop`, so `/review` and `/ask` never fired once: all 74 recorded runs were `pull_request`. Also raise the token ceiling off the 32k default, since Gemini takes 1M and larger diffs were being truncated; leave the human-written PR description alone by turning `auto_describe` off; and drop the unused `contents: write`. The action ref moves from `@main` to a release tag. Note that this pins the action definition only: `Dockerfile.github_action_dockerhub` is a one-liner that pulls `pragent/pr-agent:github_action`, a floating tag, so the agent itself is still whatever that image currently holds. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * DOC: update changelog for PR #1140 * ENH: StochasticFreeFormFins for Monte Carlo simulations (#1117) * BUG: accept a deterministic aerodynamic surface in StochasticRocket `_add_surfaces` wrapped a plain surface with `stochastic_type(component=...)`, but none of the stochastic aero-surface classes take a `component` keyword: each names its first parameter after its own surface (`nosecone`, `tail`, `trapezoidal_fins`, ...). Passing anything other than an already-stochastic surface to `add_nose`, `add_trapezoidal_fins`, `add_elliptical_fins` or `add_tail` therefore raised a TypeError, even though all four document the deterministic type as accepted. Passed positionally instead, which reaches every class regardless of what it calls that parameter. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * ENH: StochasticFreeFormFins for Monte Carlo simulations Closes #953. Free-form fin sets were the only aerodynamic surface without a stochastic counterpart, so a rocket using them could not be varied in a Monte Carlo run. `shape_points` does not fit the one-number-per-input assumption the base class makes, and a fin shape is only meaningful as a complete set of points, so the outline is randomized as a block: one sampled deviation applied to every coordinate. Two formats needed handling before reaching the base class, both of them the natural thing to write: - a bare outline is a `list`, which the base class reads as a list of candidate values and would have sampled a single (x, y) point from. It is wrapped as the one candidate outline it is, and a list of outlines still means a choice between shapes. - `(nominal outline, standard deviation)` has a list where `_validate_tuple` requires a number. Only that first item is special-cased; the deviation and the distribution name still go through the base class, so the distribution is drawn from this model's generator like every other input. An outline that cannot mean a fin shape - empty, ragged, fewer than three points, three-dimensional - now fails during validation rather than reaching FreeFormFins. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * BUG: seed the choice between the candidate values of a list input `dict_generator` and `StochasticRocket._randomize_position` picked from a list with `random.choice`, which draws from the interpreter-wide stream. `_set_stochastic` only rebuilds the model's own numpy generator, so that stream was never reseeded: a fixed-seed run did not reproduce the values chosen from a list, and Monte Carlo workers forked from one process inherited a single `random` state and walked the same choice sequence instead of sampling independently. The choice now comes from a generator of the model's own, derived from the same seed through `_sampler_seed` but kept apart from the one the distributions draw from, so that declaring a list input does not shift the numbers every other input gets and existing fixed-seed baselines that use no list input stay where they are. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * MNT: let a stochastic input hold an array as its nominal value `StochasticFreeFormFins` needed a whole fin outline where the base class reads a single number, and got there by overriding `_validate_tuple`, comparing the input name against the literal `"shape_points"` and smuggling a `0.0` placeholder through `super()`. The rest of the machinery was never told, so `_validate_scalar`, `dict_generator` and `visualize_attributes` all still believed the value was a number: the public `visualize_attributes` raised a `TypeError` formatting an outline with `:.5f`, and the next array-valued input would have had to rediscover the same workaround. `array_valued_inputs` declares those inputs by name on the class instead, so validation, sampling and the report agree on which ones they are. `_nominal_value` converts them where the nominal value is looked up, and the report prints the array's shape rather than trying to format its coordinates as one number. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * BUG: fix which shape_points StochasticFreeFormFins accepts and rejects The `shape_points` contract did not hold up to the formats the docstring and the user guide advertise: - `_is_outline` caught only `IndexError`, but `np.shape` raises a `ValueError` on a ragged sequence. A list of candidate outlines with different numbers of points -- choosing between a three-point and a four-point fin, the plainest form of choosing between shapes -- died with an opaque numpy error, and a ragged outline did not fail during validation as claimed. Each candidate is now converted on its own. - Every distribution name was accepted, but the deviation is applied as `dist_func(nominal_outline, std_dev)`, so only the ones that read the first argument as the centre of the draw can work. `uniform` read the outline as its lower bound and `wald` rejected the zeros of a root point, both raising in the middle of a Monte Carlo run. The four that can are accepted and the rest are rejected up front. - An outline of non-numbers passed validation and died inside `_FreeFormGeometry.infer_dimensions`; a numpy array was rejected even though `create_object` produces one and `FreeFormFins` takes one; and `shape_points=[]` raised where an empty list means "use the nominal value" for every other input. The fin root is also held on the body line now. `FreeFormFins` measures the span from y = 0 and slices the chords over that interval, so perturbing every y drove most samples off the line -- 227 of 300 outlines had a point inside the airframe -- and the interference factors were computed from the inflated span that followed. Points nominally on the line stay there and none is allowed to cross it, which is what the root edge of a fin does anyway. The docstring and the user guide said a single outline "must be wrapped in a list" while the code auto-detects a bare one, and that one deviation is shared by every coordinate while each is in fact drawn on its own. Both now describe what the code does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * DOC: update changelog for PR #1117 * BUG: Restore UTC fallback without timezonefinder (#1143) * ENH: add tube-fin aerodynamic surface (#1144) * CI: keep per-matrix coverage artifacts and fail Codecov errors (#1088) (#1123) * CI: keep per-matrix coverage artifacts and fail Codecov errors (#1088) * CI: address review on the per-matrix coverage upload (#1088) The artifact renaming was the right diagnosis, but review turned up eight follow-ups: - fail_ci_if_error was unconditional, and forks get no secrets, so an external contributor would see red whenever the tokenless upload got rate limited. Tie it to the token, as #1088 prescribed. - overwrite: true was dropped. Artifacts are keyed by (run, name) and survive across attempts, so every leg of a re-run failed with 409 Conflict. The flaky VTK tests make re-runs routine. - needs: Pytest with no if: guard skipped CodecovUpload entirely when a single leg failed, sending Codecov nothing at all for the commit while .codecov.yml resolves that as an error. Run on !cancelled() and upload whatever legs did finish. - download-artifact exits 0 when pattern matches fewer artifacts than expected, so five of six reports looked like a clean run. Verify the count against the matrix size and refuse the silently-partial case. - Both .codecov.yml statuses were scoped to a `unit` flag that no upload has ever tagged, so the gate resolved over an empty flag set and measured nothing. The reports are unit + doctest + integration + acceptance combined, so drop the flag rather than mislabel them. - --cov-report=xml:<name> writes the per-leg filename directly, so the extra mv step goes away and if-no-files-found: error is reachable again instead of being masked by the mv failing first. - retention-days: 1, since artifacts per run went from 1 to 6 and CodecovUpload consumes them minutes later. - env: OS/PYTHON and .github/workflows/upload-to-codecov.yml were dead. The reusable workflow was called by nothing and was the only consumer of those two variables, while holding a second, diverging copy of the Codecov settings. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * BUG: seed parachute pressure noise with per-instance RNG (#1091) (#1134) * CI: run the changelog job for pull requests from forks (#1112) `Populate Changelog` fails for every pull request opened from a fork, and only those. GitHub withholds secrets from a `pull_request` run whose head is a fork, so `secrets.RELEASE_TOKEN` is empty and the checkout stops after a few seconds: ##[error]Input required and not supplied: token The effect is that no outside contribution gets a changelog entry. #1102, #1103 and #1108 all landed without one and had to be added by hand. `pull_request_target` receives secrets because it runs in the context of the base repository. That is also why it needs care, and why this belongs on master rather than develop: the workflow definition is read from the default branch, so a copy that only exists on develop would never be loaded. Nothing from the pull request is executed here. The checkout is `ref: develop`, the updater is inline in the workflow rather than a script from the tree, and the title and labels reach Python through the environment instead of the shell. `permissions` drops to `contents: read`. The job's writes go through RELEASE_TOKEN, which the checkout persists, so GITHUB_TOKEN does not need write and should not have it now that the trigger runs with secrets available. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * DOC: correct Flight aerodynamic moment units (#1149) * DOC: tighten the comments that came with the sampler seed groups (#1154) The prose added in #1102 restates itself across three places and narrates how each rule was arrived at. Keep the caller-visible rules, drop the retelling, and let a shared group's contract live on seed_group rather than being repeated at each call site. Comments only, no change to executable code. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * TST: use UTC for the HRRR forecast date (#1153) * BUG: report missing impact roots explicitly (#1147) (#1148) * TST: cover controller behavior and reporting (#1152) * TST: cover Function unit conversions (#1157) * TST: cover geospatial extent conversions (#1158) * MNT: let pylint use every core it is given (#1163) jobs=1 pins the run to one process. Measured on eight cores over rocketpy/, tests/ and docs/: 36.4s at jobs=1 against 14.0s at jobs=0, and the two produce the same messages, so the gate is unchanged and only the wait is shorter. 0 asks pylint to count the processors itself, which is what the comment above the setting already describes, and it caps the count on Windows on pylint's own side. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * BUG: stop dict_generator from sampling initial_solution (#1109) (#1122) Generate stochastic samples from declared constructor inputs only, and validate StochasticFlight.initial_solution on construct. * TST: cover attitude conversion helpers (#1159) * CI: measure coverage on develop, not only on pull requests (#1162) The tests workflow is the only one that uploads to Codecov and it runs on pull_request alone, so no commit on develop ever gets a report. Codecov then compares each pull request against the nearest older report it holds and prints how far behind that has fallen; the banner read 53 commits one day and 61 the next, and it grows with every merge. .codecov.yml already names master and develop under branches for both the project and the patch status, so the configuration expects these to be measured. docs.yml pairs pull_request with push the same way. Nothing in the jobs reads pull_request context, so the same matrix runs unchanged on a push. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * DOC: fix RST indentation in dict_generator notes The nested a./b. list was indented deeper than the body of item 1 with no blank line in between, which docutils reports as "Unexpected indentation". Since #1122 landed this broke `build-docs` for every pull request opened against develop, including PRs that do not touch this file. Aligns the sublist with the parent item's body, adds the required blank line, and drops the now-unneeded line continuations. * BUG: evaluate parachute triggers once per time node (#1086) (#1121) Remove the duplicate inline parachute loop in Flight.__simulate; keep only __check_and_handle_parachute_triggers. * ENH: Create ensembles from user-defined profiles (#1141) * ENH: create ensembles from user-defined profiles * MNT: split custom ensemble creation into helpers * TST: cover custom ensemble validation * BUG: skip scalar statistics for structured Monte Carlo results (#1145) (#1146) * BUG: apply wind factors to the ensemble member that was selected (#1160) select_ensemble_member() rebuilds the wind functions from the chosen member's own profile, and create_object() reached it after the factors because that is where __dict__ happened to put it. The factor was scaled into the previous member's wind and then thrown away, so the run flew the raw member wind while the input record still reported a factor. Factors are now applied once the loop is done, so the order of __dict__ stops mattering, and the baseline is the member just loaded rather than the value cached at construction. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * BUG: build Monte Carlo flights with the configuration they were given (#1164) __run_single_simulation writes the Flight constructor out by hand and stops at time_overshoot. StochasticFlight.create_object passes nine more: max_time, the two time steps, rtol, atol, name, equations_of_motion, ode_solver and simulation_mode. So a Monte Carlo run ignored the max time, the tolerances, the solver and the equations of motion the caller had set, and reset the simulation mode to the constructor default. The same rocket, environment and flight therefore flew differently under MonteCarlo than under StochasticFlight.create_object. #1070 added StochasticFlight's handling of these; this path never picked it up. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * DOC: document multivariable drag inputs (#1142) * TST: add Defiance example flight acceptance test (#1156) * TST: add Defiance example acceptance test * TST: cover Defiance peak and impact metrics * TST: allow cross-platform impact variation * BUG: serialize numpy SeedSequence for sensor seeds (#1087) (#1124) * BUG: serialize numpy SeedSequence for sensor seeds (#1087) * MNT: split rebuild_minimal_flight out of object_hook The SeedSequence branch pushed object_hook to 26 statements, one over pylint's max-statements, failing the Linters job. Extract the Flight rebuild into a module-level helper next to set_minimal_flight_attributes, matching how that path is already factored. Pure code move. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * TST: cover confidence ellipse helpers (#1165) * BUG: draw the eccentricities again, whichever way they were added (#1167) #1122 made dict_generator walk the inputs a model declared instead of every attribute on it, which is the right shape for #1109. add_cp_eccentricity and add_thrust_eccentricity run after __init__ has built that list, so their distributions stopped being drawn from: the value was set on the instance and every simulation used the same one, with nothing to say so. Bisected: at 3e16c9fc all four eccentricities appear in the generated dictionary, at 5a71eb93 none of them do. An add_* method now declares what it installed, with the argument as given rather than the validated form, so _set_stochastic validates it again on each reseed and binds the distribution to the generator that is live then. ensemble_member was already fine, since StochasticEnvironment passes it through the constructor and the hasattr guard covers it not being set yet. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * ENH: compute rocket static margin lazily (#780) (#1135) * ENH: compute rocket static margin lazily (#780) * MNT: satisfy ruff format on the lazy static margin changes Reformat the static margin source lambda. No behaviour change: the _csys factor stays inside the lambda body, applied to the result. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * BUG: write MonteCarlo input and output rows atomically (#1110) (#1125) * BUG: write MonteCarlo input and output rows atomically (#1110) * TST: fix pylint W1113 in MonteCarlo append rollback mock (#1110) * ENH: add Flight post-step callback across all phases (#758) (#1128) * ENH: model unbonded solid-motor grain CM shift (#340) (#1138) * ENH: model unbonded solid-motor grain CM shift (#340) * MNT: satisfy ruff format on the unbonded-grain changes Blank line before evaluate_geometry, wrap the propellant_I_11 assignment that ran past 88 columns, and let the expected_cm expression in the test break the way the formatter wants. No behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * BUG: refuse to run a Monte Carlo over a results file it cannot write (#1161) * BUG: refuse to run a Monte Carlo over a results file it cannot write import_outputs() accepts .csv and .json, points output_file at the file, and offers continuing a simulation from it. simulate() only writes JSONL, and __setup_files opens with w+ when append is False, so the imported file was truncated and then filled with records its own extension does not describe. Checked before any file is opened, and named per path so the message says which one has to change. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * DOC: stop offering CSV and JSON results as something to resume from The note under import_outputs said any previously saved file could be used to continue a simulation, which is what led a .csv into output_file in the first place. Say which format that holds for. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * BUG: refuse working logs that are one file, and options that split a row import_results points input_file, output_file and error_file at one path, and a run then appends input rows and output rows into it. Compared by inode once the files exist, so a symlink, a hard link, a/../run.txt and a case-insensitive filesystem are all the same file rather than three names. json.dumps kwargs reach the writer, so indent=2 wrote records across several lines while every reader here takes one line at a time. The run finished and the completeness check then called the file it had just written damaged. indent of 0 and "" do the same, as does a newline inside separators. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * TST: cover the branch a first run actually takes samefile needs both files to exist, and every case here wrote one first, so the resolved-path fallback that a run with no logs yet goes through was never exercised. Replacing it with False leaves the new test red. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> --------- Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * ENH: list NOAA atmosphere datasets and fetch latest (#660) (#1136) * ENH: list NOAA atmosphere datasets and fetch latest (#660) * MNT: satisfy ruff format on the NOAA catalog helpers Collapse the RuntimeError message and the test assertion the formatter wants on one line. No behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * DOC: add SIL parachute ejection integration example (#524) (#1131) * DOC: add SIL parachute ejection integration example (#524) * DOC: make the SIL mechanism table render as a table RST has no pipe-table syntax. A line starting with "|" is parsed as a line block, so the "Dual path: trigger vs controller callback" section rendered as a column of ragged lines with the pipes and the "---------" separator showing through, rather than as a table. Sphinx does not warn about this, which is why the docs job stayed green and it went unnoticed. Converted to a list-table, matching the two-column explanatory tables already used in docs/user/flight.rst (:header-rows: 1, :widths: 30 70). Verified by building the page with Sphinx 8.1.3 under -W --keep-going: the section now emits one <table class="docutils"> with a real header row, where before it emitted zero tables and one line-block. No new warnings. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: accept numpy integer types as Parachute trigger (#1116) * fix: accept numpy integer types as Parachute trigger isinstance(trigger, (int, float)) rejects numpy integer types (np.int64, np.int32) because they don't subclass Python's int or float. Replace with isinstance(trigger, numbers.Real) which covers all numeric types (int, float, numpy scalars) while excluding bool. Fixes #1106 * BUG: accept a NumPy integer height in stochastic/ as well This PR widened Parachute's height check from `(int, float)` to `numbers.Real`, so a height read out of a NumPy array is accepted. StochasticParachute validates the same triggers before a Parachute is ever built, and its copy of the check was still spelled `(int, float)`. A `numpy.int64` height was therefore still refused there, even though the Parachute it would have built accepts it. That mismatch is what turned all six Pytest legs red: `test_a_numpy_integer_is_refused_here_because_parachute_refuses_it` pinned the old asymmetry, and its own docstring said the fix belonged in Parachute. Rather than restate the predicate a second time, Parachute now exposes it as `_is_a_height_trigger` and stochastic/ calls that. The two spellings drifted apart once already; sharing one definition is what stops it happening again. Tests: - the NumPy integers move into `test_what_this_accepts_is_what_a_parachute_accepts`, where they now belong, joined by `numpy.float32` - the refusal test is rewritten around what is still refused by both: `numpy.bool_` and the complex types, none of which are `Real` - a new test asserts the agreement itself over the whole boundary, so changing one side alone fails with both verdicts printed - Parachute gains boundary tests of its own, including that `True` is still refused rather than read as a height of one metre Verified: reverting either side alone turns these red (the drift guard reports `np.float32(800.0): stochastic/ says False, Parachute says True`); ruff check and format clean; pylint 10.00/10; tests/unit 2098 passed, 16 skipped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: abhi-0203 <abhi-0203@users.noreply.github.com> Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * BUG: draw each declared eccentricity once per simulation (#1168) #1167 declared the eccentricities that add_cp_eccentricity and add_thrust_eccentricity install, so dict_generator draws them. _create_eccentricities then drew them a second time and overwrote the first value. The exported inputs matched the applied ones only because the second write wins, and the extra draw moved every component position create_object places after it. Read what has been drawn already, and draw only a half the caller left out, which is not a declared input and so never reaches dict_generator. The docstring correction is the explanation #1167 landed with, which named the wrong symptom: the value did vary between simulations, what a fixed seed failed to do was reproduce it. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> * ENH: support fixed-time parachute deployment triggers (#437) (#1133) Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * Fix spurious ValueError from floating-point roundoff at exact tank depletion (#1166) * Fix spurious ValueError from floating-point roundoff at exact tank depletion * MNT: make _compose_clipped a real drop-in for compose, and format Retargeted this PR from master to develop, which is where RocketPy takes contributions. That also clears most of the lint failure by itself: master's own README.md currently fails `ruff format --check`, so the job was red for a reason outside this diff. Merged develop in as well, since the branch was cut from the v1.13.0 tag. Two changes: - `ruff format` on the two touched files. Two `_compose_clipped(...)` call sites were over 88 columns and the new test needed the surrounding blank lines. - `_compose_clipped` now defers to `outer.compose(inner)` unless both sides are array-sourced. Clipping reads `x_array` / `y_array` and the domain bounds, which only exist for array sources, so a callable source raised `AttributeError: 'Function' object has no attribute 'x_array'` where plain `compose` had worked. `Function.compose` already handles that case with a lambda and performs no bounds check there, so there is no spurious error to absorb and nothing to clip. Uses the public `is_array_source()`, as motors/motor.py and environment/ already do. Tests: three parametrized cases pinning the deferral (array/callable, callable/array, callable/callable) and one that the array/array path still pulls in a value a roundoff below the domain. Removing the guard turns them red with the AttributeError above. I also checked the thing that worried me most about clipping, since `UllageBasedTank.liquid_height` has no bounds check of its own and previously depended on `compose` raising: a gross overfill is still refused. Measured on develop and on this branch, an ullage 1.5x the tank volume and an ullage of -0.5x both raise the same ValueError from Tank's own overfill/underfill checks, which fire independently of the composition. So the clipping really does only absorb boundary noise. Verified: tests/unit 2161 passed, 17 skipped; tests/unit/motors plus tests/integration/motors 116 passed; ruff check and format clean; pylint 10.00/10. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: x <x@y> Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * BUG: sample StochasticFlight inputs once per simulation (#1090) (#1126) * BUG: sample StochasticFlight inputs once per simulation (#1090) * MNT: satisfy ruff format on MonteCarlo.__sim_producer (#1090) --------- Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * DOC: backfill the Unreleased changelog entries the automation missed (#1180) * DOC: backfill the Unreleased changelog entries the automation missed The last commit to CHANGELOG.md is 5eae273b on 12 August, and the highest pull request it records is #1140. Thirty-nine commits have landed on develop since, and none of them is in the file, so [Unreleased] no longer describes the branch. Add the thirty-two that belong there, taken from the merge list and following the file's own rules: Added for new features, Changed for changes to existing behavior, Fixed for bug fixes, and tests left out. The seven TST commits in the gap are therefore not listed. Entries use the pull request title and link, with the issue linked alongside where the commit names one. One entry is a direct commit t…
1 parent 9bd6ad3 commit d703905

171 files changed

Lines changed: 21053 additions & 1168 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ coverage:
66
target: auto
77
threshold: 1%
88
base: auto
9-
flags:
10-
- unit
9+
# No `flags:` on purpose. This used to scope the status to a `unit` flag
10+
# that no upload has ever tagged, so Codecov resolved it over an empty
11+
# flag set and the gate measured nothing. The reports test_pytest.yaml
12+
# sends are unit + doctest + integration + acceptance combined, so there
13+
# is no honest flag to name here.
1114
paths:
1215
- "rocketpy"
1316
# advanced settings
@@ -29,7 +32,6 @@ coverage:
2932
- develop
3033
if_ci_failed: error # success, failure, error, ignore
3134
only_pulls: false
32-
flags:
33-
- "unit"
35+
# See the note on project.default above: no upload tags a `unit` flag.
3436
paths:
3537
- "rocketpy"

‎.github/pull_request_template.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- [ ] Docs have been reviewed and added / updated
1818
- [ ] Lint (`black rocketpy/ tests/`) has passed locally
1919
- [ ] All tests (`pytest tests -m slow --runslow`) have passed locally
20-
- [ ] `CHANGELOG.md` has been updated (if relevant)
20+
- `CHANGELOG.md` — no action needed; an LLM workflow auto-updates it after merge
2121

2222
## Current behavior
2323
<!-- Describe current behavior or link to an issue. -->
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
#!/usr/bin/env python3
2+
"""Self-contained tests for update_changelog.py.
3+
4+
Runs without network or the ``google-genai`` package (the LLM import in the
5+
script is lazy). Exercises the deterministic pieces that keep the changelog
6+
safe: section splitting, duplicate detection, prefix handling, the fallback
7+
classifier, and the validator that guards LLM output.
8+
9+
Run locally with either:
10+
python .github/scripts/test_update_changelog.py
11+
pytest .github/scripts/test_update_changelog.py
12+
"""
13+
14+
import os
15+
import sys
16+
17+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
18+
19+
import update_changelog as uc # noqa: E402
20+
21+
SAMPLE = """\
22+
# RocketPy Change Log
23+
24+
## [Unreleased] - yyyy-mm-dd
25+
26+
### Added
27+
28+
### Changed
29+
30+
### Fixed
31+
32+
## [v1.13.0] - 2026-07-21
33+
34+
### Added
35+
36+
- ENH: something old [#100](https://github.com/RocketPy-Team/RocketPy/pull/100)
37+
"""
38+
39+
40+
def test_split_roundtrips():
41+
before, block, after = uc.split_changelog(SAMPLE)
42+
assert before + block + after == SAMPLE
43+
assert block.startswith("## [Unreleased]")
44+
assert "## [v1.13.0]" not in block
45+
assert "## [v1.13.0]" in after
46+
47+
48+
def test_already_present():
49+
_, block, after = uc.split_changelog(SAMPLE)
50+
assert uc.already_present(after, 100) is True
51+
assert uc.already_present(block, 100) is False
52+
assert uc.already_present(block, 999) is False
53+
54+
55+
def test_detect_prefix():
56+
assert uc.detect_prefix("BUG: fix a thing") == "BUG"
57+
assert uc.detect_prefix("BUG/MNT: pre-release review fixes") == "BUG/MNT"
58+
assert uc.detect_prefix("Add a shiny feature") is None
59+
60+
61+
def test_no_double_prefix():
62+
# The historical bug: a title already carrying a prefix must not gain another.
63+
entry = uc.build_entry("BUG/MNT: pre-release fixes", 1074, "ENH", "BUG/MNT")
64+
assert entry.startswith("- BUG/MNT: pre-release fixes ")
65+
assert "ENH:" not in entry
66+
assert "[#1074](https://github.com/RocketPy-Team/RocketPy/pull/1074)" in entry
67+
68+
69+
def test_build_entry_adds_prefix_when_missing():
70+
entry = uc.build_entry("Add a shiny feature", 200, "ENH", None)
71+
assert entry.startswith("- ENH: Add a shiny feature ")
72+
73+
74+
def test_fallback_routing():
75+
# Bug label -> Fixed
76+
section, prefix, _ = uc.fallback_section_and_prefix("Fix crash", "Bug,Flight")
77+
assert section == "### Fixed" and prefix == "BUG"
78+
# Refactor label -> Changed
79+
section, _, _ = uc.fallback_section_and_prefix("Tidy internals", "Refactor")
80+
assert section == "### Changed"
81+
# Existing prefix wins the routing even without a matching label
82+
section, prefix, existing = uc.fallback_section_and_prefix("BUG: oops", "")
83+
assert section == "### Fixed" and existing == "BUG"
84+
# Default
85+
section, prefix, _ = uc.fallback_section_and_prefix("New capability", "Enhancement")
86+
assert section == "### Added" and prefix == "ENH"
87+
88+
89+
def test_fallback_update_inserts_once_under_right_section():
90+
_, block, _ = uc.split_changelog(SAMPLE)
91+
updated = uc.fallback_update(block, "BUG: fix a thing", 321, "Bug")
92+
assert updated.count("[#321]") == 1
93+
fixed = updated.split("### Fixed", 1)[1]
94+
assert "- BUG: fix a thing" in fixed
95+
# Not misplaced under Added.
96+
added = updated.split("### Added", 1)[1].split("### Changed", 1)[0]
97+
assert "[#321]" not in added
98+
99+
100+
def test_ensure_section_inserts_in_canonical_order():
101+
_, block, _ = uc.split_changelog(SAMPLE)
102+
# SAMPLE has Added/Changed/Fixed but no Removed subsection.
103+
lines = uc.ensure_section(block.splitlines(keepends=True), "### Removed")
104+
joined = "".join(lines)
105+
# Removed must sit after Changed and before Fixed.
106+
assert (
107+
joined.index("### Changed")
108+
< joined.index("### Removed")
109+
< joined.index("### Fixed")
110+
)
111+
112+
113+
def test_validator_accepts_good_output():
114+
_, block, _ = uc.split_changelog(SAMPLE)
115+
good = block.replace(
116+
"### Fixed\n",
117+
"### Fixed\n\n- BUG: fix it [#500](https://github.com/RocketPy-Team/RocketPy/pull/500)\n",
118+
)
119+
assert uc.validate_llm_block(block, good, 500) is None
120+
121+
122+
def test_validator_rejects_dropped_entry():
123+
old = block_with_entry()
124+
# New block loses the pre-existing entry.
125+
new = "## [Unreleased] - yyyy-mm-dd\n\n### Fixed\n\n- BUG: new [#500](https://github.com/RocketPy-Team/RocketPy/pull/500)\n\n"
126+
assert uc.validate_llm_block(old, new, 500) is not None
127+
128+
129+
def test_validator_rejects_missing_new_ref():
130+
_, block, _ = uc.split_changelog(SAMPLE)
131+
assert uc.validate_llm_block(block, block, 500) is not None # no new ref at all
132+
133+
134+
def test_validator_rejects_leaked_version_header():
135+
_, block, _ = uc.split_changelog(SAMPLE)
136+
leaked = (
137+
"## [Unreleased] - yyyy-mm-dd\n\n### Fixed\n\n"
138+
"- BUG: x [#500](https://github.com/RocketPy-Team/RocketPy/pull/500)\n\n"
139+
"## [v1.13.0] - 2026-07-21\n"
140+
)
141+
assert uc.validate_llm_block(block, leaked, 500) is not None
142+
143+
144+
def test_validator_rejects_runaway_growth():
145+
_, block, _ = uc.split_changelog(SAMPLE)
146+
huge = (
147+
"## [Unreleased] - yyyy-mm-dd\n\n### Fixed\n\n"
148+
"- BUG: x [#500](https://github.com/RocketPy-Team/RocketPy/pull/500)\n"
149+
+ ("x" * (uc.MAX_BLOCK_GROWTH + 50))
150+
)
151+
assert uc.validate_llm_block(block, huge, 500) is not None
152+
153+
154+
def block_with_entry():
155+
return (
156+
"## [Unreleased] - yyyy-mm-dd\n\n### Added\n\n"
157+
"- ENH: keep me [#200](https://github.com/RocketPy-Team/RocketPy/pull/200)\n\n"
158+
"### Fixed\n\n"
159+
)
160+
161+
162+
def _run_all():
163+
tests = [
164+
v for k, v in sorted(globals().items()) if k.startswith("test_") and callable(v)
165+
]
166+
failures = 0
167+
for test in tests:
168+
try:
169+
test()
170+
print(f" ok {test.__name__}")
171+
except AssertionError as exc:
172+
failures += 1
173+
print(f" FAIL {test.__name__}: {exc}")
174+
print(f"\n{len(tests) - failures}/{len(tests)} passed")
175+
return 1 if failures else 0
176+
177+
178+
if __name__ == "__main__":
179+
sys.exit(_run_all())

0 commit comments

Comments
 (0)