Skip to content

fix(worker): skip non-directory paths in file-based git connection config#1049

Merged
brendan-kellam merged 3 commits intomainfrom
brendan-kellam/fix-SOU-669
Mar 26, 2026
Merged

fix(worker): skip non-directory paths in file-based git connection config#1049
brendan-kellam merged 3 commits intomainfrom
brendan-kellam/fix-SOU-669

Conversation

@brendan-kellam
Copy link
Copy Markdown
Contributor

@brendan-kellam brendan-kellam commented Mar 26, 2026

Summary

  • compileGenericGitHostConfig_file now checks each matched path with fs.stat() before attempting any git operations
  • Paths that are files (not directories) are skipped with a warning, preventing the Git.cwd: cannot change to non-directory error

Test plan

  • Configure a file:// connection with a glob pattern that matches both files and directories and verify files are skipped with a warning
  • Verify valid git repo directories are still indexed correctly

Fixes #1005

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where local git connections using file:// protocol would fail when the path referenced a file instead of a directory.

brendan-kellam and others added 2 commits March 25, 2026 22:52
…nfig

Fixes #1005

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

This comment has been minimized.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0b9f0494-67ee-4cea-ac27-6b8e56df43b3

📥 Commits

Reviewing files that changed from the base of the PR and between 443d59c and 64d1326.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • packages/backend/src/repoCompileUtils.ts

Walkthrough

The changes add validation to ensure local file:// git connections point to directories rather than files, preventing connection sync failures. A pre-check in the git config compilation verifies matched paths exist and are directories before processing, with warnings logged for invalid paths.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added changelog entry documenting the fix for issue #1049 regarding local git connections failing when paths matched files instead of directories.
Path Validation
packages/backend/src/repoCompileUtils.ts
Added pre-check during compileGenericGitHostConfig_file using fs.stat to verify each matched repoPath exists and is a directory. Invalid paths are logged as warnings and skipped from further processing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch brendan-kellam/fix-SOU-669

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.

@brendan-kellam brendan-kellam merged commit 34a1435 into main Mar 26, 2026
5 of 6 checks passed
@brendan-kellam brendan-kellam deleted the brendan-kellam/fix-SOU-669 branch March 26, 2026 05:56
brendan-kellam added a commit that referenced this pull request Mar 26, 2026
… check

Mocks fs/promises so tests don't hit the real filesystem. The directory
check added in #1049 caused all file-based config tests to fail since
fake paths like /path/to/valid/repo don't exist on disk. Also adds a
test verifying that a file path (non-directory) produces a warning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

[bug] connection sync failed for local git repository

1 participant