fix(tests): object-store retention-prune tests no longer expire with the wall clock (#1066) - #1069
Merged
Merged
Conversation
…ime (#1066) test_remote_history_applies_entry_cap_only_during_prune and test_prune_caps_by_started_at_not_append_order hardcoded August 2026 dates compared against ObjectStoreHistoryStore._pruned()'s real datetime.now() cutoff. As calendar time advanced past the 30-day retention window, a second fixture entry started aging out unintentionally, breaking a test meant to isolate max_entries count-capping from age-based retention. Dates are now computed relative to the actual test-run time so they can't drift into the retention window again. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Closes #1066. Fixes CI, currently broken on
mainfor every PR (confirmed independently on a clean checkout).test_remote_history_applies_entry_cap_only_during_pruneandtest_prune_caps_by_started_at_not_append_orderhardcoded August 2026 dates and asserted an exactprune(retention_days=30)removed-count againstObjectStoreHistoryStore._pruned()'s realdatetime.now()cutoff. As calendar time advanced past the 30-day window, a second fixture entry started aging out unintentionally — these tests were meant to isolatemax_entriescount-capping from age-based retention (per the first test's own name), and the real-clock dependency broke that isolation.Fix
Dates are now computed relative to the actual test-run time (
now - timedelta(days=N), all within a few days — never near the 30-day boundary) instead of hardcoded absolutes. Audited the rest of the file plus local history/DLQ tests for the same pattern — no other instances found.Verification
ruff check drt tests/mypy drt— cleanpytest tests/unit/test_state_objectstore.py— 29 passedpytest tests/unit— full suite green except 2 known-unrelatedtest_cli_version.pyfailures (long-scratchpad-path artifact)🤖 Generated with Claude Code