Skip to content

fix: restore ground item Take fallback#1812

Open
JogOnJohn wants to merge 2 commits into
chsami:developmentfrom
JogOnJohn:fix/ground-item-take-fallback
Open

fix: restore ground item Take fallback#1812
JogOnJohn wants to merge 2 commits into
chsami:developmentfrom
JogOnJohn:fix/ground-item-take-fallback

Conversation

@JogOnJohn

Copy link
Copy Markdown
Contributor

Summary

Restores the legacy ground item action fallback for cases where reflection cannot resolve usable ground item actions from the item definition.

Details

  • Preserves reflection-discovered ground item actions when present.
  • Falls back to {null, null, "Take", null, null} only when no usable action data is found.
  • Covers missing action structure, empty action lists, and null/blank-only action lists with focused tests.

Validation

  • ./gradlew.bat :client:compileJava :client:compileTestJava --console=plain
  • Live forced-fallback smoke: dropped Amethyst was picked back up through the fallback path; inventory increased from 15 to 16.

Note

This PR is intentionally narrow. It does not replace normal reflected action resolution; it only restores the default Take fallback for failure cases.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a6564c0e-7547-448a-ae19-da992f6139bc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Rs2Reflection.getGroundItemActionsFromObject is updated so all extraction branches — the direct String list path, the stringField bean extraction path, and the cached-field paths — now pass their results through a new groundItemActionsOrDefault(String[]) helper. This helper returns a defaultGroundItemActions() array ({null, null, "Take", null, null}) when the extracted array is null, empty, or contains only blank entries, replacing the previous empty-array fallback. A test fixture class gains a createWithoutGroundActions() factory and a corresponding FakeItemWithoutGroundActions inner class, and three new JUnit tests verify the fallback behavior for missing, empty, and null/blank action structures.

Possibly related PRs

  • chsami/Microbot#1718: Refactors the same Rs2Reflection ground-item action extraction and caching logic that this PR modifies.
  • chsami/Microbot#1803: Also updates getGroundItemActionsFromObject to normalize the discovered action array and fall back to a default set with "Take".
  • chsami/Microbot#1807: Modifies ground-item action extraction and adjusts tests around the returned array when action structure data is missing or invalid.
🚥 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: restoring the ground item Take fallback.
Description check ✅ Passed The description is directly related to the fallback behavior changes and added tests.
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.

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/reflection/Rs2Reflection.java`:
- Around line 180-181: `extractWithCache()` still has early exits that return an
empty string array before the cached fallback is applied, so normalize those
cached-path returns as well. Update the `outer == null` and non-`List` branches
in `Rs2Reflection.extractWithCache()` to route through the same
`groundItemActionsOrDefault(...)` fallback used later, matching the
`cachedStringField` handling and avoiding the old empty-array behavior after
cache warmup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 127480ab-9a90-4a7f-80de-c389c0867f91

📥 Commits

Reviewing files that changed from the base of the PR and between fd57cc1 and cb232bb.

📒 Files selected for processing (3)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/reflection/Rs2Reflection.java
  • runelite-client/src/test/java/groundactionfixture/GroundItemActionFixture.java
  • runelite-client/src/test/java/net/runelite/client/plugins/microbot/util/reflection/Rs2ReflectionGroundItemActionsTest.java

@JogOnJohn

Copy link
Copy Markdown
Contributor Author

Validation note: during the forced fallback smoke test, the injected client logged a warning that it could not correlate the synthetic fallback `Take` menu op with a clicked menu entry. The action still completed successfully: the dropped Amethyst was picked back up and inventory increased from 15 to 16. I am treating this as a diagnostic/menu-correlation warning from the forced fallback test path, not as evidence that the fallback action failed.

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