Skip to content

Conversation

@aasitvora99
Copy link
Contributor

@aasitvora99 aasitvora99 commented Oct 11, 2025

Some fields from encoding was causing issues in the _Flight__evaluate_post_process() method. Made a small hotfix for now to remove the bad actors that could not be converted.

2025-10-11 12:01:15,663 - ERROR - get_flight_simulation: Unexpected error 'numpy.ndarray' object is not callable
Traceback (most recent call last):
  File "/Users/aasitvora/Desktop/chintu/Infinity-API/src/controllers/interface.py", line 16, in wrapper
    return await method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/aasitvora/Desktop/chintu/Infinity-API/src/controllers/flight.py", line 108, in get_flight_simulation
    return flight_service.get_flight_simulation()
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/aasitvora/Desktop/chintu/Infinity-API/src/services/flight.py", line 61, in get_flight_simulation
    encoded_attributes = collect_attributes(
        self.flight,
    ...<5 lines>...
        ],
    )
  File "/Users/aasitvora/Desktop/chintu/Infinity-API/src/utils.py", line 121, in collect_attributes
    attributes = rocketpy_encoder(obj)
  File "/Users/aasitvora/Desktop/chintu/Infinity-API/src/utils.py", line 105, in rocketpy_encoder
    json_str = json.dumps(
        obj,
    ...<4 lines>...
        allow_pickle=False,
    )
  File "/usr/local/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ~~~~~~^^^^^
  File "/usr/local/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/encoder.py", line 261, in iterencode
    return _iterencode(o, 0)
  File "/Users/aasitvora/Desktop/chintu/Infinity-API/src/utils.py", line 76, in default
    obj._Flight__evaluate_post_process()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
TypeError: 'numpy.ndarray' object is not callable

Summary by CodeRabbit

  • New Features

    • Maximum expected height field now accepts decimal precision values for improved accuracy.
  • Bug Fixes

    • Improved data update operations to properly preserve and include null field values in payloads.

@aasitvora99 aasitvora99 self-assigned this Oct 11, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 11, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

The changes encompass parameter handling adjustments in repository update methods, variable naming consistency in a JSON encoder utility, a type annotation refinement for environment simulation properties, and a dependency source migration to use a Git-based RocketPy repository instead of PyPI.

Changes

Cohort / File(s) Summary
Repository update methods
src/repositories/motor.py, src/repositories/rocket.py
Changed exclude_none parameter from True to False in update_motor_by_id and update_rocket_by_id methods, resulting in None-valued fields being included in update payloads
JSON encoder utility
src/utils.py
Replaced local variable obj with function argument o throughout InfinityEncoder.default method for consistent parameter usage; updated Flight handling to use safe attribute access pattern; adjusted solution and metadata references accordingly
Environment view model
src/views/environment.py
Updated max_expected_height field type annotation from Optional[int] to Optional[float] in EnvironmentSimulation model
Dependency management
requirements.txt
Migrated rocketpy dependency source from PyPI to Git repository: git+https://github.com/RocketPy-Team/RocketPy.git@develop

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify that the exclude_none=False change in repository methods maintains backward compatibility with existing update operations and doesn't introduce unexpected None-valued fields into the database
  • Confirm the safe attribute access pattern (try-except) in InfinityEncoder.default doesn't silently mask errors for Flight post-processing
  • Test that the type change from Optional[int] to Optional[float] for max_expected_height doesn't break validation or downstream height-based calculations
  • Validate the Git-based RocketPy dependency resolves correctly and doesn't introduce version conflicts

Suggested reviewers

  • phmbressan
  • Gui-FernandesBR
  • luimot

Poem

🐰 With carrots and git branches in hand,
We hop through the code, so perfectly planned,
None-values now dance where they're told,
Float heights and safe catches—our story unfolds!
RocketPy soars from the develop abyss,
Each change so precise, we cannot miss! 🚀

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "BUG: issues with encoding and null field updates" is directly related to the main changes in the pull request. The utils.py changes fix an encoding issue in the InfinityEncoder class that was causing errors with numpy objects, which aligns with "issues with encoding." The changes to motor.py and rocket.py modify the exclude_none behavior, which directly relates to "null field updates." While there are secondary changes (environment.py type annotation and requirements.txt dependency update), the title appropriately focuses on the primary fixes and would be reasonably understood by a teammate reviewing the commit history.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/simulate-forward-fixes

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (2)
src/repositories/motor.py (1)

