[Test Improver] test: add unit tests for BaseIntegrator shared infrastructure (69 tests)#618
Draft
danielmeppiel wants to merge 1 commit intomainfrom
Draft
Conversation
Tests cover all static and instance methods in base_integrator.py: - IntegrationResult dataclass construction and optional fields - check_collision: managed/unmanaged files, force flag, diagnostics - normalize_managed_files: None passthrough, backslash normalization - validate_deploy_path: allowed prefixes, traversal rejection - partition_bucket_key: backward-compat alias mapping - partition_managed_files: trie-based routing for all known targets - cleanup_empty_parents: bottom-up empty dir removal - sync_remove_files: manifest mode and legacy glob fallback - find_files_by_glob: symlink exclusion, deduplication, sorting - resolve_links: no-resolver passthrough, change counting - should_integrate: always True baseline Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
🤖 Test Improver: automated AI assistant focused on improving test coverage for this repository.
BaseIntegratoris the core shared infrastructure that every file-level integrator inherits from. It handles collision detection, path validation, manifest-based sync, file discovery, empty-directory cleanup, and link resolution. Despite being relied on by all integrators, it had no dedicated unit tests.Goal and Rationale
src/apm_cli/integration/base_integrator.py(441 lines) provides the foundational guarantees that protect against:validate_deploy_pathcheck_collisionsync_remove_files+validate_deploy_pathpartition_managed_files(trie-based)find_files_by_globBugs here would silently affect all integrators (Copilot, Claude, Cursor, Codex, etc.).
Approach
One test class per method/feature group, 69 tests total:
TestIntegrationResultTestCheckCollisioncheck_collisionTestNormalizeManagedFilesnormalize_managed_filesTestValidateDeployPathvalidate_deploy_pathTestPartitionBucketKeypartition_bucket_keyTestPartitionManagedFilespartition_managed_filesTestCleanupEmptyParentscleanup_empty_parentsTestSyncRemoveFilessync_remove_filesTestFindFilesByGlobfind_files_by_globTestResolveLinksresolve_linksTestShouldIntegrateshould_integrateKey coverage points:
validate_deploy_pathpartition_managed_filestrie routing covers all known targets (Copilot, Claude, Cursor, OpenCode, Codex) includingdeploy_rootoverride for.agents/skillscheck_collisionandnormalize_managed_filessync_remove_fileswhenmanaged_files=Nonefind_files_by_globCoverage Impact
base_integrator.pyTrade-offs
tempfile.mkdtemp()for filesystem operations (needed to test actual file removal/discovery) - slightly slower than pure mocks but much more realisticpartition_managed_filestests exercise all known targets; adding a new target may require a new test caseTest Status
All 3,743 tests pass:
Run tests: