Skip to content

test: reach 100% runtime line coverage and fix surgery bugs - #24

Merged
ryanbarlow97 merged 1 commit into
mainfrom
codex/coverage-100
Oct 2, 2026
Merged

ryanbarlow97 merged 1 commit into
mainfrom
codex/coverage-100

Conversation

@ryanbarlow97

Copy link
Copy Markdown
Contributor

Surgery starts at 64/1,133 covered executable lines (5.65%). Add behavioral tests for player consent, operation state, all tools and complications, success/failure handling, menus, configuration, events and plugin lifecycle. The suite now covers all 1,139 production lines with no exclusions; Maven enforces zero missed lines and CI uploads JaCoCo reports.

The tests reproduced three bugs, fixed here with their regressions:

  • A successful sponge immediately cleared its own protection. Consume the previous protection after the next skill roll, allowing a new sponge to protect the following action.
  • Chloroform misuse could end the operation and still play the successful-action sound. Stop action feedback after the session ends.
  • Oversized configured durations threw exceptions or overflowed, and large durations formatted as negative hours. Reject parse/arithmetic overflow and round display units without overflowing.

Validation: Java 21 mvn clean verify; 98 tests passed, no failures or skips. Runtime JAR filename/version check passed. JaCoCo: lines 1,139/1,139 (100%), instructions 6,028/6,031, branches 631/649. The enforced metric is executable-line coverage across all runtime classes; maintenance/build scripts are outside the ranking.

Bug fixes and coverage changes stay together in this PR, including CodeRabbit follow-ups.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 48ed359f-d2c1-49a9-89be-8b48eeab70eb

📥 Commits

Reviewing files that changed from the base of the PR and between a5e2938 and a12b915.

📒 Files selected for processing (14)
  • .github/workflows/build.yml
  • README.md
  • pom.xml
  • src/main/java/net/tfminecraft/surgery/managers/SurgeryItemHandler.java
  • src/main/java/net/tfminecraft/surgery/procedures/Durations.java
  • src/test/java/net/tfminecraft/surgery/SurgeryLifecycleTest.java
  • src/test/java/net/tfminecraft/surgery/commands/SurgeryCommandTest.java
  • src/test/java/net/tfminecraft/surgery/managers/SurgeryCompletionTest.java
  • src/test/java/net/tfminecraft/surgery/managers/SurgeryItemHandlerTest.java
  • src/test/java/net/tfminecraft/surgery/managers/SurgeryMechanicsManagerTest.java
  • src/test/java/net/tfminecraft/surgery/managers/SurgeryPresentationTest.java
  • src/test/java/net/tfminecraft/surgery/managers/SurgeryStateAndRequestTest.java
  • src/test/java/net/tfminecraft/surgery/procedures/DurationsTest.java
  • src/test/java/net/tfminecraft/surgery/procedures/ProcedureRegistryTest.java

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Corrected surgery tool handling so sponge protection applies to the following move, and no failure sound is triggered after a surgery session ends.
    • Improved duration parsing and formatting to handle extreme values without arithmetic overflow.
  • Tests
    • Expanded automated checks across surgery sessions, requests, tools, presentation, and duration handling.
  • Documentation
    • Added guidance on running tests, coverage requirements, and report locations.
  • Build
    • Builds now generate coverage reports and fail when tests are missing or production-code line coverage is below the required threshold.

Walkthrough

The pull request configures Maven tests and JaCoCo coverage reporting, adds tests for surgery lifecycle and mechanics, and changes surgery item handling and duration arithmetic.

Changes

Test and coverage pipeline

Layer / File(s) Summary
Test runtime and coverage configuration
pom.xml
Updates test dependencies and configures Mockito, Surefire and JaCoCo.
Lifecycle, command and request tests
src/test/java/net/tfminecraft/surgery/SurgeryLifecycleTest.java, src/test/java/net/tfminecraft/surgery/commands/SurgeryCommandTest.java, src/test/java/net/tfminecraft/surgery/managers/SurgeryStateAndRequestTest.java
Adds tests for plugin lifecycle, command handling, surgery state and request management.
Surgery mechanics and presentation tests
src/test/java/net/tfminecraft/surgery/managers/SurgeryCompletionTest.java, src/test/java/net/tfminecraft/surgery/managers/SurgeryMechanicsManagerTest.java, src/test/java/net/tfminecraft/surgery/managers/SurgeryPresentationTest.java, src/test/java/net/tfminecraft/surgery/procedures/ProcedureRegistryTest.java
Adds tests for completion criteria, surgery mechanics, presentation and default procedure configuration.
Coverage report generation and upload
.github/workflows/build.yml, README.md
Uploads the JaCoCo report when its XML file exists and documents the verification command, coverage threshold and report outputs.

Surgery item handling

Layer / File(s) Summary
Tool action and sponge protection
src/main/java/net/tfminecraft/surgery/managers/SurgeryItemHandler.java, src/test/java/net/tfminecraft/surgery/managers/SurgeryItemHandlerTest.java
Clears previous sponge protection before processing a tool and exits after a tool ends the session. Tests cover tool handling and session-ending paths.

Duration arithmetic

Layer / File(s) Summary
Overflow-safe parsing and formatting
src/main/java/net/tfminecraft/surgery/procedures/Durations.java, src/test/java/net/tfminecraft/surgery/procedures/DurationsTest.java
Rejects arithmetic overflow during parsing and avoids overflow when formatting durations. Tests cover overflow and boundary values.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to a12b9

The surgery fixes and coverage configuration have no identified issue that needs resolution before merging. Complete the normal build checks before merge.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

@ryanbarlow97
ryanbarlow97 merged commit 32714b7 into main Oct 2, 2026
2 checks passed
@ryanbarlow97
ryanbarlow97 deleted the codex/coverage-100 branch October 2, 2026 08:27
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.

1 participant