Skip to content

Commit 525fa96

Browse files
MNT: address third round of PR review comments
- Guard from_rpy against non-dict JSON payloads (e.g. [] or "foo") that would AttributeError instead of hitting the 422 path - Change notebook to resimulate=True so flight.all_info() has computed outputs available after loading an .rpy with include_outputs=False Made-with: Cursor
1 parent 5eb763f commit 525fa96

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/services/flight.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ def from_rpy(cls, content: bytes) -> Self:
9191
or does not contain a Flight.
9292
"""
9393
data = json.loads(content)
94+
if not isinstance(data, dict):
95+
raise ValueError("File does not contain a valid .rpy JSON object")
9496
simulation = data.get("simulation", data)
9597
flight = json.loads(
9698
json.dumps(simulation),
@@ -535,7 +537,7 @@ def generate_notebook(flight_id: str) -> dict:
535537
"source": [
536538
"flight = load_from_rpy("
537539
f'"{rpy_filename}", '
538-
"resimulate=False)\n",
540+
"resimulate=True)\n",
539541
"\n",
540542
"flight.all_info()",
541543
],

0 commit comments

Comments
 (0)