Skip to content

feat(backend): add retry logic with exponential backoff (M5-04)#28

Merged
liamstevens merged 2 commits intofeat/m5-03-log-rotationfrom
feat/m5-04-retry-logic
Dec 14, 2025
Merged

feat(backend): add retry logic with exponential backoff (M5-04)#28
liamstevens merged 2 commits intofeat/m5-03-log-rotationfrom
feat/m5-04-retry-logic

Conversation

@liamstevens
Copy link
Member

Summary

  • Add internal/backend/retry.go with retry logic for transient failures
  • Exponential backoff with configurable parameters and jitter

Retry Configuration

Setting Default Description
MaxAttempts 3 Maximum attempts (including initial)
InitialWait 1s Initial wait before first retry
MaxWait 30s Maximum wait between retries
Multiplier 2.0 Backoff multiplier
Jitter 0.1 Random jitter fraction (0-1)

Error Classification

Retryable Errors

  • Network errors (connection refused, timeout, DNS)
  • Server errors (500, 502, 503, 504)
  • Unknown errors (conservative default)

Non-Retryable Errors

  • Client errors (400, 401, 403, 404, 409)
  • Authentication failures
  • Resource not found

Usage

import "github.com/valent-au/git-los/internal/backend"

// With default config (3 attempts, 1s initial, 2x backoff)
err := backend.RetryFunc(ctx, func() error {
    return doSomething()
})

// With custom config
err := backend.Retry(ctx, backend.RetryConfig{
    MaxAttempts: 5,
    InitialWait: 500 * time.Millisecond,
    MaxWait:     10 * time.Second,
}, func() error {
    return doSomething()
})

Test plan

  • go test ./internal/backend/... - All retry tests pass
  • go test ./... - Full test suite passes
  • ~/go/bin/golangci-lint run - Lint clean
  • go build ./cmd/git-los - Builds successfully

🤖 Generated with Claude Code

liamstevens and others added 2 commits December 14, 2025 09:48
- Add internal/backend/retry.go with RetryConfig and Retry function:
  - Configurable max attempts, initial wait, max wait, multiplier
  - Exponential backoff with jitter
  - Context cancellation support

- Add IsRetryable() to classify errors:
  - Retryable: network errors, timeouts, 5xx server errors
  - Not retryable: 4xx client errors (auth, not found, etc.)

- RetryFunc convenience wrapper with default config:
  - MaxAttempts: 3
  - InitialWait: 1s
  - MaxWait: 30s
  - Multiplier: 2.0
  - Jitter: 10%

Comprehensive tests for:
- Successful retries after transient failures
- Immediate failure on non-retryable errors
- Context cancellation during retry
- Exponential backoff timing verification
- Max wait cap enforcement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(backend): add checksum verification for downloads (M5-05)

- Add internal/backend/checksum.go with:
  - VerifyingWriter: computes SHA-256 while writing
  - VerifyingReader: computes SHA-256 while reading
  - VerifyFile: verifies file matches expected OID
  - ComputeOID: computes SHA-256 OID of a file
  - ComputeOIDFromReader: computes OID from reader
  - ValidateOID: validates 64-char hex OID format

- ErrChecksumMismatch error for verification failures

