8000 fix: canonicalize paths in api service run args by Hrdtr Β· Pull Request #10 Β· Hrdtr/devu Β· GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: canonicalize paths in api service run args #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025

Conversation

Hrdtr
Copy link
Owner
@Hrdtr Hrdtr commented May 23, 2025

πŸ”— Linked issue

#8

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSDoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Fixed API resources unresolved on Windows build.
This PR also changes the embedded Bun binary name to make it easier to identify services run by the app.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when launching the API service by normalizing file paths, ensuring better compatibility across operating systems.
  • Chores
    • Updated references to the sidecar binary from "bun" to "devu-bun" throughout the application and configuration files.
    • Removed an obsolete Linux build error log file.

@Hrdtr Hrdtr linked an issue May 23, 2025 that may be closed by this pull request
Copy link
coderabbitai bot commented May 23, 2025

Walkthrough

The changes update the naming of the Bun sidecar binary from "bun" to "devu-bun" across configuration, code, and scripts. Path handling in the Rust code is refactored to canonicalize resource and data directories using the dunce crate. A log file documenting a Linux build failure is removed, and the new dunce dependency is added.

Changes

File(s) Change Summary
apps/devu/tauri/Cargo.toml Added the dunce crate (v1.0.5) as a new dependency.
apps/devu/tauri/capabilities/default.json
apps/devu/tauri/tauri.conf.json
Changed sidecar binary name from "binaries/bun" to "binaries/devu-bun" in permission and configuration files.
apps/devu/tauri/src/lib.rs Refactored to canonicalize resource/data paths with dunce::canonicalize and changed sidecar name to "devu-bun".
scripts/init/sidecar.bun.ts Updated sidecar binary filename from "bun-..." to "devu-bun-...".
apps/devu/tauri/linux-notes.txt Removed file containing a Linux build failure log.

Sequence Diagram(s)

sequenceDiagram
    participant App as Tauri App
    participant OS as Operating System
    participant Sidecar as devu-bun (Sidecar Binary)

    App->>OS: Canonicalize resource/data paths (using dunce)
    App->>Sidecar: Spawn "devu-bun" with canonicalized paths as arguments
    Sidecar-->>App: Runs API service with provided paths
Loading

Poem

πŸ‡
The Bun is now Devu, a name fresh and new,
Paths are straightened, canonical and true.
With dunce in the mix, no Windows tricks,
Old logs swept away, clean builds in view.
Hop, hop, hoorayβ€”sidecars debut!

Note

⚑️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


πŸ“œ 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 0d09528 and 3c07eff.

β›” Files ignored due to path filters (2)
  • apps/devu/tauri/Cargo.lock is excluded by !**/*.lock
  • bun.lock is excluded by !**/*.lock
πŸ“’ Files selected for processing (6)
  • apps/devu/tauri/Cargo.toml (1 hunks)
  • apps/devu/tauri/capabilities/default.json (1 hunks)
  • apps/devu/tauri/linux-notes.txt (0 hunks)
  • apps/devu/tauri/src/lib.rs (1 hunks)
  • apps/devu/tauri/tauri.conf.json (1 hunks)
  • scripts/init/sidecar.bun.ts (1 hunks)
πŸ’€ Files with no reviewable changes (1)
  • apps/devu/tauri/linux-notes.txt
πŸ”‡ Additional comments (8)
apps/devu/tauri/Cargo.toml (1)

34-34: Appropriate dependency addition for path canonicalization

The dunce crate is a good choice for canonicalizing paths, especially on Windows. It handles Windows-specific path prefixes (like \\?\) while avoiding some of the problematic behaviors of the standard library's canonicalize function.

apps/devu/tauri/tauri.conf.json (1)

40-40: Binary name consistency improvement

Renaming the binary from "bun" to "devu-bun" helps with service identification and follows better naming practices by providing context about which application the binary belongs to.

apps/devu/tauri/capabilities/default.json (1)

18-18: Binary name updated in permissions

Correctly updated the shell spawn permission to match the renamed binary. This maintains consistency with the changes in the tauri.conf.json file.

scripts/init/sidecar.bun.ts (1)

37-37: Binary naming consistent with other files

The sidecar binary path has been appropriately updated to maintain consistency with the naming changes in the other configuration files.

apps/devu/tauri/src/lib.rs (4)

53-65: Path canonicalization with fallback improves Windows compatibility

The code now properly canonicalizes resource paths using dunce::canonicalize which addresses the Windows-specific path prefix issue (\\?\) that was causing the API resources to be unresolved. The implementation includes a fallback to the original path if canonicalization fails, which is a good defensive coding practice.


69-77: Consistent path handling for data directory

Similar to the resources path, the data directory path is now properly canonicalized with appropriate fallback handling. This maintains consistency in how all paths are processed before being passed to the API service.


82-82: Sidecar binary name updated to match configuration files

The sidecar binary name has been changed from "bun" to "devu-bun" which maintains consistency with the changes in the configuration files.


86-86: Fixed path argument references

The code now correctly passes the canonicalized string paths to the sidecar command arguments, ensuring that the API service can properly resolve resources and access the data directory on all platforms, especially Windows.

Also applies to: 90-90, 92-92

✨ Finishing Touches
  • πŸ“ Generate Docstrings

πŸͺ§ 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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 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.

Repository owner deleted a comment from coderabbitai bot May 23, 2025
@Hrdtr Hrdtr merged commit 6e81443 into main May 23, 2025
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.

API Resources Unresolved on Windows Build
1 participant
0