29-32: Same concern as in flight.py: verify None-value handling.

This change mirrors the one in src/repositories/flight.py. Ensure that including None-valued fields in the update payload aligns with the intended update semantics and doesn't cause unintended data overwrites.

src/repositories/rocket.py (1)

29-32: Same concern as in flight.py: verify None-value handling.

This change mirrors the one in src/repositories/flight.py. Ensure that including None-valued fields in the update payload aligns with the intended update semantics and doesn't cause unintended data overwrites.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 971f7ac and 44a2ebc.

📒 Files selected for processing (4)
  • src/repositories/flight.py (1 hunks)
  • src/repositories/motor.py (1 hunks)
  • src/repositories/rocket.py (1 hunks)
  • src/utils.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
src/repositories/rocket.py (6)
src/models/rocket.py (3)
  • UPDATED (41-42)
  • RocketModel (13-63)
  • DELETED (45-46)
src/routes/rocket.py (1)
  • update_rocket (56-68)
tests/unit/test_routes/test_rockets_route.py (1)
  • test_update_rocket (357-365)
src/controllers/flight.py (1)
  • update_rocket_by_flight_id (47-66)
src/routes/flight.py (1)
  • update_flight_rocket (140-155)
tests/unit/test_routes/test_flights_route.py (1)
  • test_update_rocket_by_flight_id (190-199)
src/repositories/flight.py (3)
src/routes/flight.py (1)
  • update_flight (58-70)
tests/unit/test_routes/test_flights_route.py (5)
  • test_update_flight_invalid_input (212-216)
  • test_update_environment_by_flight_id (176-187)
  • test_update_flight_by_id (166-173)
  • test_update_rocket_by_flight_id (190-199)
  • test_update_flight_not_found (219-225)
src/controllers/flight.py (2)
  • update_rocket_by_flight_id (47-66)
  • update_environment_by_flight_id (25-44)
src/repositories/motor.py (3)
src/routes/motor.py (1)
  • update_motor (56-68)
src/views/motor.py (2)
  • MotorView (76-77)
  • MotorSimulation (7-73)
tests/unit/test_routes/test_motors_route.py (3)
  • test_update_motor (291-298)
  • test_update_motor_not_found (308-316)
  • test_update_motor_invalid_input (301-305)
src/utils.py (1)
src/views/flight.py (1)
  • FlightSimulation (9-140)
🪛 GitHub Actions: Pylint
src/utils.py

[error] 78-78: pylint: C0303 trailing whitespace detected.


[error] 83-83: pylint: C0303 trailing whitespace detected.


[error] 89-89: pylint: C0303 trailing whitespace detected.


[error] 92-92: pylint: C0303 trailing whitespace detected.


[error] 95-95: pylint: C0303 trailing whitespace detected.


[error] 98-98: pylint: W0612 Unused variable 'e' (unused-variable).

🪛 Ruff (0.13.3)
src/utils.py

87-87: Do not catch blind exception: Exception

(BLE001)


88-88: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


94-94: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


98-98: Do not catch blind exception: Exception

(BLE001)


98-98: Local variable e is assigned to but never used

Remove assignment to unused variable e

(F841)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses encoding issues and null field update problems in the flight simulation system. The main issue was that the _Flight__evaluate_post_process() method was corrupted as a numpy array instead of a callable method, causing encoding failures.

  • Added robust error handling and corruption detection for the _Flight__evaluate_post_process method in the JSON encoder
  • Changed repository update methods to include null fields instead of excluding them
  • Implemented fallback mechanisms for encoding errors

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/utils.py Added comprehensive error handling and corruption detection for Flight object encoding
src/repositories/rocket.py Changed model dump to include null fields during updates
src/repositories/motor.py Changed model dump to include null fields during updates
src/repositories/flight.py Changed model dump to include null fields during updates

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

src/utils.py Outdated
try:
delattr(obj, '_Flight__evaluate_post_process')

