Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6553830
Implement SFTP storage with comprehensive tests
claude Nov 7, 2025
47943b5
Add comprehensive integration test infrastructure for CI/CD
claude Nov 7, 2025
75ce55f
Fix SftpStorage build errors
claude Nov 7, 2025
61a3896
Add comprehensive XML documentation to all public members in SftpStorage
claude Nov 7, 2025
d3f2783
Add XML documentation to Dispose method in SyncEngine
claude Nov 7, 2025
dacb666
Refactor storage classes to use auto-properties
claude Nov 7, 2025
a05e0fe
Add comprehensive XML documentation to all public members
claude Nov 7, 2025
893c973
Fix ambiguous SftpStorage constructor calls in tests
claude Nov 7, 2025
7c923ae
Fix SFTP server healthcheck wait in integration test scripts
claude Nov 8, 2025
d3e1fdc
Remove version attribute from Docker compose
Menelion Nov 8, 2025
a4fc30c
Fix CS
Menelion Nov 8, 2025
5539734
Apply Copilot suggested change
Menelion Nov 8, 2025
9c2e33e
Fix SFTP connection for chrooted servers in CI
claude Nov 8, 2025
51a313e
Implement comprehensive chroot support for SFTP
claude Nov 8, 2025
f017908
Fix CA1866: Use char literal instead of string in StartsWith
claude Nov 8, 2025
9449715
Trigger CI rebuild - CA1866 fix already applied
claude Nov 8, 2025
96984af
Fix SFTP test root for chrooted CI environment
claude Nov 8, 2025
baa15aa
Fix SFTP chroot detection and CI test root
claude Nov 8, 2025
8c23d23
Fix SFTP MoveAsync failure when creating root directory
claude Nov 8, 2025
fcb1fcc
Fix MoveAsync parent directory creation for chrooted servers
claude Nov 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ jobs:

runs-on: ubuntu-latest

services:
sftp:
image: atmoz/sftp:latest
ports:
- 2222:22
options: >-
--health-cmd "pgrep sshd"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
SFTP_USERS: testuser:testpass:1001:100:upload

steps:
- uses: actions/checkout@v5
- name: Setup .NET
Expand All @@ -28,3 +41,9 @@ jobs:
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
env:
SFTP_TEST_HOST: localhost
SFTP_TEST_PORT: 2222
SFTP_TEST_USER: testuser
SFTP_TEST_PASS: testpass
SFTP_TEST_ROOT: "upload"
77 changes: 51 additions & 26 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dotnet build

### Running Tests
```bash
# Run all tests
# Run all tests (unit tests only, integration tests skip automatically)
dotnet test

# Run tests with verbose output
Expand All @@ -32,6 +32,25 @@ dotnet test tests/SharpSync.Tests/SharpSync.Tests.csproj
dotnet test --logger trx --results-directory TestResults
```

#### Running Integration Tests
Integration tests require external services (SFTP server). Use the provided scripts:

```bash
# Linux/macOS - automatically starts Docker SFTP server
./scripts/run-integration-tests.sh

# Windows - automatically starts Docker SFTP server
.\scripts\run-integration-tests.ps1

# Or manually with Docker Compose
docker-compose -f docker-compose.test.yml up -d
export SFTP_TEST_HOST=localhost SFTP_TEST_PORT=2222 SFTP_TEST_USER=testuser SFTP_TEST_PASS=testpass SFTP_TEST_ROOT=/home/testuser/upload
dotnet test --verbosity normal
docker-compose -f docker-compose.test.yml down
```

See [TESTING.md](TESTING.md) for detailed testing documentation.

