Skip to content

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

Merged
liamstevens merged 2 commits intofeat/m5-08-contributing-guidefrom
feat/m5-03-log-rotation
Dec 14, 2025
Merged

feat(logging): add log rotation for daemon (M5-03)#27
liamstevens merged 2 commits intofeat/m5-08-contributing-guidefrom
feat/m5-03-log-rotation

Conversation

@liamstevens
Copy link
Member

Summary

  • Add RotatingWriter in internal/logging/rotate.go for automatic log file rotation
  • Add --log-file flag to daemon run and start commands

Features

Log Rotation

Setting Default Description
MaxSize 10MB Maximum size before rotation
MaxBackups 3 Number of old files to retain
Compress true Gzip rotated files

CLI Flags

# Log to file with automatic rotation
git-los daemon run --log-file /var/log/git-los.log

# Start in background with file logging
git-los daemon start --log-file ~/.cache/git-los/daemon.log

Rotation Behavior

  • Files rotate when exceeding MaxSize
  • Rotated files named with timestamp: file.log.20240115-143022
  • Compressed files end with .gz if Compress is enabled
  • Old files beyond MaxBackups are automatically cleaned up

Test plan

  • go test ./internal/logging/... - All rotation 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:45
- 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)

- 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>
@liamstevens liamstevens merged commit bf0df5d into feat/m5-08-contributing-guide Dec 14, 2025
4 checks passed
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