Skip to content

Fix a flaky timeseries test#2076

Open
Dreamsorcerer wants to merge 1 commit into
mainfrom
sam/fix-flaky-timeseries-test
Open

Fix a flaky timeseries test#2076
Dreamsorcerer wants to merge 1 commit into
mainfrom
sam/fix-flaky-timeseries-test

Conversation

@Dreamsorcerer
Copy link
Copy Markdown
Collaborator

Problem

This test was timing dependent and appeared in a flaky CI failure.

Solution

Remove the timing dependence, which also makes the test itself faster.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 13, 2026

Greptile Summary

This PR fixes a flaky test in test_stream_basic by replacing a time.sleep(0.1) polling pattern with await obs.pipe(ops.to_list()), which correctly waits for the observable to complete before asserting results.

  • The test is converted to async def, taking advantage of asyncio_mode = \"auto\" already configured in pyproject.toml, so no additional marker is needed.
  • ops.to_list() collects all emissions into a single list on observable completion, and reactivex.Observable.__await__ returns the last (only) item emitted — the complete list — making the assertion deterministic.

Confidence Score: 5/5

Safe to merge — the change removes a racy sleep-based polling pattern and replaces it with a deterministic async await, touching only a single test file.

The change is minimal and well-scoped: one test converted from synchronous sleep-polling to async/await. The project already has asyncio_mode = auto configured, reactivex.Observable has a documented await that returns the last emitted value, and ops.to_list() produces exactly one emission (the complete list), so the assertion is now fully deterministic. No production code is touched.

No files require special attention.

Important Files Changed

Filename Overview
dimos/memory/timeseries/test_base.py Converts test_stream_basic from synchronous with time.sleep to async using ops.to_list() await, cleanly eliminating the race condition

Reviews (1): Last reviewed commit: "Fix a flaky timeseries test" | Re-trigger Greptile

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant