Skip to content

Conversation

Marten-Mrfc
Copy link
Collaborator

@Marten-Mrfc Marten-Mrfc commented Aug 11, 2025

Adds a simple catch (:

Merge whenever you want or are there any improvements needed?

Summary by CodeRabbit

  • Bug Fixes

    • Improved robustness when traversing audience hierarchies by catching stack overflows caused by circular references, preventing silent failures.
  • Chores

    • Added critical logging with detailed context when a stack overflow occurs during audience traversal, aiding faster diagnosis of configuration issues.

@Copilot Copilot AI review requested due to automatic review settings August 11, 2025 20:26
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a try/catch around the recursive descendants traversal in AudienceManager to catch StackOverflowError, log a critical message with entry IDs, and rethrow. Core traversal logic and public API remain unchanged.

Changes

Cohort / File(s) Summary
Audience traversal error handling
engine/engine-paper/src/main/kotlin/com/typewritermc/engine/paper/entry/AudienceManager.kt
Wrap recursive descendants traversal in try/catch for StackOverflowError; on catch, log severe/CRITICAL with involved entry IDs and rethrow. Traversal logic unchanged. No public API changes.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant AudienceManager
  participant Traversal
  participant Logger

  Caller->>AudienceManager: descendants(klass)
  AudienceManager->>Traversal: recurse through entries
  alt Normal traversal
    Traversal-->>AudienceManager: result
    AudienceManager-->>Caller: List<Ref<E>>
  else Stack overflow detected
    Traversal--x AudienceManager: StackOverflowError
    AudienceManager->>Logger: log severe with entry IDs
    AudienceManager--x Caller: rethrow StackOverflowError
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

I hop through graphs, node to node,
Guarding trails where loops corrode.
If stacks collapse and errors roar,
I ring the bell—then leap once more.
Logs in paw, I mark the trail,
So future hops will never fail. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d9c9cfb and 292b753.

📒 Files selected for processing (1)
  • engine/engine-paper/src/main/kotlin/com/typewritermc/engine/paper/entry/AudienceManager.kt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: build
🔇 Additional comments (1)
engine/engine-paper/src/main/kotlin/com/typewritermc/engine/paper/entry/AudienceManager.kt (1)

211-225: LGTM: Defensive programming for circular reference detection

The try-catch wrapper correctly identifies potential circular references in the entry hierarchy without modifying the core traversal logic. The logging provides valuable debugging information by including the specific entry IDs involved in the circular reference.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch features/warning

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@Copilot 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 adds error handling for StackOverflowError in the AudienceManager to detect and log circular references in entry hierarchies. The change wraps the descendants function with a try-catch block to provide better debugging information when stack overflow occurs due to circular references.

  • Adds StackOverflowError handling to prevent silent failures
  • Provides detailed logging for debugging circular reference issues

Thank you copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gabber235 gabber235 merged commit 4f1c883 into develop Aug 13, 2025
4 checks passed
@Marten-Mrfc Marten-Mrfc deleted the features/warning branch August 16, 2025 18:49
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