Skip to content

Fix #8496: Fix MRMS carryover check being applied before work time modifiers#8519

Merged
psikomonkie merged 7 commits intoMegaMek:mainfrom
psikomonkie:issue/8496/mrms-carryover
Dec 15, 2025
Merged

Fix #8496: Fix MRMS carryover check being applied before work time modifiers#8519
psikomonkie merged 7 commits intoMegaMek:mainfrom
psikomonkie:issue/8496/mrms-carryover

Conversation

@psikomonkie
Copy link
Member

Fixes #8496

When doing MRMS, it was checking if a part's work would be more than a tech's time and cancel if the "carryover" is false. This check was done before work time modifiers, so it was not accounting for low skill techs that needed to use extra time, or high skill techs able to rush.

@psikomonkie psikomonkie requested a review from a team as a code owner December 14, 2025 19:20
@codecov
Copy link

codecov bot commented Dec 14, 2025

Codecov Report

❌ Patch coverage is 69.23077% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 12.32%. Comparing base (85b7f5f) to head (b89f865).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
MekHQ/src/mekhq/service/mrms/MRMSService.java 69.23% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8519      +/-   ##
============================================
- Coverage     12.32%   12.32%   -0.01%     
+ Complexity     7426     7425       -1     
============================================
  Files          1287     1287              
  Lines        165312   165312              
  Branches      24875    24875              
============================================
- Hits          20376    20375       -1     
+ Misses       142987   142983       -4     
- Partials       1949     1954       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 fixes issue #8496 where the MRMS (MekHQ Repair and Maintenance System) carryover check was incorrectly applied before work time modifiers were calculated. This caused the system to not account for low-skill technicians needing extra time or high-skill technicians being able to rush repairs when determining if a repair would fit within a tech's remaining work time.

The fix moves the work time modifier calculation before the carryover check, ensuring accurate time estimates are used when deciding whether to assign repairs.

Key Changes

  • Refactored work time calculation logic into reusable helper methods (getWorkTime, getExpectedWorkTime, setPartWorkTime)
  • Modified carryover check to use expected work time that accounts for skill-based modifiers
  • Added comprehensive test coverage for various carryover scenarios including low-skill techs needing extra time

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
MekHQ/src/mekhq/service/mrms/MRMSService.java Refactored carryover check logic to calculate expected work time with modifiers before checking if tech has sufficient time; extracted helper methods for work time management
MekHQ/unittests/mekhq/service/mrms/MRMSServiceTest.java Added new nested test class with 6 test cases covering carryover scenarios; updated breakArmor helper to properly simulate time consumption and added mockPartInventory setup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@psikomonkie psikomonkie added Bug Mass Repair/Mass Salvage Any issue around MSRS labels Dec 14, 2025
Copy link
Collaborator

@IllianiBird IllianiBird left a comment

Choose a reason for hiding this comment

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

One tiny change needed. Marking as approved so it doesn't block your merge.

@psikomonkie psikomonkie merged commit 555b295 into MegaMek:main Dec 15, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Mass Repair/Mass Salvage Any issue around MSRS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] Instant repair starts jobs that will run until the next day when "Allow tasks to carry over to the next day(s)" is unchecked

3 participants