Skip to content

fix(tests): object-store retention-prune tests no longer expire with the wall clock (#1066) - #1069

Merged
masukai merged 1 commit into
mainfrom
fix/1066-prune-test-clock
Sep 1, 2026
Merged

fix(tests): object-store retention-prune tests no longer expire with the wall clock (#1066)#1069
masukai merged 1 commit into
mainfrom
fix/1066-prune-test-clock

Conversation

@masukai

@masukai masukai commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #1066. Fixes CI, currently broken on main for every PR (confirmed independently on a clean checkout).

test_remote_history_applies_entry_cap_only_during_prune and test_prune_caps_by_started_at_not_append_order hardcoded August 2026 dates and asserted an exact prune(retention_days=30) removed-count against ObjectStoreHistoryStore._pruned()'s real datetime.now() cutoff. As calendar time advanced past the 30-day window, a second fixture entry started aging out unintentionally — these tests were meant to isolate max_entries count-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 — clean
  • pytest tests/unit/test_state_objectstore.py — 29 passed
  • pytest tests/unit — full suite green except 2 known-unrelated test_cli_version.py failures (long-scratchpad-path artifact)

🤖 Generated with Claude Code

…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

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@masukai
masukai merged commit da42af4 into main Sep 1, 2026
9 checks passed
@masukai
masukai deleted the fix/1066-prune-test-clock branch September 1, 2026 02:59
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(tests): test_state_objectstore.py retention-prune tests use hardcoded dates against a real clock — now flaky/failing

1 participant