fix: profile_tokio broken due to incompatible types #49

Merged
nondescriptpointer merged 2 commits from fix/profile-tokio-incompatible-types into dev 2025-08-18 21:52:09 -04:00
nondescriptpointer commented 2025-08-17 16:09:10 -04:00 (Migrated from github.com)

Summary by CodeRabbit

  • Bug Fixes
    • Background task startup now surfaces spawn failures consistently when profiling is enabled by converting internal spawn errors into a reported error type. Non-profiling behavior is unchanged. No public API changes — callers and signatures remain the same.
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Background task startup now surfaces spawn failures consistently when profiling is enabled by converting internal spawn errors into a reported error type. Non-profiling behavior is unchanged. No public API changes — callers and signatures remain the same. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2025-08-17 16:09:19 -04:00 (Migrated from github.com)
📝 Walkthrough

Walkthrough

Profile-tokio branch in src/core/task.rs now maps a potential JoinError into eyre::Report via map_err(Into::into) when spawning, returning Result<JoinHandle<O>>. The non-profile-tokio path still returns Ok(spawn(...)). No public signatures changed.

Changes

Cohort / File(s) Summary
Task spawning error mapping
src/core/task.rs
In cfg(profile_tokio) path, convert tokio::spawn's JoinError into eyre::Report using map_err(Into::into), returning Result<JoinHandle<O>>. The non-profile branch remains Ok(spawn(...)). No API/signature changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0451716e1e and 5a597938f4.

📒 Files selected for processing (1)
  • src/core/task.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/task.rs
Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • 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.
  • 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 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/Issue comments)

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

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.
<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough Profile-tokio branch in `src/core/task.rs` now maps a potential `JoinError` into `eyre::Report` via `map_err(Into::into)` when spawning, returning `Result<JoinHandle<O>>`. The non-profile-tokio path still returns `Ok(spawn(...))`. No public signatures changed. ## Changes | Cohort / File(s) | Summary | |---|---| | **Task spawning error mapping**<br>`src/core/task.rs` | In `cfg(profile_tokio)` path, convert `tokio::spawn`'s `JoinError` into `eyre::Report` using `map_err(Into::into)`, returning `Result<JoinHandle<O>>`. The non-profile branch remains `Ok(spawn(...))`. No API/signature changes. | ## Estimated code review effort 🎯 2 (Simple) | ⏱️ ~10 minutes </details> <!-- walkthrough_end --> <!-- announcements_start --> > [!TIP] > <details> > <summary>🔌 Remote MCP (Model Context Protocol) integration is now available!</summary> > > Pro plan users can now connect to remote MCP servers from the [Integrations](https://app.coderabbit.ai/integrations) page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. > > </details> <!-- announcements_end --> --- <details> <summary>📜 Recent review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** **💡 Knowledge Base configuration:** - MCP integration is disabled by default for public repositories - Jira integration is disabled by default for public repositories - Linear integration is disabled by default for public repositories You can enable these sources in your CodeRabbit configuration. <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 0451716e1ed36460186c0f721a4aa3f8d14bb898 and 5a597938f4a94c62a45f3af3308b78a9514f355b. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/core/task.rs` (1 hunks) </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary> * src/core/task.rs </details> </details> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAZvAAeXLz4fl4A+gQA1vD4kAIU+JFkkLTYJJAEKBhMzNzU8AJeGbLc0pCQBgByjgKUXAAsAJzlBgCqNgAyXLC4uNyIHAD0g0TqsNgCGjmDAMq4zqmIuAAaNoO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IDd2y8HQcnKCY3ZCngBhIEWqxloC8wlqj2KYnti8PqUBgPGcfJLmQCKSH8RG4p9HgJh1BP2HURVECMKBKliNWykyWPa/seA7ZJUmtOssuK4ZT3sm9nu+8D2lUxIJX7fXcpY69LByCVYADHKABIN13QwGCfjVQ0CuQ2TN8gLeZi4RbEHlHxgCWCg9DP7fFvdPAvhIdm8F2LEAF5IAc0gAAamQmFEBkAADkfFxAMBfhfKCXAZjgNAdA+YsD4F6DVOfLeGB3IHh8Bgd08Ct5oEQLIbIYRPbTy3IteBx8ua0zNgzSsLMrhsw5lzKmA0GBDR9CQUaZCJpTVmvNQKBVeqhSuPwHwFVorVQZLVF4XAqCNU2i1TKihsqdS0N1CRRV4rMHUGEUSiAwi0gkIqFUtAwh8SRvlQwBgDGsnqByIU/IABsJB+R0AAMwePqB41k/IeQeIYKyHwgpmT8jQPUNAaBfE+B5LQfk9RVA8kaDyBxTiQqQA5GgDkjRBSNF8TyHwcTGj1AYB45ksSOQ+F8WgBpvjeQCEFDyNAjQ3H1AaRyDkAhsk5IgIY4xpjzEKmVHQbG0igoGOYAwbgYQmBVn8LgWxg4sQ9QAN7nxmuRPIagdTiGkDMZqLgZpcBmq3SAABZKkVgLz4DNOgCQ2gC4IhmgYAAvpIyA8zFnLJoKs6Z9B9BAA --> <!-- internal state end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing Touches</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings <details> <summary>🧪 Generate unit tests</summary> - [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests - [ ] <!-- {"checkboxId": "07f1e7d6-8a8e-4e23-9900-8731c2c87f58", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Post copyable unit tests in a comment </details> </details> <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- 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. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=StardustXR/server&utm_content=49): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `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. - 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 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](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions. ### CodeRabbit Commands (Invoked using PR/Issue comments) Type `@coderabbitai help` to get the list of available commands. ### 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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` ### Status, Documentation and Community - Visit our [Status Page](https://status.coderabbit.ai) to check the current availability of CodeRabbit. - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->
coderabbitai[bot] (Migrated from github.com) reviewed 2025-08-17 16:12:04 -04:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 1

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 877a32ab09 and 0451716e1e.

