Skip to content

Remember the last node extraction after a restart - #6

Merged
Drefvelin merged 1 commit into
mainfrom
fix/persist-last-cycle-result
Sep 24, 2026
Merged

Drefvelin merged 1 commit into
mainfrom
fix/persist-last-cycle-result

Conversation

@Drefvelin

@Drefvelin Drefvelin commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Rare Ore Mine cycles are depositing niter and arcane crystals into the hopper above the node. The last-cycle line only lived in memory, so after a restart every node reported Extracted: Nothing until the next multi-hour output.
  • Node saves now store that extraction and restore it on startup. Older node files without the field still show nothing until their next cycle.

Test plan

  • mvn test covers round-tripping niter and arcane crystal counts, including the numeric types the JSON parser writes
  • Restart the server after a rare-ore cycle and confirm the node still lists Niter and Arcane Crystal under Last Cycle Result

Made with Cursor

Summary by CodeRabbit

  • New Features

    • The app now preserves the results of the last cycle when saving and loading node data.
    • Cycle results are read from JSON while ignoring invalid or non-positive amounts.
  • Tests

    • Added automated checks for saving and loading cycle results, including numeric formats and empty inputs.

Rare ore cycles were depositing niter and arcane crystals, but the last-cycle line lived only in memory and came back as Extracted: Nothing after a restart.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Sep 24, 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: bb7f3721-97a0-4292-98f7-199c54acd5de

📥 Commits

Reviewing files that changed from the base of the PR and between a8fd37d and 95a5404.

📒 Files selected for processing (4)
  • pom.xml
  • src/main/java/net/tfminecraft/dowsing/utils/Database.java
  • src/main/java/net/tfminecraft/dowsing/utils/LastCycleResult.java
  • src/test/java/net/tfminecraft/dowsing/utils/LastCycleResultTest.java

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change adds JSON conversion for node last-cycle results and uses it when loading and saving nodes. It also adds tests for conversion and numeric parsing, plus JUnit Jupiter and Maven Surefire configuration.

Changes

Last-cycle result persistence

Layer / File(s) Summary
JSON conversion and validation
src/main/java/net/tfminecraft/dowsing/utils/LastCycleResult.java, src/test/java/net/tfminecraft/dowsing/utils/LastCycleResultTest.java, pom.xml
Adds conversion between result maps and JSON. Parsing retains positive amounts and converts numeric values to integers. Tests cover round-tripping, numeric values, and empty inputs. Maven adds JUnit Jupiter and configures Surefire.
Database load and save
src/main/java/net/tfminecraft/dowsing/utils/Database.java
Node loading restores the last-cycle result when its JSON key exists. Node saving writes the result under that key.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: ryanbarlow97

Merge Risk: ⚪ Minimal · up to 95a54

Saved extraction results remain visible after a normal restart. No issue identified here needs resolution before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving the last node extraction across restarts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

A rabbit checks the saved result,
Then tucks it in its JSON nook.
The numbers hop back whole and neat,
While tests record each careful look.
The cycle rests, ready to return.

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

@Drefvelin
Drefvelin merged commit 00b3868 into main Sep 24, 2026
2 checks passed
@Drefvelin
Drefvelin deleted the fix/persist-last-cycle-result branch September 24, 2026 08:48
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