From 82ea8bb906b179917c6bfdccfbc5f77b7b0e35f2 Mon Sep 17 00:00:00 2001 From: Aasit Vora Date: Sat, 11 Oct 2025 16:42:56 +0530 Subject: [PATCH 01/12] MNT: updating objects with null initialization on edit --- src/repositories/flight.py | 2 +- src/repositories/motor.py | 2 +- src/repositories/rocket.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/repositories/flight.py b/src/repositories/flight.py index 0df540c..a9587da 100644 --- a/src/repositories/flight.py +++ b/src/repositories/flight.py @@ -28,7 +28,7 @@ async def read_flight_by_id(self, flight_id: str) -> Optional[FlightModel]: @repository_exception_handler async def update_flight_by_id(self, flight_id: str, flight: FlightModel): await self.update_by_id( - flight.model_dump(exclude_none=True), data_id=flight_id + flight.model_dump(exclude_none=False), data_id=flight_id ) @repository_exception_handler diff --git a/src/repositories/motor.py b/src/repositories/motor.py index 52c016b..023b31f 100644 --- a/src/repositories/motor.py +++ b/src/repositories/motor.py @@ -28,7 +28,7 @@ async def read_motor_by_id(self, motor_id: str) -> Optional[MotorModel]: @repository_exception_handler async def update_motor_by_id(self, motor_id: str, motor: MotorModel): await self.update_by_id( - motor.model_dump(exclude_none=True), data_id=motor_id + motor.model_dump(exclude_none=False), data_id=motor_id ) @repository_exception_handler diff --git a/src/repositories/rocket.py b/src/repositories/rocket.py index a3849d7..1c72959 100644 --- a/src/repositories/rocket.py +++ b/src/repositories/rocket.py @@ -28,7 +28,7 @@ async def read_rocket_by_id(self, rocket_id: str) -> Optional[RocketModel]: @repository_exception_handler async def update_rocket_by_id(self, rocket_id: str, rocket: RocketModel): await self.update_by_id( - rocket.model_dump(exclude_none=True), data_id=rocket_id + rocket.model_dump(exclude_none=False), data_id=rocket_id ) @repository_exception_handler From 44a2ebc9ce1fd09ca87ba36e8eadb9a1bca135f5 Mon Sep 17 00:00:00 2001 From: Aasit Vora Date: Sat, 11 Oct 2025 17:25:59 +0530 Subject: [PATCH 02/12] BUG: fix handling of corrupted Flight object in InfinityEncoder --- src/utils.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/utils.py b/src/utils.py index c964e3f..6b76c43 100644 --- a/src/utils.py +++ b/src/utils.py @@ -73,8 +73,30 @@ def default(self, o): mutate_self=False, ) if isinstance(obj, Flight): - obj._Flight__evaluate_post_process() - solution = np.array(obj.solution) + try: + evaluate_post_process = getattr(obj, '_Flight__evaluate_post_process', None) + + # Check if it's corrupted (numpy array instead of cached_property) + if isinstance(evaluate_post_process, np.ndarray): + try: + delattr(obj, '_Flight__evaluate_post_process') + + restored_method = getattr(obj, '_Flight__evaluate_post_process', None) + if restored_method and callable(restored_method): + restored_method() + except Exception as fix_error: + logger.error(f"Error fixing _Flight__evaluate_post_process: {fix_error}") + + elif evaluate_post_process is not None and callable(evaluate_post_process): + evaluate_post_process() + + except (AttributeError, TypeError, ValueError) as e: + logger.error(f"Error handling Flight object corruption: {e}") + + try: + solution = np.array(obj.solution) + except Exception as e: + return super().default(obj) # Fall back to parent encoder size = len(solution) if size > 25: reduction_factor = size // 25 From 8cbd9393612c14fd3054bee628100b138c556900 Mon Sep 17 00:00:00 2001 From: Gabriel Barberini Date: Sat, 11 Oct 2025 16:27:41 +0200 Subject: [PATCH 03/12] Update src/utils.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/utils.py | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/utils.py b/src/utils.py index 6b76c43..6dae46c 100644 --- a/src/utils.py +++ b/src/utils.py @@ -73,26 +73,30 @@ def default(self, o): mutate_self=False, ) if isinstance(obj, Flight): - try: + if isinstance(obj, Flight): + try: +- evaluate_post_process = getattr(obj, '_Flight__evaluate_post_process', None) evaluate_post_process = getattr(obj, '_Flight__evaluate_post_process', None) - - # Check if it's corrupted (numpy array instead of cached_property) - if isinstance(evaluate_post_process, np.ndarray): - try: - delattr(obj, '_Flight__evaluate_post_process') - - restored_method = getattr(obj, '_Flight__evaluate_post_process', None) - if restored_method and callable(restored_method): - restored_method() - except Exception as fix_error: - logger.error(f"Error fixing _Flight__evaluate_post_process: {fix_error}") + + # Check if it's corrupted (numpy array instead of cached_property) + if isinstance(evaluate_post_process, np.ndarray): + try: + delattr(obj, '_Flight__evaluate_post_process') - elif evaluate_post_process is not None and callable(evaluate_post_process): - evaluate_post_process() - - except (AttributeError, TypeError, ValueError) as e: - logger.error(f"Error handling Flight object corruption: {e}") - + restored_method = getattr(obj, '_Flight__evaluate_post_process', None) + if restored_method and callable(restored_method): + restored_method() +- except Exception as fix_error: +- logger.error(f"Error fixing _Flight__evaluate_post_process: {fix_error}") + except (AttributeError, TypeError) as fix_error: + logger.exception("Error fixing _Flight__evaluate_post_process") + + elif evaluate_post_process is not None and callable(evaluate_post_process): + evaluate_post_process() + + except (AttributeError, TypeError, ValueError) as e: +- logger.error(f"Error handling Flight object corruption: {e}") + logger.exception("Error handling Flight object corruption") try: solution = np.array(obj.solution) except Exception as e: From 9114d81ef20190bc25081c1f4a2612c3b2b9e369 Mon Sep 17 00:00:00 2001 From: Gabriel Barberini Date: Sat, 11 Oct 2025 16:28:05 +0200 Subject: [PATCH 04/12] Update src/utils.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index 6dae46c..7b5a837 100644 --- a/src/utils.py +++ b/src/utils.py @@ -99,7 +99,7 @@ def default(self, o): logger.exception("Error handling Flight object corruption") try: solution = np.array(obj.solution) - except Exception as e: + except (AttributeError, TypeError, ValueError): return super().default(obj) # Fall back to parent encoder size = len(solution) if size > 25: From cbefff8921654ad5af881cf870cc8f6d7ff43711 Mon Sep 17 00:00:00 2001 From: Gabriel Barberini Date: Sat, 11 Oct 2025 16:34:47 +0200 Subject: [PATCH 05/12] Update src/utils.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index 7b5a837..01ce5c9 100644 --- a/src/utils.py +++ b/src/utils.py @@ -73,7 +73,8 @@ def default(self, o): mutate_self=False, ) if isinstance(obj, Flight): - if isinstance(obj, Flight): + if isinstance(obj, Flight): + try: try: - evaluate_post_process = getattr(obj, '_Flight__evaluate_post_process', None) evaluate_post_process = getattr(obj, '_Flight__evaluate_post_process', None) From b721e28f56011b7a14adae38c7c4bbfc17146e6a Mon Sep 17 00:00:00 2001 From: Gabriel Barberini Date: Sat, 11 Oct 2025 16:36:16 +0200 Subject: [PATCH 06/12] Update src/utils.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils.py b/src/utils.py index 01ce5c9..ca4ca5a 100644 --- a/src/utils.py +++ b/src/utils.py @@ -95,9 +95,8 @@ def default(self, o): elif evaluate_post_process is not None and callable(evaluate_post_process): evaluate_post_process() - except (AttributeError, TypeError, ValueError) as e: -- logger.error(f"Error handling Flight object corruption: {e}") - logger.exception("Error handling Flight object corruption") + except (AttributeError, TypeError, ValueError): + logger.exception("Error handling Flight object corruption") try: solution = np.array(obj.solution) except (AttributeError, TypeError, ValueError): From 2f36252180ffa917d1cb7ed1be7e494b76fa2e5a Mon Sep 17 00:00:00 2001 From: Aasit Vora Date: Sat, 11 Oct 2025 20:30:01 +0530 Subject: [PATCH 07/12] Revert "BUG: fix handling of corrupted Flight object in InfinityEncoder" This reverts commit 44a2ebc9ce1fd09ca87ba36e8eadb9a1bca135f5. --- src/utils.py | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/utils.py b/src/utils.py index 6b76c43..c964e3f 100644 --- a/src/utils.py +++ b/src/utils.py @@ -73,30 +73,8 @@ def default(self, o): mutate_self=False, ) if isinstance(obj, Flight): - try: - evaluate_post_process = getattr(obj, '_Flight__evaluate_post_process', None) - - # Check if it's corrupted (numpy array instead of cached_property) - if isinstance(evaluate_post_process, np.ndarray): - try: - delattr(obj, '_Flight__evaluate_post_process') - - restored_method = getattr(obj, '_Flight__evaluate_post_process', None) - if restored_method and callable(restored_method): - restored_method() - except Exception as fix_error: - logger.error(f"Error fixing _Flight__evaluate_post_process: {fix_error}") - - elif evaluate_post_process is not None and callable(evaluate_post_process): - evaluate_post_process() - - except (AttributeError, TypeError, ValueError) as e: - logger.error(f"Error handling Flight object corruption: {e}") - - try: - solution = np.array(obj.solution) - except Exception as e: - return super().default(obj) # Fall back to parent encoder + obj._Flight__evaluate_post_process() + solution = np.array(obj.solution) size = len(solution) if size > 25: reduction_factor = size // 25 From 597aad049d52b0d1d75d481fb01b0e5a30385cb6 Mon Sep 17 00:00:00 2001 From: Aasit Vora Date: Sat, 11 Oct 2025 20:50:38 +0530 Subject: [PATCH 08/12] BUG: fix method call for post-processing in InfinityEncoder --- src/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index c964e3f..134a7ea 100644 --- a/src/utils.py +++ b/src/utils.py @@ -73,7 +73,7 @@ def default(self, o): mutate_self=False, ) if isinstance(obj, Flight): - obj._Flight__evaluate_post_process() + obj._Flight__evaluate_post_process solution = np.array(obj.solution) size = len(solution) if size > 25: From 028668167c9f0e41b8638e8671791a14daeb6477 Mon Sep 17 00:00:00 2001 From: Aasit Vora Date: Sat, 11 Oct 2025 20:59:05 +0530 Subject: [PATCH 09/12] REV: undoing changes --- src/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils.py b/src/utils.py index 134a7ea..e028736 100644 --- a/src/utils.py +++ b/src/utils.py @@ -54,8 +54,10 @@ def for_flight(cls) -> 'DiscretizeConfig': class InfinityEncoder(RocketPyEncoder): - def default(self, o): - obj = o + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def default(self, obj): if ( isinstance(obj, Function) and not callable(obj.source) From 476f88bc176bae2530da470a1458ec54c04f5383 Mon Sep 17 00:00:00 2001 From: Aasit Vora Date: Sat, 11 Oct 2025 23:57:52 +0530 Subject: [PATCH 10/12] chore: type correction --- src/views/environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/environment.py b/src/views/environment.py index 5147d35..a04603f 100644 --- a/src/views/environment.py +++ b/src/views/environment.py @@ -43,7 +43,7 @@ class EnvironmentSimulation(ApiBaseView): initial_east: Optional[float] = None initial_hemisphere: Optional[str] = None initial_ew: Optional[str] = None - max_expected_height: Optional[int] = None + max_expected_height: Optional[float] = None date: Optional[datetime] = Field(default_factory=_default_future_datetime) local_date: Optional[datetime] = Field( default_factory=_default_future_datetime From 82d55e66c2487fe9b4fb36d99feee9baa6e1b5ad Mon Sep 17 00:00:00 2001 From: Aasit Vora Date: Sat, 25 Oct 2025 19:25:41 +0530 Subject: [PATCH 11/12] chore: updating branch of rocketpy to dev --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 336559c..bd8495f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ pymongo jsonpickle gunicorn uvicorn -rocketpy +git+https://github.com/RocketPy-Team/RocketPy.git@develop uptrace opentelemetry.instrumentation.fastapi opentelemetry.instrumentation.requests From 7c4be89e6065c1ef90ff677691c48f534627847a Mon Sep 17 00:00:00 2001 From: Aasit Vora Date: Sat, 25 Oct 2025 19:28:09 +0530 Subject: [PATCH 12/12] fix: update model_dump to exclude None values in update_flight_by_id method --- src/repositories/flight.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repositories/flight.py b/src/repositories/flight.py index a9587da..0df540c 100644 --- a/src/repositories/flight.py +++ b/src/repositories/flight.py @@ -28,7 +28,7 @@ async def read_flight_by_id(self, flight_id: str) -> Optional[FlightModel]: @repository_exception_handler async def update_flight_by_id(self, flight_id: str, flight: FlightModel): await self.update_by_id( - flight.model_dump(exclude_none=False), data_id=flight_id + flight.model_dump(exclude_none=True), data_id=flight_id ) @repository_exception_handler