From ab9bb362149186702ad503738d611625e5f7666a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Jolovi=C4=87?= Date: Fri, 1 May 2026 18:42:54 +0200 Subject: [PATCH 1/2] fix: add freezegun to dev deps, restore Redis find_by_fingerprint expires_at race guard --- pyproject.toml | 3 ++- src/cashet/redis_store.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2a429fe..21c9f11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cashet" -version = "0.4.2" +version = "0.4.3" description = "A Python memoization cache with Redis, async support, DAG pipelines, and an HTTP server" readme = "README.md" license = "MIT" @@ -70,6 +70,7 @@ dev = [ "pyright>=1.1", "httpx>=0.28.1", "pytest-asyncio>=1.3.0", + "freezegun>=1.0", ] [tool.ruff] diff --git a/src/cashet/redis_store.py b/src/cashet/redis_store.py index bf0ee4d..3bb0951 100644 --- a/src/cashet/redis_store.py +++ b/src/cashet/redis_store.py @@ -390,6 +390,8 @@ async def find_by_fingerprint(self, fingerprint: str) -> Commit | None: h_str = h.decode() if isinstance(h, bytes) else h commit = await self.get_commit(h_str) if commit is not None and commit.status in (TaskStatus.COMPLETED, TaskStatus.CACHED): + if commit.expires_at is not None and commit.expires_at <= datetime.now(UTC): + continue await self._touch_commit(h_str) return commit return None From 2944a7dd2a59db9865d8b072db579c38593c7951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Jolovi=C4=87?= Date: Fri, 1 May 2026 18:43:05 +0200 Subject: [PATCH 2/2] docs: add 0.4.3 changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fcc642..c918165 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.4.3 — 1.5.2026. + +### Fixed +- Add `freezegun` to dev dependencies so TTL/GC tests don't fail with + `ModuleNotFoundError` on fresh installs or CI. +- Restore `expires_at <= now` race guard in Redis `find_by_fingerprint` after + the `ZREVRANGEBYSCORE` pushdown — a commit can expire between the server-side + filter and the `get_commit` call. + ## 0.4.2 — 1.5.2026. ### Performance