- Comprehensive tests:
  - Success and mismatch cases for writer/reader
  - Chunked read/write operations
  - Empty content handling
  - File verification
  - OID validation (length, characters)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(metrics): add transfer metrics collection (M5-06) (#30)

* feat(metrics): add transfer metrics collection (M5-06)

Add metrics package for collecting and reporting transfer statistics:

- Metrics struct with atomic counters for thread-safe operation
- Upload/download tracking: total, failed, bytes, duration
- Error classification by category (auth, network, not_found, etc.)
- Histogram for latency percentile calculation (P50, P95, P99)
- Snapshot method for point-in-time metrics view
- Comprehensive test coverage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(security): add security validation utilities (M5-09) (#31)

* feat(security): add security validation utilities (M5-09)

Add security package with validation functions:

- ValidatePath: Prevent directory traversal attacks
- ValidateOID: Validate Git LFS object IDs
- VerifySocketPermissions: Check socket file permissions
- VerifySocketDirPermissions: Check socket directory permissions
- SecurePath: Sanitize path components
- IsPathWithinBase: Verify path containment

Also includes comprehensive audit tests that verify:
- Logging package properly redacts credentials
- Sensitive key names are redacted
- AWS access keys, private keys, and bearer tokens are detected
- Non-sensitive data is not redacted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(bench): add performance benchmarks (M5-10) (#32)

* test(bench): add performance benchmarks (M5-10)

Add comprehensive benchmarks for performance profiling:

internal/backend/benchmark_test.go:
- ProgressReader/Writer with small and large read/write operations
- VerifyingWriter/Reader checksum performance
- OID computation for various file sizes
- OID validation performance

internal/daemon/benchmark_test.go:
- Queue submission and stats reading
- Concurrent queue operations
- Pool GetOrCreate and concurrent access
- Socket existence check and path determination

internal/metrics/benchmark_test.go:
- Metrics recording with and without errors
- Snapshot generation performance
- Histogram recording and percentile calculation
- Concurrent metrics access
- Error classification performance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(release): add goreleaser and release workflow (M5-11) (#33)

* ci(release): add goreleaser and release workflow (M5-11)

Add automated release process:

.goreleaser.yml:
- Build binaries for Linux, macOS, and Windows (amd64 + arm64)
- Create archives with README, LICENSE, and docs
- Generate SHA-256 checksums
- Auto-generate changelog from conventional commits
- Optional Homebrew tap support

.github/workflows/release.yml:
- Trigger on version tags (v*)
- Run tests and lint before release
- Use goreleaser to build and publish
- Verify release artifacts work on Linux and macOS

To create a release:
```bash
git tag v0.1.0
git push origin v0.1.0
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add user documentation (M5-07) (#34)

Add comprehensive user documentation:

- docs/installation.md - Platform-specific installation guide
- docs/configuration.md - Backend setup and all config options
- docs/troubleshooting.md - Common issues and solutions
- docs/examples/game-dev.md - Game development workflow with binary assets
- docs/examples/ml-datasets.md - ML dataset versioning and management

Updated README.md to link to new documentation sections:
- User Guides (install, config, troubleshooting)
- Example Workflows (game-dev, ML)
- Development (contributing, dev guide)
- Specifications (existing spec docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@liamstevens liamstevens merged commit 443396d into feat/m5-03-log-rotation Dec 14, 2025
4 checks passed
liamstevens added a commit that referenced this pull request Dec 14, 2025
* feat(logging): add log rotation for daemon (M5-03)

- Add RotatingWriter in internal/logging/rotate.go:
  - Automatic rotation when file exceeds MaxSize (default 10MB)
  - Configurable MaxBackups to retain (default 3)
  - Optional gzip compression of rotated files
  - Thread-safe concurrent writes
  - Timestamp-based rotated filenames

- Add --log-file flag to daemon run/start commands:
  - When set, logs to file with automatic rotation
  - When unset, logs to stderr (existing behavior)

- Comprehensive tests for rotation scenarios:
  - Size-based rotation triggers
  - MaxBackups cleanup
  - Gzip compression verification
  - Concurrent write safety

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(backend): add retry logic with exponential backoff (M5-04) (#28)

* feat(backend): add retry logic with exponential backoff (M5-04)

- Add internal/backend/retry.go with RetryConfig and Retry function:
  - Configurable max attempts, initial wait, max wait, multiplier
  - Exponential backoff with jitter
  - Context cancellation support

- Add IsRetryable() to classify errors:
  - Retryable: network errors, timeouts, 5xx server errors
  - Not retryable: 4xx client errors (auth, not found, etc.)

- RetryFunc convenience wrapper with default config:
  - MaxAttempts: 3
  - InitialWait: 1s
  - MaxWait: 30s
  - Multiplier: 2.0
  - Jitter: 10%

Comprehensive tests for:
- Successful retries after transient failures
- Immediate failure on non-retryable errors
- Context cancellation during retry
- Exponential backoff timing verification
- Max wait cap enforcement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(backend): add checksum verification for downloads (M5-05) (#29)

* feat(backend): add checksum verification for downloads (M5-05)

- Add internal/backend/checksum.go with:
  - VerifyingWriter: computes SHA-256 while writing
  - VerifyingReader: computes SHA-256 while reading
  - VerifyFile: verifies file matches expected OID
  - ComputeOID: computes SHA-256 OID of a file
  - ComputeOIDFromReader: computes OID from reader
  - ValidateOID: validates 64-char hex OID format

- ErrChecksumMismatch error for verification failures

- Comprehensive tests:
  - Success and mismatch cases for writer/reader
  - Chunked read/write operations
  - Empty content handling
  - File verification
  - OID validation (length, characters)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(metrics): add transfer metrics collection (M5-06) (#30)

* feat(metrics): add transfer metrics collection (M5-06)

Add metrics package for collecting and reporting transfer statistics:

- Metrics struct with atomic counters for thread-safe operation
- Upload/download tracking: total, failed, bytes, duration
- Error classification by category (auth, network, not_found, etc.)
- Histogram for latency percentile calculation (P50, P95, P99)
- Snapshot method for point-in-time metrics view
- Comprehensive test coverage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(security): add security validation utilities (M5-09) (#31)

* feat(security): add security validation utilities (M5-09)

Add security package with validation functions:

- ValidatePath: Prevent directory traversal attacks
- ValidateOID: Validate Git LFS object IDs
- VerifySocketPermissions: Check socket file permissions
- VerifySocketDirPermissions: Check socket directory permissions
- SecurePath: Sanitize path components
- IsPathWithinBase: Verify path containment

Also includes comprehensive audit tests that verify:
- Logging package properly redacts credentials
- Sensitive key names are redacted
- AWS access keys, private keys, and bearer tokens are detected
- Non-sensitive data is not redacted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(bench): add performance benchmarks (M5-10) (#32)

* test(bench): add performance benchmarks (M5-10)

Add comprehensive benchmarks for performance profiling:

internal/backend/benchmark_test.go:
- ProgressReader/Writer with small and large read/write operations
- VerifyingWriter/Reader checksum performance
- OID computation for various file sizes
- OID validation performance

internal/daemon/benchmark_test.go:
- Queue submission and stats reading
- Concurrent queue operations
- Pool GetOrCreate and concurrent access
- Socket existence check and path determination

internal/metrics/benchmark_test.go:
- Metrics recording with and without errors
- Snapshot generation performance
- Histogram recording and percentile calculation
- Concurrent metrics access
- Error classification performance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(release): add goreleaser and release workflow (M5-11) (#33)

* ci(release): add goreleaser and release workflow (M5-11)

Add automated release process:

.goreleaser.yml:
- Build binaries for Linux, macOS, and Windows (amd64 + arm64)
- Create archives with README, LICENSE, and docs
- Generate SHA-256 checksums
- Auto-generate changelog from conventional commits
- Optional Homebrew tap support

.github/workflows/release.yml:
- Trigger on version tags (v*)
- Run tests and lint before release
- Use goreleaser to build and publish
- Verify release artifacts work on Linux and macOS

To create a release:
```bash
git tag v0.1.0
git push origin v0.1.0
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add user documentation (M5-07) (#34)

Add comprehensive user documentation:

- docs/installation.md - Platform-specific installation guide
- docs/configuration.md - Backend setup and all config options
- docs/troubleshooting.md - Common issues and solutions
- docs/examples/game-dev.md - Game development workflow with binary assets
- docs/examples/ml-datasets.md - ML dataset versioning and management

Updated README.md to link to new documentation sections:
- User Guides (install, config, troubleshooting)
- Example Workflows (game-dev, ML)
- Development (contributing, dev guide)
- Specifications (existing spec docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
liamstevens added a commit that referenced this pull request Dec 14, 2025
* docs: add contributing guide and development documentation (M5-08)

- Add CONTRIBUTING.md with:
  - Development setup instructions
  - Code style guidelines (error handling, logging, testing)
  - Git workflow (branching, commits, PRs)
  - Project structure overview
  - Linting and testing commands

- Add docs/development.md with:
  - Architecture overview and component details
  - Testing strategy (unit, integration, backend)
  - Debugging tips (log levels, protocol tracing, socket inspection)
  - Performance considerations
  - Security guidelines
  - Common development tasks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(logging): add log rotation for daemon (M5-03) (#27)

* feat(logging): add log rotation for daemon (M5-03)

- Add RotatingWriter in internal/logging/rotate.go:
  - Automatic rotation when file exceeds MaxSize (default 10MB)
  - Configurable MaxBackups to retain (default 3)
  - Optional gzip compression of rotated files
  - Thread-safe concurrent writes
  - Timestamp-based rotated filenames

- Add --log-file flag to daemon run/start commands:
  - When set, logs to file with automatic rotation
  - When unset, logs to stderr (existing behavior)

- Comprehensive tests for rotation scenarios:
  - Size-based rotation triggers
  - MaxBackups cleanup
  - Gzip compression verification
  - Concurrent write safety

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(backend): add retry logic with exponential backoff (M5-04) (#28)

* feat(backend): add retry logic with exponential backoff (M5-04)

- Add internal/backend/retry.go with RetryConfig and Retry function:
  - Configurable max attempts, initial wait, max wait, multiplier
  - Exponential backoff with jitter
  - Context cancellation support

- Add IsRetryable() to classify errors:
  - Retryable: network errors, timeouts, 5xx server errors
  - Not retryable: 4xx client errors (auth, not found, etc.)

- RetryFunc convenience wrapper with default config:
  - MaxAttempts: 3
  - InitialWait: 1s
  - MaxWait: 30s
  - Multiplier: 2.0
  - Jitter: 10%

Comprehensive tests for:
- Successful retries after transient failures
- Immediate failure on non-retryable errors
- Context cancellation during retry
- Exponential backoff timing verification
- Max wait cap enforcement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(backend): add checksum verification for downloads (M5-05) (#29)

* feat(backend): add checksum verification for downloads (M5-05)

- Add internal/backend/checksum.go with:
  - VerifyingWriter: computes SHA-256 while writing
  - VerifyingReader: computes SHA-256 while reading
  - VerifyFile: verifies file matches expected OID
  - ComputeOID: computes SHA-256 OID of a file
  - ComputeOIDFromReader: computes OID from reader
  - ValidateOID: validates 64-char hex OID format

- ErrChecksumMismatch error for verification failures

- Comprehensive tests:
  - Success and mismatch cases for writer/reader
  - Chunked read/write operations
  - Empty content handling
  - File verification
  - OID validation (length, characters)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(metrics): add transfer metrics collection (M5-06) (#30)

* feat(metrics): add transfer metrics collection (M5-06)

Add metrics package for collecting and reporting transfer statistics:

- Metrics struct with atomic counters for thread-safe operation
- Upload/download tracking: total, failed, bytes, duration
- Error classification by category (auth, network, not_found, etc.)
- Histogram for latency percentile calculation (P50, P95, P99)
- Snapshot method for point-in-time metrics view
- Comprehensive test coverage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(security): add security validation utilities (M5-09) (#31)

* feat(security): add security validation utilities (M5-09)

Add security package with validation functions:

- ValidatePath: Prevent directory traversal attacks
- ValidateOID: Validate Git LFS object IDs
- VerifySocketPermissions: Check socket file permissions
- VerifySocketDirPermissions: Check socket directory permissions
- SecurePath: Sanitize path components
- IsPathWithinBase: Verify path containment

Also includes comprehensive audit tests that verify:
- Logging package properly redacts credentials
- Sensitive key names are redacted
- AWS access keys, private keys, and bearer tokens are detected
- Non-sensitive data is not redacted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(bench): add performance benchmarks (M5-10) (#32)

* test(bench): add performance benchmarks (M5-10)

Add comprehensive benchmarks for performance profiling:

internal/backend/benchmark_test.go:
- ProgressReader/Writer with small and large read/write operations
- VerifyingWriter/Reader checksum performance
- OID computation for various file sizes
- OID validation performance

internal/daemon/benchmark_test.go:
- Queue submission and stats reading
- Concurrent queue operations
- Pool GetOrCreate and concurrent access
- Socket existence check and path determination

internal/metrics/benchmark_test.go:
- Metrics recording with and without errors
- Snapshot generation performance
- Histogram recording and percentile calculation
- Concurrent metrics access
- Error classification performance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(release): add goreleaser and release workflow (M5-11) (#33)

* ci(release): add goreleaser and release workflow (M5-11)

Add automated release process:

.goreleaser.yml:
- Build binaries for Linux, macOS, and Windows (amd64 + arm64)
- Create archives with README, LICENSE, and docs
- Generate SHA-256 checksums
- Auto-generate changelog from conventional commits
- Optional Homebrew tap support

.github/workflows/release.yml:
- Trigger on version tags (v*)
- Run tests and lint before release
- Use goreleaser to build and publish
- Verify release artifacts work on Linux and macOS

To create a release:
```bash
git tag v0.1.0
git push origin v0.1.0
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add user documentation (M5-07) (#34)

Add comprehensive user documentation:

- docs/installation.md - Platform-specific installation guide
- docs/configuration.md - Backend setup and all config options
- docs/troubleshooting.md - Common issues and solutions
- docs/examples/game-dev.md - Game development workflow with binary assets
- docs/examples/ml-datasets.md - ML dataset versioning and management

Updated README.md to link to new documentation sections:
- User Guides (install, config, troubleshooting)
- Example Workflows (game-dev, ML)
- Development (contributing, dev guide)
- Specifications (existing spec docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
liamstevens added a commit that referenced this pull request Dec 14, 2025
…2) (#25)

* feat(logging): add structured logging with credential redaction (M5-02)

- Add internal/logging package with configurable log level and format
- Implement credential redaction via slog ReplaceAttr:
  - Redacts sensitive key names (password, token, secret, etc.)
  - Detects AWS access key patterns (AKIA*, ASIA*, etc.)
  - Detects private key headers and bearer tokens
- Add --log-level flag to daemon run/start commands
- Add --log-format flag (json/text) to daemon commands
- Add --log-level flag to agent command
- Update daemon and agent to use new logging package

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add contributing guide and development documentation (M5-08) (#26)

* docs: add contributing guide and development documentation (M5-08)

- Add CONTRIBUTING.md with:
  - Development setup instructions
  - Code style guidelines (error handling, logging, testing)
  - Git workflow (branching, commits, PRs)
  - Project structure overview
  - Linting and testing commands

- Add docs/development.md with:
  - Architecture overview and component details
  - Testing strategy (unit, integration, backend)
  - Debugging tips (log levels, protocol tracing, socket inspection)
  - Performance considerations
  - Security guidelines
  - Common development tasks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(logging): add log rotation for daemon (M5-03) (#27)

* feat(logging): add log rotation for daemon (M5-03)

- Add RotatingWriter in internal/logging/rotate.go:
  - Automatic rotation when file exceeds MaxSize (default 10MB)
  - Configurable MaxBackups to retain (default 3)
  - Optional gzip compression of rotated files
  - Thread-safe concurrent writes
  - Timestamp-based rotated filenames

- Add --log-file flag to daemon run/start commands:
  - When set, logs to file with automatic rotation
  - When unset, logs to stderr (existing behavior)

- Comprehensive tests for rotation scenarios:
  - Size-based rotation triggers
  - MaxBackups cleanup
  - Gzip compression verification
  - Concurrent write safety

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(backend): add retry logic with exponential backoff (M5-04) (#28)

* feat(backend): add retry logic with exponential backoff (M5-04)

- Add internal/backend/retry.go with RetryConfig and Retry function:
  - Configurable max attempts, initial wait, max wait, multiplier
  - Exponential backoff with jitter
  - Context cancellation support

- Add IsRetryable() to classify errors:
  - Retryable: network errors, timeouts, 5xx server errors
  - Not retryable: 4xx client errors (auth, not found, etc.)

- RetryFunc convenience wrapper with default config:
  - MaxAttempts: 3
  - InitialWait: 1s
  - MaxWait: 30s
  - Multiplier: 2.0
  - Jitter: 10%

Comprehensive tests for:
- Successful retries after transient failures
- Immediate failure on non-retryable errors
- Context cancellation during retry
- Exponential backoff timing verification
- Max wait cap enforcement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(backend): add checksum verification for downloads (M5-05) (#29)

* feat(backend): add checksum verification for downloads (M5-05)

- Add internal/backend/checksum.go with:
  - VerifyingWriter: computes SHA-256 while writing
  - VerifyingReader: computes SHA-256 while reading
  - VerifyFile: verifies file matches expected OID
  - ComputeOID: computes SHA-256 OID of a file
  - ComputeOIDFromReader: computes OID from reader
  - ValidateOID: validates 64-char hex OID format

- ErrChecksumMismatch error for verification failures

- Comprehensive tests:
  - Success and mismatch cases for writer/reader
  - Chunked read/write operations
  - Empty content handling
  - File verification
  - OID validation (length, characters)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(metrics): add transfer metrics collection (M5-06) (#30)

* feat(metrics): add transfer metrics collection (M5-06)

Add metrics package for collecting and reporting transfer statistics:

- Metrics struct with atomic counters for thread-safe operation
- Upload/download tracking: total, failed, bytes, duration
- Error classification by category (auth, network, not_found, etc.)
- Histogram for latency percentile calculation (P50, P95, P99)
- Snapshot method for point-in-time metrics view
- Comprehensive test coverage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(security): add security validation utilities (M5-09) (#31)

* feat(security): add security validation utilities (M5-09)

Add security package with validation functions:

- ValidatePath: Prevent directory traversal attacks
- ValidateOID: Validate Git LFS object IDs
- VerifySocketPermissions: Check socket file permissions
- VerifySocketDirPermissions: Check socket directory permissions
- SecurePath: Sanitize path components
- IsPathWithinBase: Verify path containment

Also includes comprehensive audit tests that verify:
- Logging package properly redacts credentials
- Sensitive key names are redacted
- AWS access keys, private keys, and bearer tokens are detected
- Non-sensitive data is not redacted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(bench): add performance benchmarks (M5-10) (#32)

* test(bench): add performance benchmarks (M5-10)

Add comprehensive benchmarks for performance profiling:

internal/backend/benchmark_test.go:
- ProgressReader/Writer with small and large read/write operations
- VerifyingWriter/Reader checksum performance
- OID computation for various file sizes
- OID validation performance

internal/daemon/benchmark_test.go:
- Queue submission and stats reading
- Concurrent queue operations
- Pool GetOrCreate and concurrent access
- Socket existence check and path determination

internal/metrics/benchmark_test.go:
- Metrics recording with and without errors
- Snapshot generation performance
- Histogram recording and percentile calculation
- Concurrent metrics access
- Error classification performance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(release): add goreleaser and release workflow (M5-11) (#33)

* ci(release): add goreleaser and release workflow (M5-11)

Add automated release process:

.goreleaser.yml:
- Build binaries for Linux, macOS, and Windows (amd64 + arm64)
- Create archives with README, LICENSE, and docs
- Generate SHA-256 checksums
- Auto-generate changelog from conventional commits
- Optional Homebrew tap support

.github/workflows/release.yml:
- Trigger on version tags (v*)
- Run tests and lint before release
- Use goreleaser to build and publish
- Verify release artifacts work on Linux and macOS

To create a release:
```bash
git tag v0.1.0
git push origin v0.1.0
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add user documentation (M5-07) (#34)

Add comprehensive user documentation:

- docs/installation.md - Platform-specific installation guide
- docs/configuration.md - Backend setup and all config options
- docs/troubleshooting.md - Common issues and solutions
- docs/examples/game-dev.md - Game development workflow with binary assets
- docs/examples/ml-datasets.md - ML dataset versioning and management

Updated README.md to link to new documentation sections:
- User Guides (install, config, troubleshooting)
- Example Workflows (game-dev, ML)
- Development (contributing, dev guide)
- Specifications (existing spec docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
liamstevens added a commit that referenced this pull request Dec 14, 2025
* feat(errors): add user-friendly error classification (M5-01)

- Add internal/errors package with UserError type containing:
  - Error code for protocol
  - User-friendly message
  - Remediation suggestion
  - Operation and OID context

- Implement error classification functions:
  - IsAuthError: GCS/S3 credential failures
  - IsNetworkError: Connection, timeout, DNS issues
  - IsNotFoundError: Object/bucket not found
  - IsBucketError: Bucket access issues
  - IsServerError: 5xx server errors

- ClassifyError maps raw errors to UserError with suggestions
- Update backend_handler to use new error classification
- Add fieldalignment exclusion for test files in golangci.yml

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(logging): add structured logging with credential redaction (M5-02) (#25)

* feat(logging): add structured logging with credential redaction (M5-02)

- Add internal/logging package with configurable log level and format
- Implement credential redaction via slog ReplaceAttr:
  - Redacts sensitive key names (password, token, secret, etc.)
  - Detects AWS access key patterns (AKIA*, ASIA*, etc.)
  - Detects private key headers and bearer tokens
- Add --log-level flag to daemon run/start commands
- Add --log-format flag (json/text) to daemon commands
- Add --log-level flag to agent command
- Update daemon and agent to use new logging package

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add contributing guide and development documentation (M5-08) (#26)

* docs: add contributing guide and development documentation (M5-08)

- Add CONTRIBUTING.md with:
  - Development setup instructions
  - Code style guidelines (error handling, logging, testing)
  - Git workflow (branching, commits, PRs)
  - Project structure overview
  - Linting and testing commands

- Add docs/development.md with:
  - Architecture overview and component details
  - Testing strategy (unit, integration, backend)
  - Debugging tips (log levels, protocol tracing, socket inspection)
  - Performance considerations
  - Security guidelines
  - Common development tasks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(logging): add log rotation for daemon (M5-03) (#27)

* feat(logging): add log rotation for daemon (M5-03)

- Add RotatingWriter in internal/logging/rotate.go:
  - Automatic rotation when file exceeds MaxSize (default 10MB)
  - Configurable MaxBackups to retain (default 3)
  - Optional gzip compression of rotated files
  - Thread-safe concurrent writes
  - Timestamp-based rotated filenames

- Add --log-file flag to daemon run/start commands:
  - When set, logs to file with automatic rotation
  - When unset, logs to stderr (existing behavior)

- Comprehensive tests for rotation scenarios:
  - Size-based rotation triggers
  - MaxBackups cleanup
  - Gzip compression verification
  - Concurrent write safety

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(backend): add retry logic with exponential backoff (M5-04) (#28)

* feat(backend): add retry logic with exponential backoff (M5-04)

- Add internal/backend/retry.go with RetryConfig and Retry function:
  - Configurable max attempts, initial wait, max wait, multiplier
  - Exponential backoff with jitter
  - Context cancellation support

- Add IsRetryable() to classify errors:
  - Retryable: network errors, timeouts, 5xx server errors
  - Not retryable: 4xx client errors (auth, not found, etc.)

- RetryFunc convenience wrapper with default config:
  - MaxAttempts: 3
  - InitialWait: 1s
  - MaxWait: 30s
  - Multiplier: 2.0
  - Jitter: 10%

Comprehensive tests for:
- Successful retries after transient failures
- Immediate failure on non-retryable errors
- Context cancellation during retry
- Exponential backoff timing verification
- Max wait cap enforcement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(backend): add checksum verification for downloads (M5-05) (#29)

* feat(backend): add checksum verification for downloads (M5-05)

- Add internal/backend/checksum.go with:
  - VerifyingWriter: computes SHA-256 while writing
  - VerifyingReader: computes SHA-256 while reading
  - VerifyFile: verifies file matches expected OID
  - ComputeOID: computes SHA-256 OID of a file
  - ComputeOIDFromReader: computes OID from reader
  - ValidateOID: validates 64-char hex OID format

- ErrChecksumMismatch error for verification failures

- Comprehensive tests:
  - Success and mismatch cases for writer/reader
  - Chunked read/write operations
  - Empty content handling
  - File verification
  - OID validation (length, characters)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(metrics): add transfer metrics collection (M5-06) (#30)

* feat(metrics): add transfer metrics collection (M5-06)

Add metrics package for collecting and reporting transfer statistics:

- Metrics struct with atomic counters for thread-safe operation
- Upload/download tracking: total, failed, bytes, duration
- Error classification by category (auth, network, not_found, etc.)
- Histogram for latency percentile calculation (P50, P95, P99)
- Snapshot method for point-in-time metrics view
- Comprehensive test coverage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(security): add security validation utilities (M5-09) (#31)

* feat(security): add security validation utilities (M5-09)

Add security package with validation functions:

- ValidatePath: Prevent directory traversal attacks
- ValidateOID: Validate Git LFS object IDs
- VerifySocketPermissions: Check socket file permissions
- VerifySocketDirPermissions: Check socket directory permissions
- SecurePath: Sanitize path components
- IsPathWithinBase: Verify path containment

Also includes comprehensive audit tests that verify:
- Logging package properly redacts credentials
- Sensitive key names are redacted
- AWS access keys, private keys, and bearer tokens are detected
- Non-sensitive data is not redacted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(bench): add performance benchmarks (M5-10) (#32)

* test(bench): add performance benchmarks (M5-10)

Add comprehensive benchmarks for performance profiling:

internal/backend/benchmark_test.go:
- ProgressReader/Writer with small and large read/write operations
- VerifyingWriter/Reader checksum performance
- OID computation for various file sizes
- OID validation performance

internal/daemon/benchmark_test.go:
- Queue submission and stats reading
- Concurrent queue operations
- Pool GetOrCreate and concurrent access
- Socket existence check and path determination

internal/metrics/benchmark_test.go:
- Metrics recording with and without errors
- Snapshot generation performance
- Histogram recording and percentile calculation
- Concurrent metrics access
- Error classification performance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(release): add goreleaser and release workflow (M5-11) (#33)

* ci(release): add goreleaser and release workflow (M5-11)

Add automated release process:

.goreleaser.yml:
- Build binaries for Linux, macOS, and Windows (amd64 + arm64)
- Create archives with README, LICENSE, and docs
- Generate SHA-256 checksums
- Auto-generate changelog from conventional commits
- Optional Homebrew tap support

.github/workflows/release.yml:
- Trigger on version tags (v*)
- Run tests and lint before release
- Use goreleaser to build and publish
- Verify release artifacts work on Linux and macOS

To create a release:
```bash
git tag v0.1.0
git push origin v0.1.0
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add user documentation (M5-07) (#34)

Add comprehensive user documentation:

- docs/installation.md - Platform-specific installation guide
- docs/configuration.md - Backend setup and all config options
- docs/troubleshooting.md - Common issues and solutions
- docs/examples/game-dev.md - Game development workflow with binary assets
- docs/examples/ml-datasets.md - ML dataset versioning and management

Updated README.md to link to new documentation sections:
- User Guides (install, config, troubleshooting)
- Example Workflows (game-dev, ML)
- Development (contributing, dev guide)
- Specifications (existing spec docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <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.

1 participant