[Test Improver] test: add unit tests for BaseIntegrator core infrastructure (60 tests)#567
Draft
danielmeppiel wants to merge 1 commit intomainfrom
Draft
Conversation
Covers all key shared methods that every file-level integrator relies on: - IntegrationResult dataclass fields and defaults - check_collision(): managed_files=None, absent file, managed file, collision detection, force flag, backslash normalization, diagnostics - normalize_managed_files(): backslash->forward-slash, None passthrough - validate_deploy_path(): traversal rejection, prefix allowlist, symlink escape, custom prefixes - partition_bucket_key(): backward-compat alias mapping - partition_managed_files(): trie-based routing for prompts/instructions/ skills/commands/rules_cursor buckets + cross-target hooks/skills - cleanup_empty_parents(): empty dir removal, stop_at boundary, nonempty dirs preserved, OSError ignored - sync_remove_files(): managed removal, prefix filter, legacy glob, validate_deploy_path enforcement, unlink error handling - find_files_by_glob(): pattern matching, subdirs, dedup, sort 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.
🤖 Test Improver - automated AI assistant for test improvements.
Goal and Rationale
BaseIntegratoris the shared infrastructure that every file-level integrator inherits. Its methods handle:validate_deploy_path(),check_collision()— prevent path traversal and data losspartition_managed_files()— trie-based O(1) routing used during install/uninstall for all packagessync_remove_files(),cleanup_empty_parents(),find_files_by_glob()Despite being foundational,
BaseIntegratorhad no direct unit tests. Bugs here affect all integrators (prompts, instructions, skills, hooks, commands, rules).Approach
Added
tests/unit/integration/test_base_integrator.pywith 60 tests covering all 8 public methods:IntegrationResultcheck_collisionnormalize_managed_filesvalidate_deploy_pathpartition_bucket_keypartition_managed_filescleanup_empty_parentssync_remove_filesfind_files_by_globCoverage Impact
base_integrator.pydirect coverageReproducibility
uv run pytest tests/unit/integration/test_base_integrator.py -v # Full suite uv run pytest tests/unit tests/test_console.py -x -qTest Status
All 3,611 tests pass locally.