From 696a1e0621f43cf0a1ed1190e72c9fa624819f2c Mon Sep 17 00:00:00 2001 From: fxstein <773967+fxstein@users.noreply.github.com> Date: Sat, 28 Jun 2025 16:44:34 +0200 Subject: [PATCH 1/7] feat: implement git-flow Phase 1 - preparation and documentation (refs #20) --- .github/workflows/release-channels.yml | 101 ++++++++ .github/workflows/test.yml | 5 +- CONTRIBUTING.md | 151 +++++++++++ docs/git-flow/GIT_FLOW_GUIDE.md | 333 +++++++++++++++++++++++++ 4 files changed, 587 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release-channels.yml create mode 100644 docs/git-flow/GIT_FLOW_GUIDE.md diff --git a/.github/workflows/release-channels.yml b/.github/workflows/release-channels.yml new file mode 100644 index 0000000..35a5038 --- /dev/null +++ b/.github/workflows/release-channels.yml @@ -0,0 +1,101 @@ +name: Multi-Channel Release Management + +on: + push: + branches: [main, develop, release/*] + release: + types: [published] + +jobs: + latest-build: + if: github.ref == 'refs/heads/develop' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup zsh + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install dependencies + run: | + brew install zsh exiftool jq yamllint + + - name: Run tests + run: | + ./scripts/testing/run-tests.zsh + + - name: Update Homebrew Latest Channel + env: + HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }} + run: | + # Update goprox@latest formula + ./scripts/release/update-homebrew-channel.zsh latest + + beta-release: + if: startsWith(github.ref, 'refs/heads/release/') + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup zsh + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install dependencies + run: | + brew install zsh exiftool jq yamllint + + - name: Run tests + run: | + ./scripts/testing/run-tests.zsh + + - name: Update Homebrew Beta Channel + env: + HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }} + run: | + # Update goprox@beta formula + ./scripts/release/update-homebrew-channel.zsh beta + + official-release: + if: github.event_name == 'release' && github.event.action == 'published' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup zsh + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install dependencies + run: | + brew install zsh exiftool jq yamllint + + - name: Run tests + run: | + ./scripts/testing/run-tests.zsh + + - name: Update Homebrew Official Channel + env: + HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }} + run: | + # Update goprox formula (official) + ./scripts/release/update-homebrew-channel.zsh official + + channel-validation: + if: always() + runs-on: ubuntu-latest + needs: [latest-build, beta-release, official-release] + steps: + - name: Validate Channel Updates + run: | + echo "Channel update validation completed" + echo "Latest build: ${{ needs.latest-build.result }}" + echo "Beta release: ${{ needs.beta-release.result }}" + echo "Official release: ${{ needs.official-release.result }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8e962d..c1de12a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,7 @@ name: "Comprehensive Testing" on: pull_request: + branches: [main, develop] paths-ignore: - "docs/**" - "*.md" @@ -9,9 +10,7 @@ on: - "!scripts/testing/test-suites.zsh" - "!scripts/testing/run-tests.zsh" push: - branches: - - main - - develop + branches: [main, develop, feature/*, release/*, hotfix/*] paths: - 'scripts/core/logger.zsh' - 'scripts/testing/test-suites.zsh' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df6e88d..96581e4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,6 +39,157 @@ Thank you for your interest in contributing to GoProX! This document outlines th - Update or add documentation for any new features, changes, or scripts. - Use zsh code blocks for shell script examples. +## 🌿 Git-Flow Workflow + +GoProX uses a git-flow workflow to ensure code quality, collaboration, and structured releases. This workflow supports both development and multi-channel release management. + +### Branch Structure + +**Main Branches:** +- `main` - Production-ready code, official releases +- `develop` - Integration branch for features and development + +**Supporting Branches:** +- `feature/*` - New features and enhancements +- `release/*` - Release preparation and testing +- `hotfix/*` - Critical bug fixes for production + +### Branch Naming Conventions + +**Feature Branches:** +```zsh +feature/issue-XX-descriptive-name +feature/67-enhanced-default-behavior +feature/70-architecture-design-principles +``` + +**Release Branches:** +```zsh +release/01.11.00 +release/01.12.00 +``` + +**Hotfix Branches:** +```zsh +hotfix/critical-bug-fix +hotfix/security-patch +``` + +### Development Workflow + +**1. Starting a New Feature:** +```zsh +# Ensure you're on develop branch +git checkout develop +git pull origin develop + +# Create feature branch +git checkout -b feature/issue-XX-descriptive-name + +# Make your changes, commit frequently +git add . +git commit -m "feat: add new feature (refs #XX)" + +# Push feature branch +git push -u origin feature/issue-XX-descriptive-name +``` + +**2. Completing a Feature:** +```zsh +# Create pull request to develop branch +# Ensure all CI checks pass +# Get code review and approval +# Merge to develop +``` + +**3. Creating a Release:** +```zsh +# Create release branch from develop +git checkout develop +git pull origin develop +git checkout -b release/01.11.00 + +# Update version, documentation, release notes +# Test thoroughly +# Create pull request to main +``` + +**4. Hotfix Process:** +```zsh +# Create hotfix branch from main +git checkout main +git pull origin main +git checkout -b hotfix/critical-fix + +# Fix the issue +git commit -m "fix: critical bug fix (refs #XX)" + +# Create pull request to main AND develop +``` + +### Multi-Channel Release Support + +GoProX supports three release channels for Homebrew packages: + +**1. Latest Build Channel (develop branch):** +```zsh +brew install fxstein/tap/goprox@latest +``` +- Development builds, updated on every develop push +- For developers and early adopters + +**2. Beta Channel (release branches):** +```zsh +brew install fxstein/tap/goprox@beta +``` +- Pre-release testing, updated on release branch changes +- For beta testers and advanced users + +**3. Official Channel (main branch):** +```zsh +brew install fxstein/tap/goprox +``` +- Stable production releases, updated on official releases +- For general users and production environments + +### Pull Request Process + +**Standard Feature PR:** +1. Create feature branch from develop +2. Implement feature with tests +3. Create pull request to develop +4. Require code review and CI checks +5. Merge after approval + +**Release PR:** +1. Create release branch from develop +2. Update version and documentation +3. Create pull request to main +4. Require code review and CI checks +5. Merge to main and tag release +6. Merge back to develop + +**Hotfix PR:** +1. Create hotfix branch from main +2. Fix the critical issue +3. Create pull request to main AND develop +4. Require code review and CI checks +5. Merge to both branches + +### Code Review Requirements + +- All pull requests require at least one review +- CI checks must pass before merging +- Code must follow project standards and design principles +- Tests must be included for new features +- Documentation must be updated + +### Branch Protection + +- `main` branch: Requires PR reviews, CI checks, up-to-date branches +- `develop` branch: Requires PR reviews, CI checks, allows force pushes for admins +- Feature branches: No restrictions, but CI checks run automatically + ## 📝 Commit Message Guidelines - Use imperative mood (e.g., "add feature", "fix bug"). diff --git a/docs/git-flow/GIT_FLOW_GUIDE.md b/docs/git-flow/GIT_FLOW_GUIDE.md new file mode 100644 index 0000000..b081a45 --- /dev/null +++ b/docs/git-flow/GIT_FLOW_GUIDE.md @@ -0,0 +1,333 @@ +# Git-Flow Training Guide for GoProX + +> **Reference:** This guide supports [GitHub Issue #20: Git-flow Implementation](https://github.com/fxstein/GoProX/issues/20) + +This guide provides comprehensive training materials for the git-flow workflow implementation in the GoProX project, including multi-channel release support. + +## Overview + +Git-flow is a branching model that provides a robust framework for managing larger projects. It's particularly well-suited for projects with scheduled release cycles and multiple contributors. + +### Key Benefits for GoProX + +- **Structured Development**: Clear separation between development and production code +- **Release Management**: Organized process for preparing and releasing software +- **Hotfix Support**: Quick fixes for production issues without disrupting development +- **Multi-Channel Releases**: Support for development, beta, and production channels +- **Code Quality**: Enforced review process and CI/CD integration + +## Branch Structure + +``` +main (production) +├── develop (integration) +│ ├── feature/issue-67-enhanced-default-behavior +│ ├── feature/issue-70-architecture-design-principles +│ └── feature/issue-XX-descriptive-name +├── release/01.11.00 (release preparation) +└── hotfix/critical-fix (production fixes) +``` + +### Branch Purposes + +**Main Branches:** +- `main` - Contains production-ready code, tagged releases +- `develop` - Integration branch for features, development builds + +**Supporting Branches:** +- `feature/*` - New features and enhancements +- `release/*` - Release preparation and testing +- `hotfix/*` - Critical bug fixes for production + +## Development Workflow + +### 1. Feature Development + +**Starting a New Feature:** +```zsh +# Ensure you're on develop and it's up to date +git checkout develop +git pull origin develop + +# Create feature branch +git checkout -b feature/issue-XX-descriptive-name + +# Make your changes +# ... work on feature ... + +# Commit frequently with clear messages +git add . +git commit -m "feat: add new feature (refs #XX)" + +# Push feature branch +git push -u origin feature/issue-XX-descriptive-name +``` + +**Completing a Feature:** +```zsh +# Create pull request to develop branch +# Ensure all CI checks pass +# Get code review and approval +# Merge to develop + +# Clean up feature branch +git checkout develop +git pull origin develop +git branch -d feature/issue-XX-descriptive-name +git push origin --delete feature/issue-XX-descriptive-name +``` + +### 2. Release Preparation + +**Creating a Release:** +```zsh +# Start from develop +git checkout develop +git pull origin develop + +# Create release branch +git checkout -b release/01.11.00 + +# Update version numbers, documentation, release notes +# Test thoroughly +# Fix any last-minute issues + +# Create pull request to main +# Get review and approval +# Merge to main and tag release +git checkout main +git merge release/01.11.00 +git tag -a v01.11.00 -m "Release version 01.11.00" +git push origin main --tags + +# Merge back to develop +git checkout develop +git merge release/01.11.00 +git push origin develop + +# Clean up release branch +git branch -d release/01.11.00 +git push origin --delete release/01.11.00 +``` + +### 3. Hotfix Process + +**Creating a Hotfix:** +```zsh +# Start from main (production) +git checkout main +git pull origin main + +# Create hotfix branch +git checkout -b hotfix/critical-fix + +# Fix the issue +# ... make minimal changes to fix the problem ... + +# Commit the fix +git add . +git commit -m "fix: critical bug fix (refs #XX)" + +# Create pull request to main AND develop +# Get review and approval +# Merge to main first +git checkout main +git merge hotfix/critical-fix +git tag -a v01.11.01 -m "Hotfix version 01.11.01" +git push origin main --tags + +# Then merge to develop +git checkout develop +git merge hotfix/critical-fix +git push origin develop + +# Clean up hotfix branch +git branch -d hotfix/critical-fix +git push origin --delete hotfix/critical-fix +``` + +## Multi-Channel Release Management + +### Release Channels + +**1. Latest Build Channel (develop branch):** +- **Installation**: `brew install fxstein/tap/goprox@latest` +- **Source**: `develop` branch +- **Update Frequency**: On every develop push +- **Audience**: Developers, early adopters +- **Stability**: Development quality, may contain bugs + +**2. Beta Channel (release branches):** +- **Installation**: `brew install fxstein/tap/goprox@beta` +- **Source**: `release/*` branches +- **Update Frequency**: On release branch creation and updates +- **Audience**: Beta testers, advanced users +- **Stability**: Release candidate quality, feature complete + +**3. Official Channel (main branch):** +- **Installation**: `brew install fxstein/tap/goprox` +- **Source**: `main` branch (tagged releases) +- **Update Frequency**: On official releases only +- **Audience**: General users, production environments +- **Stability**: Production quality, thoroughly tested + +### Channel Switching + +**Upgrading Between Channels:** +```zsh +# Switch from official to beta +brew uninstall fxstein/tap/goprox +brew install fxstein/tap/goprox@beta + +# Switch from beta to latest +brew uninstall fxstein/tap/goprox@beta +brew install fxstein/tap/goprox@latest + +# Downgrade from latest to official +brew uninstall fxstein/tap/goprox@latest +brew install fxstein/tap/goprox +``` + +## Best Practices + +### Commit Messages + +- Use conventional commit format: `type: description (refs #XX)` +- Types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore` +- Reference issues using `(refs #XX)` format +- Keep descriptions clear and concise + +**Examples:** +```zsh +git commit -m "feat: add enhanced SD card detection (refs #63)" +git commit -m "fix: resolve firmware download issue (refs #60)" +git commit -m "docs: update installation guide (refs #20)" +``` + +### Branch Naming + +- **Feature branches**: `feature/issue-XX-descriptive-name` +- **Release branches**: `release/01.11.00` +- **Hotfix branches**: `hotfix/critical-fix` + +### Code Review Process + +1. **Create Pull Request**: Target the appropriate branch +2. **CI Checks**: Ensure all automated tests pass +3. **Code Review**: Get at least one approval +4. **Merge**: Only after all checks pass and review is approved + +### Testing Requirements + +- All features must include tests +- Run test suite before creating pull request +- Ensure CI/CD pipeline passes +- Test on multiple platforms if applicable + +## Common Scenarios + +### Scenario 1: New Feature Development + +1. Create feature branch from develop +2. Implement feature with tests +3. Create pull request to develop +4. Get review and approval +5. Merge to develop +6. Clean up feature branch + +### Scenario 2: Release Preparation + +1. Create release branch from develop +2. Update version and documentation +3. Test thoroughly +4. Create pull request to main +5. Get review and approval +6. Merge to main and tag release +7. Merge back to develop +8. Clean up release branch + +### Scenario 3: Critical Bug Fix + +1. Create hotfix branch from main +2. Fix the issue with minimal changes +3. Create pull request to main AND develop +4. Get review and approval +5. Merge to main first, then develop +6. Tag hotfix release +7. Clean up hotfix branch + +## Troubleshooting + +### Merge Conflicts + +**Resolving Conflicts:** +```zsh +# During merge, conflicts will be marked +git status # See conflicted files +# Edit files to resolve conflicts +git add . # Mark conflicts as resolved +git commit # Complete the merge +``` + +### Branch Cleanup + +**Cleaning Up Old Branches:** +```zsh +# Delete local branch +git branch -d branch-name + +# Delete remote branch +git push origin --delete branch-name + +# List all branches +git branch -a + +# Clean up remote tracking branches +git remote prune origin +``` + +### Emergency Rollback + +**Rolling Back a Release:** +```zsh +# Create hotfix from previous tag +git checkout main +git checkout -b hotfix/rollback-v01.11.00 +git revert v01.11.00 +git commit -m "revert: rollback to previous version (refs #XX)" +# Follow hotfix process +``` + +## Integration with CI/CD + +### Automated Workflows + +- **Feature branches**: Run tests and linting +- **Release branches**: Run full test suite and release preparation +- **Main branch**: Run production deployment and Homebrew updates + +### Required Checks + +- YAML linting +- Shell script validation +- Test suite execution +- Documentation validation +- Multi-channel Homebrew updates + +## Next Steps + +1. **Practice**: Create test branches and practice the workflow +2. **Review**: Review this guide with the team +3. **Implementation**: Begin using git-flow for new features +4. **Monitoring**: Track success metrics and adjust as needed + +## Resources + +- [Git-Flow Implementation Plan](../feature-planning/issue-20-git-flow-model/GIT_FLOW_IMPLEMENTATION_PLAN.md) +- [CONTRIBUTING.md](../../CONTRIBUTING.md) +- [AI_INSTRUCTIONS.md](../../AI_INSTRUCTIONS.md) +- [Design Principles](../architecture/DESIGN_PRINCIPLES.md) + +--- + +*This guide should be updated as the git-flow implementation evolves and team feedback is incorporated.* \ No newline at end of file From 05332a69cb90d703325634a753670b52c30903c0 Mon Sep 17 00:00:00 2001 From: fxstein Date: Sat, 28 Jun 2025 17:06:44 +0200 Subject: [PATCH 2/7] test: git-flow implementation and CI/CD validation (#74) * test: create git-flow test branch and file (refs #20) * fix: use apt instead of brew for Ubuntu runners in release-channels workflow (refs #20) * test: verify CI/CD fix for Ubuntu runners (refs #20) * test: trigger CI/CD workflow (refs #20) * fix: add missing dependencies to logger test job (refs #20) * test: trigger CI/CD with fixed dependencies (refs #20) --------- Co-authored-by: fxstein <773967+fxstein@users.noreply.github.com> --- .github/workflows/release-channels.yml | 12 +++++++++--- .github/workflows/test.yml | 2 +- docs/git-flow/TEST_BRANCH.md | 2 ++ scripts/testing/run-tests.zsh | 3 ++- 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 docs/git-flow/TEST_BRANCH.md diff --git a/.github/workflows/release-channels.yml b/.github/workflows/release-channels.yml index 35a5038..5a0ae01 100644 --- a/.github/workflows/release-channels.yml +++ b/.github/workflows/release-channels.yml @@ -21,7 +21,9 @@ jobs: - name: Install dependencies run: | - brew install zsh exiftool jq yamllint + sudo apt-get update + sudo apt-get install -y zsh exiftool jq python3-pip + pip3 install yamllint - name: Run tests run: | @@ -48,7 +50,9 @@ jobs: - name: Install dependencies run: | - brew install zsh exiftool jq yamllint + sudo apt-get update + sudo apt-get install -y zsh exiftool jq python3-pip + pip3 install yamllint - name: Run tests run: | @@ -75,7 +79,9 @@ jobs: - name: Install dependencies run: | - brew install zsh exiftool jq yamllint + sudo apt-get update + sudo apt-get install -y zsh exiftool jq python3-pip + pip3 install yamllint - name: Run tests run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1de12a..40743bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -157,7 +157,7 @@ jobs: - name: "Install dependencies" run: | sudo apt-get update - sudo apt-get install -y zsh + sudo apt-get install -y zsh exiftool jq - name: "Make test scripts executable" run: | diff --git a/docs/git-flow/TEST_BRANCH.md b/docs/git-flow/TEST_BRANCH.md new file mode 100644 index 0000000..835a9d9 --- /dev/null +++ b/docs/git-flow/TEST_BRANCH.md @@ -0,0 +1,2 @@ +# Git-flow test branch for issue #20 +# Test commit to verify CI/CD fix diff --git a/scripts/testing/run-tests.zsh b/scripts/testing/run-tests.zsh index edcbd48..3b8d9d3 100755 --- a/scripts/testing/run-tests.zsh +++ b/scripts/testing/run-tests.zsh @@ -294,4 +294,5 @@ function main() { } # Run main function with all arguments -main "$@" \ No newline at end of file +main "$@" # Test commit to trigger CI/CD +# Test commit to trigger CI/CD with fixed dependencies From 15898c79ec2819b1166ca72d346a375077d90864 Mon Sep 17 00:00:00 2001 From: fxstein <773967+fxstein@users.noreply.github.com> Date: Sat, 28 Jun 2025 17:12:33 +0200 Subject: [PATCH 3/7] chore: bump version to 01.11.00 for release (refs #20) --- goprox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goprox b/goprox index e0d6474..41caea9 100755 --- a/goprox +++ b/goprox @@ -34,7 +34,7 @@ fi __author__='Oliver Ratzesberger ' __copyright__='Copyright (C) 2021-2025 Oliver Ratzesberger' __license__='MIT' -__version__='01.10.00' +__version__='01.11.00' __github__='https://github.com/fxstein/GoProX' __this__=$(basename $0) From 0d260dfd6b3a6074aec6afade8eac448ab3605b4 Mon Sep 17 00:00:00 2001 From: fxstein <773967+fxstein@users.noreply.github.com> Date: Sun, 29 Jun 2025 00:02:13 +0200 Subject: [PATCH 4/7] fix: correct goprox script paths in test suites (refs #20) --- scripts/testing/enhanced-test-suites.zsh | 10 ++++++---- scripts/testing/test-suites.zsh | 12 ++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/testing/enhanced-test-suites.zsh b/scripts/testing/enhanced-test-suites.zsh index c1a1cc3..cc25e75 100755 --- a/scripts/testing/enhanced-test-suites.zsh +++ b/scripts/testing/enhanced-test-suites.zsh @@ -353,9 +353,9 @@ function test_storage_cleanup() { ## Error Handling Tests function test_error_invalid_source() { - # Test handling of invalid source + # Test error handling by trying to access non-existent file local output - output=$(../goprox --source "/nonexistent/path" --library "./test-lib" 2>&1) + output=$(./goprox --source "/nonexistent/path" --library "./test-lib" 2>&1) # Should handle the error gracefully assert_exit_code 1 "$?" "Should exit with error code for non-existent source" @@ -364,12 +364,14 @@ function test_error_invalid_source() { } function test_error_invalid_library() { - # Test handling of invalid library + # Test error handling by trying to access non-existent library local output - output=$(../goprox --library "/nonexistent/path" --import 2>&1) + output=$(./goprox --library "/nonexistent/path" --import 2>&1) # Should handle the error gracefully assert_exit_code 1 "$?" "Should exit with error code for non-existent library" + + cleanup_test_files "test-lib" } function test_error_missing_dependencies() { diff --git a/scripts/testing/test-suites.zsh b/scripts/testing/test-suites.zsh index 506933f..c5f0100 100755 --- a/scripts/testing/test-suites.zsh +++ b/scripts/testing/test-suites.zsh @@ -231,7 +231,7 @@ mountoptions=(--archive --import --clean --firmware)' function test_params_valid_options() { # Test that valid parameter combinations work local output - output=$(../goprox --help 2>&1) + output=$(./goprox --help 2>&1) assert_exit_code 1 "$?" "Help option should exit with code 1" assert_contains "$output" "Usage:" "Help output should contain usage information" } @@ -239,7 +239,7 @@ function test_params_valid_options() { function test_params_invalid_options() { # Test that invalid options are rejected local output - output=$(../goprox --invalid-option 2>&1) + output=$(./goprox --invalid-option 2>&1) assert_exit_code 1 "$?" "Invalid option should exit with code 1" assert_contains "$output" "Unknown option" "Should show unknown option error" } @@ -247,7 +247,7 @@ function test_params_invalid_options() { function test_params_missing_required() { # Test that missing required parameters are handled local output - output=$(../goprox --import 2>&1) + output=$(./goprox --import 2>&1) assert_exit_code 1 "$?" "Missing library should exit with code 1" assert_contains "$output" "Missing library" "Should show missing library error" } @@ -255,7 +255,7 @@ function test_params_missing_required() { function test_params_help_option() { # Test help option functionality local output - output=$(../goprox -h 2>&1) + output=$(./goprox -h 2>&1) assert_exit_code 1 "$?" "Help option should exit with code 1" assert_contains "$output" "goprox - import and process" "Help should show description" } @@ -263,7 +263,7 @@ function test_params_help_option() { function test_params_version_option() { # Test version option functionality local output - output=$(../goprox --version 2>&1) + output=$(./goprox --version 2>&1) assert_exit_code 0 "$?" "Version option should exit with code 0" assert_contains "$output" "goprox v" "Version should show version string" } @@ -371,7 +371,7 @@ function test_integration_firmware_check() { function test_integration_error_handling() { # Test error handling by trying to access non-existent file local output - output=$(../goprox --source "/nonexistent/path" --library "./test-lib" 2>&1) + output=$(./goprox --source "/nonexistent/path" --library "./test-lib" 2>&1) # Should handle the error gracefully assert_exit_code 1 "$?" "Should exit with error code for non-existent source" From 3e051b71698be548e6866d08bc1cf96b865f4687 Mon Sep 17 00:00:00 2001 From: fxstein <773967+fxstein@users.noreply.github.com> Date: Sun, 29 Jun 2025 00:05:53 +0200 Subject: [PATCH 5/7] fix: improve error handling tests to properly test failure scenarios (refs #20) --- scripts/testing/enhanced-test-suites.zsh | 2 +- scripts/testing/test-suites.zsh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/testing/enhanced-test-suites.zsh b/scripts/testing/enhanced-test-suites.zsh index cc25e75..04bf9a0 100755 --- a/scripts/testing/enhanced-test-suites.zsh +++ b/scripts/testing/enhanced-test-suites.zsh @@ -355,7 +355,7 @@ function test_storage_cleanup() { function test_error_invalid_source() { # Test error handling by trying to access non-existent file local output - output=$(./goprox --source "/nonexistent/path" --library "./test-lib" 2>&1) + output=$(./goprox --source "/nonexistent/path" --library "/nonexistent/library" 2>&1) # Should handle the error gracefully assert_exit_code 1 "$?" "Should exit with error code for non-existent source" diff --git a/scripts/testing/test-suites.zsh b/scripts/testing/test-suites.zsh index c5f0100..2c3e04a 100755 --- a/scripts/testing/test-suites.zsh +++ b/scripts/testing/test-suites.zsh @@ -247,7 +247,7 @@ function test_params_invalid_options() { function test_params_missing_required() { # Test that missing required parameters are handled local output - output=$(./goprox --import 2>&1) + output=$(./goprox --import --library "" 2>&1) assert_exit_code 1 "$?" "Missing library should exit with code 1" assert_contains "$output" "Missing library" "Should show missing library error" } @@ -371,7 +371,7 @@ function test_integration_firmware_check() { function test_integration_error_handling() { # Test error handling by trying to access non-existent file local output - output=$(./goprox --source "/nonexistent/path" --library "./test-lib" 2>&1) + output=$(./goprox --source "/nonexistent/path" --library "/nonexistent/library" 2>&1) # Should handle the error gracefully assert_exit_code 1 "$?" "Should exit with error code for non-existent source" From 39d2050f836abcf8f13f12d1d3401d13f9f423ad Mon Sep 17 00:00:00 2001 From: fxstein <773967+fxstein@users.noreply.github.com> Date: Sun, 29 Jun 2025 00:49:44 +0200 Subject: [PATCH 6/7] fix: correct library validation to properly handle empty strings (refs #20) --- goprox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goprox b/goprox index 41caea9..b5cf3c3 100755 --- a/goprox +++ b/goprox @@ -1762,7 +1762,7 @@ _debug "Copyright: $copyright" _debug "GeonamesAcct: $geonamesacct" # Library is a mandatory config setting or parameter -if [ -z $library ] && [ "$test" != true ]; then +if [ -z "$library" ] && [ "$test" != true ]; then # Empty Library _error "ERROR: Missing library!" _warning "Specifying library via -l: or --library: is mandatory." From b56b4327eec1e51594dd8bcfa5fcfff04acab299 Mon Sep 17 00:00:00 2001 From: fxstein <773967+fxstein@users.noreply.github.com> Date: Sun, 29 Jun 2025 00:52:28 +0200 Subject: [PATCH 7/7] fix: handle explicit empty library parameter correctly (refs #20) --- goprox | 3 +++ 1 file changed, 3 insertions(+) diff --git a/goprox b/goprox index b5cf3c3..2b78f6e 100755 --- a/goprox +++ b/goprox @@ -1746,6 +1746,9 @@ fi if [[ -n $libraryopt ]]; then library=$libraryopt +elif [[ "$libraryopt" == "" ]]; then + # libraryopt was explicitly set to empty string + library="" fi if [[ -n $copyrightopt ]]; then