Skip to content

[#144] Fix an issue with RSO reward calculation#284

Merged
Mark2000 merged 1 commit into
developfrom
bugfix/rso-point-fix
Jun 20, 2025
Merged

[#144] Fix an issue with RSO reward calculation#284
Mark2000 merged 1 commit into
developfrom
bugfix/rso-point-fix

Conversation

@Mark2000

Copy link
Copy Markdown
Contributor

Description

Fixes and issue where the RSO reward bonus would be yielded and the episode would terminate if at least min_time_for_completion elapsed in the first step and no points were inspected during that step.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How should this pull request be reviewed?

  • By commit
  • All changes at once

How Has This Been Tested?

External testing.

Future Work

None.

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation and release notes
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Copilot AI review requested due to automatic review settings June 20, 2025 21:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes a bug in RSO reward calculation where the bonus could be granted prematurely if no points were inspected, and improves debuggability by adding string representations and logging.

  • Removed the skip guard for empty point_inspect_status to ensure correct reward logic.
  • Added __repr__ methods to data classes for clearer debug output.
  • Inserted a logging statement to report inspected/illuminated/total counts.

Reviewed Changes

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

File Description
src/bsk_rl/data/rso_inspection.py Removed empty-data skip in calculate_reward, added __repr__ and logging.
src/bsk_rl/data/resource_data.py Added __repr__ to ResourceData for improved debug output.
src/bsk_rl/data/composition.py Added __repr__ to ComposedData for improved debug output.
Comments suppressed due to low confidence (5)

src/bsk_rl/data/rso_inspection.py:74

  • [nitpick] In the __repr__, use the same naming as your properties for clarity (e.g., num_points_inspected= instead of inspected=) to avoid confusion when debugging.
    def __repr__(self) -> str:

src/bsk_rl/data/rso_inspection.py:74

  • Add a unit test for RSOInspectionData.__repr__ to ensure the string format remains correct as fields evolve.
    def __repr__(self) -> str:

src/bsk_rl/data/resource_data.py:36

  • Consider adding a unit test for ResourceData.__repr__ so changes to the representation will be caught by CI.
    def __repr__(self) -> str:

src/bsk_rl/data/composition.py:57

  • Add a test for ComposedData.__repr__ to validate its output when composed of multiple data instances.
    def __repr__(self) -> str:

src/bsk_rl/data/rso_inspection.py:311

  • Avoid using f-strings in logger calls directly; prefer parameterized logging (e.g., logger.info("Inspected/Illuminated/Total: %d/%d/%d", inspected, illuminated, total)) to defer formatting when the log level is disabled.
        logger.info(

@Mark2000
Mark2000 force-pushed the bugfix/rso-point-fix branch from 009724c to db34dd2 Compare June 20, 2025 21:57

@dhutererprats dhutererprats left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

to be clear only the removal of lines 290-292 within rso_inspection.py are actually contributing to fixing this issue, correct? the rest is just info logging etc. from what I can tell

@Mark2000

Copy link
Copy Markdown
Contributor Author

Yeah, just some logging that was used to debug but seems useful enough to keep

@dhutererprats dhutererprats left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

okay, looks good

@Mark2000
Mark2000 merged commit 1240ce4 into develop Jun 20, 2025
12 of 15 checks passed
@Mark2000
Mark2000 deleted the bugfix/rso-point-fix branch June 20, 2025 22:40
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.

3 participants