restored_method = getattr(obj, '_Flight__evaluate_post_process', None)
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After deleting the corrupted attribute, immediately accessing it again may not restore the original method. The cached_property mechanism might not automatically recreate the method. Consider using the class definition to access the original property descriptor.

Suggested change
restored_method = getattr(obj, '_Flight__evaluate_post_process', None)
# Access the property via the class descriptor to restore it correctly
restored_method = type(obj)._Flight__evaluate_post_process.__get__(obj, type(obj))

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wdyt @aasitvora99 ?

GabrielBarberini and others added 2 commits October 11, 2025 16:27
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Collaborator

@GabrielBarberini GabrielBarberini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments, also could you please fix the linter issues ?

src/utils.py Outdated
delattr(obj, '_Flight__evaluate_post_process')

restored_method = getattr(obj, '_Flight__evaluate_post_process', None)
if restored_method and callable(restored_method):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably this is a tautology.

If it is callable it will always pass the first check.

Maybe just reduce it to if callable(obj)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted my changes back to normal, unblocked by bressan on call.

src/utils.py Outdated
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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Only callable check is enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted my changes back to normal, unblocked by bressan on call.

src/utils.py Outdated
try:
delattr(obj, '_Flight__evaluate_post_process')

restored_method = getattr(obj, '_Flight__evaluate_post_process', None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wdyt @aasitvora99 ?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44a2ebc and 9114d81.

📒 Files selected for processing (1)
  • src/utils.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/utils.py (2)
src/views/flight.py (1)
  • FlightSimulation (9-140)
src/controllers/flight.py (1)
  • FlightController (12-108)
🪛 GitHub Actions: Pylint
src/utils.py

[error] 78-78: E0001: Parsing failed: 'expected an indented block after 'try' statement on line 77 (src.utils, line 78)'

🪛 Ruff (0.13.3)
src/utils.py

77-78: Expected an indented block after try statement

(invalid-syntax)


78-78: Expected except or finally after try block

(invalid-syntax)


79-79: Unexpected indentation

(invalid-syntax)


82-82: Unexpected indentation

(invalid-syntax)


89-89: Expected except or finally after try block

(invalid-syntax)


89-89: Expected an identifier, but found a keyword 'except' that cannot be used here

(invalid-syntax)


89-89: Simple statements must be separated by newlines or semicolons

(invalid-syntax)


89-89: Expected a statement

(invalid-syntax)


89-90: Expected an expression

(invalid-syntax)


91-91: Unexpected indentation

(invalid-syntax)


91-91: Expected a statement

(invalid-syntax)


91-91: Expected a statement

(invalid-syntax)


91-92: Expected an expression

(invalid-syntax)


92-92: Unexpected indentation

(invalid-syntax)


94-94: unindent does not match any outer indentation level

(invalid-syntax)


94-94: Invalid annotated assignment target

(invalid-syntax)


94-95: Expected an expression

(invalid-syntax)


95-95: Unexpected indentation

(invalid-syntax)


97-97: unindent does not match any outer indentation level

(invalid-syntax)


97-97: Expected a statement

(invalid-syntax)


97-97: Expected a statement

(invalid-syntax)


97-98: Expected an expression

(invalid-syntax)


99-99: Unexpected indentation

(invalid-syntax)


100-100: unindent does not match any outer indentation level

(invalid-syntax)


102-102: unindent does not match any outer indentation level

(invalid-syntax)


102-102: Expected a statement

(invalid-syntax)


102-102: Only single target (not tuple) can be annotated

(invalid-syntax)


102-103: Expected an expression

(invalid-syntax)


103-103: Unexpected indentation

(invalid-syntax)

🔇 Additional comments (1)
src/utils.py (1)

100-104: Verify the indentation and control flow for solution handling.

After fixing the indentation issues, ensure that lines 100-103 (the try-except block for solution retrieval) are properly indented within the if isinstance(obj, Flight): block. The early return on line 103 should prevent reaching line 104 when the exception occurs, but the current broken indentation makes this unclear.

As noted in previous comments, if the fallback on line 103 executes, solution will be undefined. However, the early return should prevent reaching line 104. Confirm the intended control flow once indentation is corrected.

GabrielBarberini and others added 6 commits October 11, 2025 16:34
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…/Infinity-API into bug/simulate-forward-fixes
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/utils.py (1)

57-58: Remove unnecessary __init__ override.

The __init__ method only delegates to the parent class without adding any custom initialization. Python automatically calls the parent's __init__ when not overridden, making this override redundant.

Apply this diff to remove the unnecessary override:

-    def __init__(self, *args, **kwargs):
-        super().__init__(*args, **kwargs)
-
     def default(self, obj):
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec9a552 and 0286681.

📒 Files selected for processing (1)
  • src/utils.py (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Pylint
src/utils.py

[error] 60-60: Pylint: W0237 - Parameter 'o' has been renamed to 'obj' in overriding InfinityEncoder.default method (arguments-renamed).


[error] 78-78: Pylint: W0104 - Statement seems to have no effect (pointless-statement).

🪛 Ruff (0.13.3)
src/utils.py

78-78: Found useless expression. Either assign it to a variable or remove it.

(B018)

🔇 Additional comments (2)
src/utils.py (2)

60-60: Parameter rename improves clarity.

Renaming the parameter from o to obj is more descriptive and consistent with the method body. The Pylint warning (W0237) about parameter renaming in an overriding method is expected and acceptable here.


78-78: Clarify intent of private attribute access on Flight
The expression obj._Flight__evaluate_post_process merely reads a name-mangled member without calling or using it. Confirm whether this is meant to trigger a cached evaluation (and exists on the external Flight class), document that side effect, handle corruption, or remove it:

  • Document as # Access cached_property to trigger evaluation before serialization
  • Or detect/log corruption: check if it’s an np.ndarray and warn
  • Or remove the line if it serves no purpose

@aasitvora99
Copy link
Contributor Author

aasitvora99 commented Oct 25, 2025

@GabrielBarberini ran lint, format and tests

make lint
flake8 --ignore E501,E402,F401,W503,C0414 ./src || true
flake8 --ignore E501,E402,F401,W503,C0414 ./tests || true
pylint ./src || true
************* Module src.utils
src/utils.py:57:4: W0246: Useless parent or super() delegation in method '__init__' (useless-parent-delegation)
src/utils.py:60:4: W0237: Parameter 'o' has been renamed to 'obj' in overriding 'InfinityEncoder.default' method (arguments-renamed)
src/utils.py:78:12: W0104: Statement seems to have no effect (pointless-statement)

-----------------------------------
Your code has been rated at 9.95/10

pylint ./tests || true

------------------------------------
Your code has been rated at 10.00/10
make format
black ./src || true
All done! ✨ 🍰 ✨
38 files left unchanged.
black ./tests || true
All done! ✨ 🍰 ✨
7 files left unchanged.
ruff check --fix ./src || true
All checks passed!
ruff check --fix ./tests || true
All checks passed!
python3 -m pytest .
======================================================================================== test session starts ========================================================================================
platform darwin -- Python 3.13.5, pytest-8.4.1, pluggy-1.6.0
rootdir: /Users/aasitvora/Desktop/chintu/Infinity-API
configfile: pyproject.toml
plugins: anyio-4.9.0, asyncio-1.1.0
asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 126 items                                                                                                                                                                                 

tests/unit/test_controllers/test_controller_interface.py ............                                                                                                                         [  9%]
tests/unit/test_repositories/test_repository_interface.py ...............                                                                                                                     [ 21%]
tests/unit/test_routes/test_environments_route.py ...................                                                                                                                         [ 36%]
tests/unit/test_routes/test_flights_route.py ...........................                                                                                                                      [ 57%]
tests/unit/test_routes/test_motors_route.py ...........................                                                                                                                       [ 79%]
tests/unit/test_routes/test_rockets_route.py ..........................                                                                                                                       [100%]

======================================================================================== 126 passed in 4.04s ========================================================================================

phmbressan
phmbressan previously approved these changes Oct 25, 2025
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was not able to initialise fields back to null om update

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because of some legacy rockets (e.g before drop null was deployed). Could you please test if this is also the case for rockets created after drop null was implemented?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested some old rockets and motors from April this year and null assignment is working fine for them. Not sure when this migration took place but it looks quite backward compatible.
If it breaks for any older than that, it might require some sort of backfill for them.

@GabrielBarberini
Copy link
Collaborator

@GabrielBarberini ran lint, format and tests

make lint
flake8 --ignore E501,E402,F401,W503,C0414 ./src || true
flake8 --ignore E501,E402,F401,W503,C0414 ./tests || true
pylint ./src || true
************* Module src.utils
src/utils.py:57:4: W0246: Useless parent or super() delegation in method '__init__' (useless-parent-delegation)
src/utils.py:60:4: W0237: Parameter 'o' has been renamed to 'obj' in overriding 'InfinityEncoder.default' method (arguments-renamed)
src/utils.py:78:12: W0104: Statement seems to have no effect (pointless-statement)

-----------------------------------
Your code has been rated at 9.95/10

pylint ./tests || true

------------------------------------
Your code has been rated at 10.00/10
make format
black ./src || true
All done! ✨ 🍰 ✨
38 files left unchanged.
black ./tests || true
All done! ✨ 🍰 ✨
7 files left unchanged.
ruff check --fix ./src || true
All checks passed!
ruff check --fix ./tests || true
All checks passed!
python3 -m pytest .
======================================================================================== test session starts ========================================================================================
platform darwin -- Python 3.13.5, pytest-8.4.1, pluggy-1.6.0
rootdir: /Users/aasitvora/Desktop/chintu/Infinity-API
configfile: pyproject.toml
plugins: anyio-4.9.0, asyncio-1.1.0
asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 126 items                                                                                                                                                                                 

tests/unit/test_controllers/test_controller_interface.py ............                                                                                                                         [  9%]
tests/unit/test_repositories/test_repository_interface.py ...............                                                                                                                     [ 21%]
tests/unit/test_routes/test_environments_route.py ...................                                                                                                                         [ 36%]
tests/unit/test_routes/test_flights_route.py ...........................                                                                                                                      [ 57%]
tests/unit/test_routes/test_motors_route.py ...........................                                                                                                                       [ 79%]
tests/unit/test_routes/test_rockets_route.py ..........................                                                                                                                       [100%]

======================================================================================== 126 passed in 4.04s ========================================================================================

Linter is still failing, we need to either argue around dismissing this formally under the pyproject toml or inline (prferred) with a reasonable excuse or fix this

@aasitvora99
Copy link
Contributor Author

Don't fully understand why the lints are failing. will need to read more to understand. I'll come up with a fix for this.

@aasitvora99
Copy link
Contributor Author

@GabrielBarberini not my finest work but patched some fixes to pass lints

make lint
flake8 --ignore E501,E402,F401,W503,C0414 ./src || true
flake8 --ignore E501,E402,F401,W503,C0414 ./tests || true
pylint ./src || true

-------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 9.98/10, +0.02)

pylint ./tests || true

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 82d55e6 and f8c4b79.

📒 Files selected for processing (1)
  • src/utils.py (2 hunks)
🧰 Additional context used
🪛 Ruff (0.14.2)
src/utils.py

76-76: Found useless expression. Either assign it to a variable or remove it.

(B018)


77-78: try-except-pass detected, consider logging the exception

(S110)


77-77: Do not catch blind exception: Exception

(BLE001)

🔇 Additional comments (2)
src/utils.py (2)

57-73: LGTM! Parameter rename improves consistency.

The parameter rename from obj to o aligns with JSON encoder conventions and the parent RocketPyEncoder class. All references are updated consistently, and the Function discretization logic is preserved correctly.


79-98: LGTM! Consistent refactoring throughout.

The solution reduction logic and field nullification correctly use the renamed parameter o. The functional behavior is preserved:

  • Solution data is reduced via interpolation when size exceeds 25 elements
  • flight_phases and function_evaluations are nullified to reduce serialization payload
  • Falls back to parent encoder for final serialization

@GabrielBarberini GabrielBarberini merged commit 7e4c8c2 into master Nov 1, 2025
4 checks passed
@GabrielBarberini GabrielBarberini deleted the bug/simulate-forward-fixes branch November 1, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants