Repository navigation
ENH: run the official RocketPy example designs unchanged - #77
Draft
aasitvora99 wants to merge 2 commits into
Draft
aasitvora99 wants to merge 2 commits into
aasitvora99 wants to merge 2 commits into
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… ValueErrors, malformed ids; accept motorless rockets
Replaying the Oct 2026 production P0s against a local instance showed four
opaque 500s and a non-standard 422 body:
- GENERIC motors with chamber_radius/height/position or
propellant_initial_mass = None constructed fine and crashed on first use
(Function(None) in center_of_propellant_mass). MotorService now raises
422 "Generic motor requires: a, b" naming every missing field.
- RocketPy ValueErrors (overfilled tank, etc.) were wrapped as 500; the
controller handler now maps them to 422 with the message.
- ObjectId("undefined") raised InvalidId -> 500; find_by_id returns None
(404 upstream), update/delete raise 404.
- The RequestValidationError handler returned a bare string; it now returns
FastAPI's standard {"detail": [{loc, msg, type}]}.
RocketModel.motor is now Optional: a rocket saved before its motor exists
keeps rocketpy's EmptyMotor (draws fine); rocket/flight simulate answer 422
"Rocket has no motor yet" via RocketService.require_motor().
Tests: 199 passing (18 new).
aasitvora99
force-pushed
the
fix/generic-motor-guards-and-structured-errors
branch
from
October 18, 2026 15:45
87dd5b3 to
1ea89c6
Compare
aasitvora99
force-pushed
the
fix/rocketpy-example-fidelity
branch
from
October 18, 2026 15:46
1b7ede7 to
5a37cf6
Compare
aasitvora99
force-pushed
the
fix/generic-motor-guards-and-structured-errors
branch
from
October 18, 2026 15:51
1ea89c6 to
fce4a21
Compare
…ertia, float flight times, list drag curves) Pushing the 17 RocketPy example notebooks through the API as a regression corpus showed three API-boundary blockers that rocketpy itself does not have: - dry_inertia == (0, 0, 0) was rejected for SOLID/LIQUID/HYBRID. rocketpy accepts zeros (12 of the 17 official examples pass exactly (0, 0, 0), usually with dry_mass=0). Validator removed. - FlightModel.max_time / min_time_step were typed int; rocketpy.Flight takes floats (lince uses max_time=399.35159). - Inline drag lists went through Function(list) with the default spline interpolation; duplicate Mach rows (five of the example drag CSVs) made the spline solve NaN and the rocket was rejected with "Invalid list/tuple format". The rocket service now builds drag curves the way rocketpy's CSV loader does: linear interpolation, constant extrapolation, duplicate Mach rows collapsed (first kept). With these, 14 of 17 example designs run end to end through /motors, /rockets and /flights; the remaining three are upstream rocketpy 1.12.1 issues (hybrid tanks draining to exactly 0 kg; astra rail-button NaN). Tests: 7 new.
aasitvora99
force-pushed
the
fix/rocketpy-example-fidelity
branch
from
October 18, 2026 15:51
5a37cf6 to
1faed1a
Compare
aasitvora99
marked this pull request as draft
October 18, 2026 16:11
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.
Stacked on #76 (base branch is
fix/generic-motor-guards-and-structured-errors); retarget tomasteronce #76 merges.Why
Pushing the 17 official RocketPy example notebooks through the API as a regression corpus showed three API-boundary rejections that rocketpy itself does not make. None of these caused the October incidents; they matter because the examples are the natural regression suite for this API, and today 12 of 17 are refused at
POST /motors/,/rockets/and/flights/.Changes
dry_inertia == (0, 0, 0)accepted for every motor kind. rocketpy's SolidMotor/LiquidMotor/HybridMotor takedry_inertiaas a required argument but accept zeros; 12 of the 17 examples pass exactly(0, 0, 0), usually withdry_mass=0. Thevalidate_dry_inertia_for_kindguard is removed.FlightModel.max_time/min_time_stepare floats. rocketpy takes floats; the lince example usesmax_time=399.35159and got "Input should be a valid integer".Rocket.__load_rocket_drag_csv(linear interpolation, constant extrapolation, duplicate Mach rows tolerated). The wire format forces an inline list, which rocketpy routes throughFunction(list)with the default spline interpolation; duplicate Mach rows (astra, cavour, erebus, hedy, SEB) make the spline solve NaN and the rocket is rejected with "Invalid list/tuple format".RocketService._drag_curve_functionnow sorts by Mach, keeps the first of any duplicate, and builds theFunctionwith the CSV loader's settings.Verification
pytest tests/unit: all passing (7 new tests: zero inertia builds a SolidMotor; float flight fields; drag dedup/sort/interpolation; a rocket with duplicate Mach rows constructs and evaluates).tank.pyhas no tolerance; Astramax_rail_button1_normal_forcespline NaN), all reproducible with plain rocketpy and the notebook's own numbers.