fix: remove unimplementable skipped caching tests (#33) #58
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#58
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/major-domo-database-33"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
TestPlayerServiceCacheclass and its three@pytest.mark.skiptests fromtests/unit/test_player_service.pyWhy removed rather than implemented
The three skipped tests required:
test_cache_set_on_read—get_players()to write results to cache.PlayerService.get_playersis a classmethod with no cache access; adding read-through caching requires a non-trivial architectural change.test_cache_invalidation_on_update—patch_player()to callinvalidate_related_cache()using the injected cache fromServiceConfig. The write methods usetemp_service = cls()which creates a fresh instance that doesn't inherit the injected cache — so invalidation calls would go to a different cache object than the one the test observes.test_cache_hit_rate— Two calls toget_playersto produce a cache hit on the second call. Same root issue as test 1.Implementing these tests correctly would require refactoring the classmethod +
cls()pattern to propagate the injected cache, which is out of scope for a tech-debt cleanup issue.Files changed
tests/unit/test_player_service.py— removedTestPlayerServiceCache(43 lines)Note on diff size
The pre-commit formatter hook (ruff/black) auto-reformatted the file on save, producing a larger diff than the functional change. The only intentional change is the removal of the cache test class.
Other observations
test_cache_clear_on_createinTestPlayerServiceValidation(kept, not skipped) passes becausecache.get_calls()is non-empty after the explicitcache.set(...)call beforecreate_players— not because the service itself calls the cache. This may be a misleading test but it's out of scope for this issue.AI Code Review
Files Reviewed
tests/unit/test_player_service.py(modified)Findings
Correctness
TestPlayerServiceCache(3@pytest.mark.skiptests) removed.get_playersis a classmethod with no cache read-through —test_cache_set_on_readandtest_cache_hit_ratecannot pass without architectural refactor.patch_playerusestemp_service = cls()which creates a fresh instance that doesn't inherit the injected cache —test_cache_invalidation_on_updatecannot observe the same cache object the test injects.Security
Style & Conventions
EnhancedMockCacheremains imported but unused (line 14 in new file). This predates this PR and is out of scope.Suggestions
test_cache_clear_on_createinTestPlayerServiceValidationas misleading (passes becausecache.get_calls()is non-empty from the explicitcache.set(...)call beforecreate_players, not from any service-driven cache invalidation). Worth tracking as a follow-up issue but out of scope here.Verdict: APPROVED
Clean removal of permanently-skipped dead tests with well-documented rationale. The architectural constraints identified in the PR body are accurate. No running tests removed, no coverage lost.
Automated review by Claude PR Reviewer