Skip to content

Conversation

@wtfsayo
Copy link
Member

@wtfsayo wtfsayo commented Jun 25, 2025

Problem

The Windows CI tests were failing with repeated 'The system cannot find the path specified' errors during PGLite database initialization. Investigation revealed that paths were being constructed with mixed separators, causing Windows to be unable to locate the database directory.

Root Cause

Mixed path separators in database paths:

  • Windows backslashes mixed with Unix forward slashes
  • String concatenation instead of proper path joining in tests
  • Missing path normalization in PGLite utilities

Solution

Changes Made:

  1. packages/plugin-sql/src/utils.ts:

    • Added path.normalize() to expandTildePath() function
    • Added path.normalize() throughout resolvePgliteDir() function
    • Ensures all database paths use correct OS-specific separators
  2. packages/plugin-sql/src/pglite/manager.ts:

    • Added path normalization when passing dataDir to PGLite constructor
    • Ensures PGLite receives properly formatted paths for Windows
  3. packages/cli/tests/commands/agent.test.ts:

    • Fixed path construction from string concatenation to path.join()
    • Changed string interpolation to proper path joining

Benefits:

  • Windows gets paths with backslashes
  • Unix systems get paths with forward slashes
  • Cross-platform compatibility maintained
  • Should resolve Windows CI test failures

Testing

This fix addresses the specific Windows path handling issues identified in GitHub Actions run 15878190766.

The changes use Node.js built-in path module functions which are available in Bun and properly handle cross-platform path normalization.

- Add path.normalize() to expandTildePath and resolvePgliteDir functions
- Normalize dataDir path in PGLite manager constructor
- Fix test path construction to use path.join instead of string concatenation
- Resolves 'The system cannot find the path specified' errors on Windows CI

Fixes mixed path separators (backslashes/forward slashes) that were causing
Windows tests to fail during PGLite database initialization and migration.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 25, 2025

Important

Review skipped

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

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

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch fix/windows-path-normalization

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.
    • @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 auto-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.

@wtfsayo wtfsayo requested a review from Copilot June 25, 2025 14:41
Copy link
Contributor

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 addresses Windows CI failures by normalizing file paths to ensure cross-platform compatibility.

  • Added path.normalize() in expandTildePath() and resolvePgliteDir() to ensure OS-specific path separators.
  • Updated PGliteClientManager to normalize the dataDir path.
  • Modified tests to use path.join() for consistent path assembly.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/plugin-sql/src/utils.ts Normalizes tilde-based and resolved paths to support Windows file separators
packages/plugin-sql/src/pglite/manager.ts Applies path normalization for dataDir in the PGlite constructor options
packages/cli/tests/commands/agent.test.ts Uses path.join() for constructing test directory paths to prevent mixed separators

wtfsayo and others added 2 commits June 25, 2025 20:11
- Add path.normalize() to CLI expandTildePath function to ensure consistent separators
- Add comprehensive debug logging to PGLiteClientManager constructor
- Add debug logging to resolvePgliteDir function to trace path resolution
- Add error handling around PGLite client creation
- This complements the existing path normalization in plugin-sql utils
- Should resolve 'The system cannot find the path specified' errors on Windows
@wtfsayo wtfsayo marked this pull request as draft June 25, 2025 15:14
wtfsayo and others added 3 commits June 25, 2025 20:54
- Add comprehensive debug logging to ExtensionManager to identify failing extensions
- Add error details logging including error codes and paths
- Add pre-installation logging to identify exact failure point
- This will help pinpoint whether the issue is with vector or fuzzystrmatch extensions
…point

- Add detailed database connection testing with timing and error details
- Isolate each migration step (extensions, schema, namespace, introspection) with individual try-catch blocks
- Add comprehensive error logging including error types, codes, and Windows-specific context
- This will help identify exactly which operation is causing the repeated path errors
@wtfsayo wtfsayo closed this Jun 25, 2025
@wtfsayo wtfsayo reopened this Jun 25, 2025
- Include Ada in the list of agents to explicitly load as agents
- Increase registration wait time for Windows (5 seconds vs default)
- This ensures Ada is available for agent get commands in tests
@wtfsayo wtfsayo closed this Jun 25, 2025
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