📒 Files selected for processing (1)
  • src/core/task.rs (1 hunks)
**Actionable comments posted: 1** <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** **💡 Knowledge Base configuration:** - MCP integration is disabled by default for public repositories - Jira integration is disabled by default for public repositories - Linear integration is disabled by default for public repositories You can enable these sources in your CodeRabbit configuration. <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 877a32ab09ce1fb77b0a8e79433e85465ecee288 and 0451716e1ed36460186c0f721a4aa3f8d14bb898. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/core/task.rs` (1 hunks) </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@@ -17,6 +17,7 @@ pub fn new<
#[cfg(feature = "profile_tokio")]
coderabbitai[bot] (Migrated from github.com) commented 2025-08-17 16:12:03 -04:00

⚠️ Potential issue

Fix: Builder::spawn returns JoinHandle, not Result; remove map_err and wrap in Ok(...)

.spawn(async_future) returns JoinHandle<O>. There’s nothing to map via map_err; this won’t compile. To keep the return type Result<JoinHandle<O>> consistent with the non-profile_tokio branch, wrap the spawn in Ok(...).

Apply this diff:

-  .spawn(async_future).map_err(Into::into);
+  .spawn(async_future));

And wrap the whole expression in Ok(...):

-#[cfg(feature = "profile_tokio")]
-let result = tokio::task::Builder::new()
-  .name(name_fn().as_ref())
-  .spawn(async_future).map_err(Into::into);
+#[cfg(feature = "profile_tokio")]
+let result = Ok(tokio::task::Builder::new()
+  .name(name_fn().as_ref())
+  .spawn(async_future));
🤖 Prompt for AI Agents
In src/core/task.rs around lines 18 to 21, the code calls Builder::spawn which
returns a JoinHandle but then incorrectly calls map_err on it; remove the
map_err(Into::into) call and wrap the spawn result in Ok(... ) so the function
returns Result<JoinHandle<O>> consistent with the non-profile_tokio branch (i.e.
replace the map_err usage with returning
Ok(tokio::task::Builder::new().name(name_fn().as_ref()).spawn(async_future))).
_⚠️ Potential issue_ **Fix: Builder::spawn returns JoinHandle, not Result; remove map_err and wrap in Ok(...)** `.spawn(async_future)` returns `JoinHandle<O>`. There’s nothing to map via `map_err`; this won’t compile. To keep the return type `Result<JoinHandle<O>>` consistent with the non-`profile_tokio` branch, wrap the spawn in `Ok(...)`. Apply this diff: ```diff - .spawn(async_future).map_err(Into::into); + .spawn(async_future)); ``` And wrap the whole expression in `Ok(...)`: ```diff -#[cfg(feature = "profile_tokio")] -let result = tokio::task::Builder::new() - .name(name_fn().as_ref()) - .spawn(async_future).map_err(Into::into); +#[cfg(feature = "profile_tokio")] +let result = Ok(tokio::task::Builder::new() + .name(name_fn().as_ref()) + .spawn(async_future)); ``` <details> <summary>🤖 Prompt for AI Agents</summary> ``` In src/core/task.rs around lines 18 to 21, the code calls Builder::spawn which returns a JoinHandle but then incorrectly calls map_err on it; remove the map_err(Into::into) call and wrap the spawn result in Ok(... ) so the function returns Result<JoinHandle<O>> consistent with the non-profile_tokio branch (i.e. replace the map_err usage with returning Ok(tokio::task::Builder::new().name(name_fn().as_ref()).spawn(async_future))). ``` </details> <!-- fingerprinting:phantom:poseidon:chinchilla --> <!-- This is an auto-generated comment by CodeRabbit -->
Schmarni-Dev commented 2025-08-17 19:47:37 -04:00 (Migrated from github.com)

could you cargo format this? other than that it's good

could you cargo format this? other than that it's good
technobaboo commented 2025-08-18 12:41:38 -04:00 (Migrated from github.com)

has the code rabbit not helped us at all? if not I'm removing it

-------- Original Message --------
On 8/17/25 4:47 PM, Schmarni wrote:

Schmarni-Dev left a comment (StardustXR/server#49)

could you cargo format this? other than that it's good


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: @.***>

has the code rabbit not helped us at all? if not I'm removing it -------- Original Message -------- On 8/17/25 4:47 PM, Schmarni wrote: > Schmarni-Dev left a comment [(StardustXR/server#49)](https://github.com/StardustXR/server/pull/49#issuecomment-3194734528) > > could you cargo format this? other than that it's good > > — > Reply to this email directly, [view it on GitHub](https://github.com/StardustXR/server/pull/49#issuecomment-3194734528), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABCU4ED6GKBVC4ARFO6WWA33OEIC5AVCNFSM6AAAAACEDKGSKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCOJUG4ZTINJSHA). > You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
Schmarni-Dev commented 2025-08-18 21:52:12 -04:00 (Migrated from github.com)

this works perfectly, thanks!

this works perfectly, thanks!
Sign in to join this conversation.