Skip to content

Fix Viewer Engine incorrectly evaluating rules#64

Merged
Tofaa2 merged 1 commit into
Tofaa2:masterfrom
Chubbyduck1:master
May 22, 2026
Merged

Fix Viewer Engine incorrectly evaluating rules#64
Tofaa2 merged 1 commit into
Tofaa2:masterfrom
Chubbyduck1:master

Conversation

@Chubbyduck1
Copy link
Copy Markdown
Contributor

@Chubbyduck1 Chubbyduck1 commented May 22, 2026

Viewer Engine would incorrectly evaluate rules on the following evaluations:

  • If all entity rules passed, global rules would be ignored
  • If an entity rule failed, it would then check if global rules passed, instead of returning false
  • If an entity rule failed, and the global rules were empty, it would always return true

Summary by CodeRabbit

Release Notes

  • Refactor
    • Improved internal performance optimization in entity visibility handling logic.

Review Change Stack

… pass, and incorrectly responding to failed rules
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b51bc2ab-faf8-4b45-9c74-cb4920edccbc

📥 Commits

Reviewing files that changed from the base of the PR and between fc193d7 and 68be535.

📒 Files selected for processing (1)
  • api/src/main/java/me/tofaa/entitylib/ve/ViewerEngine.java

📝 Walkthrough

Walkthrough

The canSpawnFor method in ViewerEngine refactors from stream-based allMatch chains to explicit for loops that iterate over entity-specific viewer rules and global engine rules, returning false immediately upon the first failing rule and true only if all rules permit visibility.

Changes

Visibility Rule Evaluation

Layer / File(s) Summary
Visibility rule evaluation refactor
api/src/main/java/me/tofaa/entitylib/ve/ViewerEngine.java
canSpawnFor(User, WrapperEntity) replaces compound stream-based allMatch logic with explicit for loops that check entity-specific viewer rules and global rules sequentially, returning false on the first denial and true only if all rules pass.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Tofaa2/EntityLib#50: Both PRs modify ViewerEngine#canSpawnFor(User, WrapperEntity) visibility rule evaluation semantics.

Poem

🐇 With loops explicit, no streams to hide,
Early returns show which rules won't ride,
Entity rules dance with global decree,
Clarity blooms where the visibility be!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix Viewer Engine incorrectly evaluating rules' directly and accurately summarizes the main change: fixing bugs in how the Viewer Engine evaluates visibility rules.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@Tofaa2
Copy link
Copy Markdown
Owner

Tofaa2 commented May 22, 2026

LGTM <3

@Tofaa2 Tofaa2 merged commit 2d9d7cb into Tofaa2:master May 22, 2026
1 of 2 checks passed
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.

2 participants