Conversation
- Implement tests for CheckForUpdate function to verify behavior for different version scenarios including success, dev version, unknown version, and timeout. - Introduce tests for GithubRelease struct to ensure proper JSON unmarshalling. - Enhance version tests to check output string for both dev and release versions. - Create tests for workspace removal functions, ensuring repositories can be added and removed correctly from state and configuration. - Add tests for repository management functions, including checking existence and retrieval of repositories. - Implement tests for workspace status retrieval, including scenarios with cloned repositories and worktrees. - Validate workspace name and path length with comprehensive test cases. - Introduce parallel execution tests to ensure correct handling of multiple repositories. - Add tests for worktree management, verifying existence and retrieval of worktrees.
…tionalities in CLI
… sync functionalities in CLI
…ding, removing, and checking repositories
…nd pull operations
…val, and switching
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive test coverage for workspace synchronization operations, state management, and CLI worktree commands in the FoundAgent project. The tests cover sync operations (pull, push, fetch), state file handling, repository management, and CLI switch/remove commands with both normal and edge case scenarios.
Key changes:
- Added extensive test coverage for workspace sync operations including pull, push, and status detection
- Implemented tests for state file persistence, loading, and error handling
- Added tests for repository removal and worktree management
- Enhanced test coverage for version checking and update functionality
- Fixed workspace file consistency checking to properly handle repository paths
Reviewed changes
Copilot reviewed 95 out of 102 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/workspace/sync_test.go | Tests for sync summary calculation, result formatting, and basic sync operations |
| internal/workspace/sync_status_test.go | Tests for pull/push operations with various states and error conditions |
| internal/workspace/sync_real_test.go | Integration tests using real git repositories for detached HEAD, dirty worktrees, and conflicts |
| internal/workspace/sync_extended_test.go | Extended tests for sync operations with verbose mode and edge cases |
| internal/workspace/sync_coverage_test.go | Additional coverage tests for pull/push operations and workspace creation |
| internal/workspace/status_test.go | Tests for workspace status retrieval and validation |
| internal/workspace/state_test.go | Tests for state file loading, saving, and round-trip persistence |
| internal/workspace/state_coverage_test.go | Additional state management tests including error scenarios |
| internal/workspace/repository_test.go | Tests for repository path generation and management operations |
| internal/workspace/removal_test.go | Tests for repository removal from state, config, and workspace files |
| internal/workspace/removal_coverage_test.go | Comprehensive removal operation tests with error handling |
| internal/workspace/removal.go | Fixed config load/save to use workspace path instead of config path |
| internal/workspace/push_coverage_test.go | Tests for push operations with various repository states |
| internal/workspace/pull_coverage_test.go | Comprehensive pull operation tests including stash scenarios |
| internal/workspace/create_coverage_test.go | Tests for workspace creation with error conditions |
| internal/workspace/config_test.go | Tests for deprecated SaveConfig functionality |
| internal/version/version_test.go | Enhanced version string tests for dev and release versions |
| internal/version/update_test.go | Basic update checking tests with mock server scenarios |
| internal/version/update_mock_test.go | Comprehensive mock server tests for update checking |
| internal/version/update_coverage_test.go | Additional update check tests with version comparison |
| internal/version/update.go | Made ReleaseURL variable for testability |
| internal/output/json_test.go | Tests for JSON output formatting and error handling |
| internal/git/worktree_test.go | Tests for git worktree operations (add, remove, list) |
| internal/git/worktree.go | Fixed worktree list parsing to use strings.Split instead of filepath.SplitList |
| internal/git/status_test.go | Tests for git status detection and file tracking |
| internal/git/stash_test.go | Tests for git stash operations |
| internal/git/remote_test.go | Tests for git remote operations (fetch, pull, push) |
| internal/git/coverage_test.go | Additional git operation tests |
| internal/git/clone_test.go | Tests for git clone operations |
| internal/git/branch_test.go | Tests for git branch operations |
| internal/errors/error_test.go | Tests for error wrapping and unwrapping |
| internal/doctor/worktrees_test.go | Tests for worktree integrity checks |
| internal/doctor/repos_test.go | Tests for repository integrity checks |
| internal/doctor/fix_test.go | Tests for automatic fix functionality |
| internal/doctor/consistency_test.go | Tests for workspace file consistency checking |
| internal/doctor/consistency.go | Fixed worktree path parsing in consistency checks |
| internal/doctor/checks_test.go | Tests for various health checks |
| internal/config/template_test.go | Tests for config template operations |
| internal/config/config_test.go | Additional config tests for error handling |
| internal/cli/wt_switch_test.go | Tests for worktree switch command |
| internal/cli/wt_switch_run_test.go | Additional switch command tests |
| internal/cli/wt_remove_validation_test.go | Validation tests for remove command |
| internal/cli/wt_remove_test.go | Tests for worktree remove command |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
|
@copilot address PR comments |
Contributor
…checker Co-authored-by: jcleigh <12815554+jcleigh@users.noreply.github.com>
Address PR review comments: fix path parsing safety and improve dependency injection
…-tests' into fix-consistency-add-tests
- Fix gofmt formatting across test files - Fix ineffassign issues in doctor_test.go and remote_test.go - Update .golangci.yml to exclude goconst from test files - Add exclusions for status strings and doctor check names - Add gocyclo exclusion for consistency.go
- Add explicit fetch before pull in TestPull - Add explicit push to 'origin main' instead of just 'push' - Add verification that remote has the commit before proceeding - Add verification that origin/main is updated after fetch - Add better error output for debugging CI failures
When cloning from bare repo, different systems may default to different branch names. Use 'git checkout -B main origin/main' to ensure the cloned repo is on the main branch before making commits and pushing.
- Change Go version from 1.25 (doesn't exist) to 1.23 - Configure git init.defaultBranch=main on all OSes, not just Windows - Set HEAD in bare repo to point to main after push (ensures clones default to main) - Add global git user.email and user.name config for CI
- Skip TestSaveYAML_InvalidPath on Windows (path handling differs) - Skip TestCreate_PermissionDeniedOnWorkspaceDir on Windows (permission model differs) - Fix WorkspaceFileConsistencyCheck to normalize path separators using filepath.ToSlash() before parsing (Windows uses backslashes but workspace files use forward slashes) - Add 'windows' to goconst exclusion list
Tests that use os.Chmod to simulate permission errors don't work on Windows because Windows uses a different permission model (ACLs vs Unix permissions). Skipped tests: - TestCreate_StateError - TestCreateReposStructure_PermissionDenied - TestRemoveRepo_RemoveConfigError - TestRemoveRepo_RemoveWorktreesError - TestRemoveRepo_BareCloneDeleteError - TestRemoveRepo_UpdateWorkspaceFileError - TestAddRepository_ForceRemoveError
1. fixWorkspaceFileConsistency: Use forward slashes for VS Code workspace file paths instead of filepath.Join (which uses backslashes on Windows). VS Code workspace files always use forward slashes regardless of OS. 2. FindWorktree: Use absolute paths with symlink resolution for reliable path comparison. Also ensure proper prefix matching with separator.
…treeFoldersFromVSCode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds comprehensive test coverage for the CLI commands related to repository management in the FoundAgent project. The new tests cover a wide range of scenarios for adding, removing, and reconciling repositories, ensuring correct behavior for both normal and edge cases, as well as validating output in both human-readable and JSON formats.
CLI Add Command Tests:
addcommand, covering scenarios such as invalid URLs, name inference, force-adding with existing directories, handling multiple URLs, running in and outside workspaces, and both human and JSON output modes. Many edge and error cases are exercised, including skipped and failed repository additions. [1] [2]CLI Remove Command Tests:
removecommand, including removal of existing and non-existent repositories, config-only removal, running outside a workspace, and output validation in both human and JSON formats.CLI Reconcile Command Tests:
reconcilefunctionality, verifying behavior when all repositories are up-to-date, when repositories need to be cloned, and output in both human and JSON modes.Main Command Tests:
--helpand--versionflags and verifying the package structure.