### Creating NuGet Package
```bash
# Create NuGet package
Expand All @@ -48,6 +67,8 @@ dotnet pack --configuration Release --version-suffix preview
The project uses GitHub Actions for CI/CD. The pipeline currently:
- Builds on Ubuntu only (multi-platform testing planned)
- Runs tests with format checking
- Includes SFTP integration tests using Docker-based SFTP server
- Automatically configures test environment variables for integration tests

## High-Level Architecture

Expand All @@ -66,7 +87,8 @@ SharpSync is a **pure .NET file synchronization library** with no native depende
2. **Storage Implementations** (`src/SharpSync/Storage/`)
- `LocalFileStorage` - Local filesystem operations (fully implemented and tested)
- `WebDavStorage` - WebDAV with OAuth2, chunking, and platform-specific optimizations (implemented, needs tests)
- `StorageType` enum includes: SFTP, FTP, S3 (planned for future versions)
- `SftpStorage` - SFTP with password and key-based authentication (fully implemented and tested)
- `StorageType` enum includes: FTP, S3 (planned for future versions)

3. **Authentication** (`src/SharpSync/Auth/`)
- `IOAuth2Provider` - OAuth2 authentication abstraction (no UI dependencies)
Expand All @@ -86,13 +108,14 @@ SharpSync is a **pure .NET file synchronization library** with no native depende

### Key Features

- **Multi-Protocol Support**: Local and WebDAV storage (extensible to SFTP, FTP, S3)
- **OAuth2 Authentication**: Full OAuth2 flow support without UI dependencies
- **Multi-Protocol Support**: Local, WebDAV, and SFTP storage (extensible to FTP, S3)
- **OAuth2 Authentication**: Full OAuth2 flow support without UI dependencies (WebDAV)
- **SSH Key & Password Auth**: Secure SFTP authentication with private keys or passwords
- **Smart Conflict Resolution**: Rich conflict analysis for UI integration
- **Selective Sync**: Include/exclude patterns for files and folders
- **Progress Reporting**: Real-time progress events for UI binding
- **Large File Support**: Chunked uploads with platform-specific optimizations
- **Network Resilience**: Retry logic and error handling
- **Network Resilience**: Retry logic and error handling with automatic reconnection
- **Parallel Processing**: Configurable parallelism with intelligent prioritization

### Dependencies
Expand Down Expand Up @@ -184,6 +207,7 @@ The core library is production-ready, but several critical items must be address
**Implementations**
- `SyncEngine` - 1,104 lines of production-ready sync logic with three-phase optimization
- `LocalFileStorage` - Fully implemented and tested (557 lines of tests)
- `SftpStorage` - Fully implemented with password/key auth and tested (650+ lines of tests)
- `SqliteSyncDatabase` - Complete with transaction support and tests
- `SmartConflictResolver` - Intelligent conflict analysis with tests
- `DefaultConflictResolver` - Strategy-based resolution with tests
Expand All @@ -205,17 +229,12 @@ The core library is production-ready, but several critical items must be address
- **Fix**: Complete rewrite matching actual architecture
- **File**: `/home/user/sharp-sync/README.md:1-409`

2. **False SFTP Advertising** ❌
- **Issue**: Package claims SFTP support but it's not implemented
- **Evidence**:
- `SharpSync.csproj:18` - Description claims "WebDAV, SFTP, and local storage"
- `SharpSync.csproj:25` - Tags include "sftp"
- `SharpSync.csproj:40` - SSH.NET 2025.1.0 dependency included but unused
- `StorageType.cs:20` - Sftp enum exists with no implementation
- **Impact**: False advertising, wasted package size (~500KB for SSH.NET)
- **Fix Options**:
- **Option A (Recommended)**: Remove SFTP claims and SSH.NET dependency
- **Option B**: Implement `SftpStorage` (delays release significantly)
2. **~~False SFTP Advertising~~** ✅ **FIXED**
- **Status**: SFTP is now fully implemented with comprehensive tests
- **Implementation**: `SftpStorage` class with password and key-based authentication
- **Tests**: 650+ lines of unit and integration tests
- **SSH.NET dependency**: Now properly utilized (version 2025.1.0)
- **Result**: Package metadata is now accurate

3. **WebDavStorage Completely Untested** ❌
- **Issue**: 812 lines of critical WebDAV code has zero test coverage
Expand Down Expand Up @@ -253,19 +272,20 @@ The core library is production-ready, but several critical items must be address
- Add coverlet/codecov integration to CI pipeline
- Track and display test coverage badge

8. **SSH.NET Dependency Unused**
- If not implementing SFTP for v1.0, remove dependency
- Saves ~500KB in package size
8. **~~SSH.NET Dependency Unused~~** ✅ **FIXED**
- SSH.NET is now fully utilized by SftpStorage implementation
- Dependency is justified and necessary for SFTP support

9. **No Concrete OAuth2Provider Example**
- While intentionally UI-free, a console example would help users
- Show how to implement `IOAuth2Provider` for different platforms

### 🔄 CAN DEFER TO v1.1+

10. **SFTP/FTP/S3 Implementations**
- StorageType enum includes these, but they're clearly future features
- Can be added in future minor versions
10. **~~SFTP~~/FTP/S3 Implementations** (SFTP ✅ DONE)
- ✅ SFTP now fully implemented with comprehensive tests
- FTP/S3 remain future features for v1.1+
- StorageType enum prepared for future implementations

11. **Performance Benchmarks**
- BenchmarkDotNet suite for sync operations
Expand Down Expand Up @@ -301,20 +321,25 @@ The core library is production-ready, but several critical items must be address

**Minimum Acceptance Criteria:**
- ✅ Core sync engine tested (achieved)
- All storage implementations tested (WebDavStorage missing)
- ⚠️ All storage implementations tested (LocalFileStorage ✅, SftpStorage ✅, WebDavStorage )
- ❌ README matches actual API (completely wrong)
- ✅ No TODOs/FIXMEs in code (achieved)
- ❌ Examples directory exists (missing)
- ⚠️ Package metadata accurate (SFTP claims false)
- ✅ Package metadata accurate (SFTP now implemented!)
- ✅ Integration test infrastructure (Docker-based CI testing)

**Current Score: 3/9 (33%)**
**Current Score: 5/9 (56%)** - Improved from 33%!

### 🎯 Post-v1.0 Roadmap (Future Versions)

**v1.0** ✅ SFTP Implemented!
- ✅ SFTP storage implementation (DONE!)
- ✅ Integration test infrastructure with Docker (DONE!)

**v1.1**
- SFTP storage implementation
- Code coverage reporting
- Performance benchmarks
- Multi-platform CI testing (Windows, macOS)

**v1.2**
- FTP/FTPS storage implementation
Expand Down
Loading