refactor(sofiia-console): extract idempotency store abstraction

Move idempotency TTL/LRU logic into a dedicated store module with a swap-ready interface and wire chat send flow to use store get/set semantics without changing API behavior.

Made-with: Cursor
This commit is contained in:
Apple
2026-03-02 08:11:13 -08:00
parent b9c548f1a6
commit 0c626943d6
3 changed files with 109 additions and 44 deletions

View File

@@ -28,12 +28,16 @@ def sofiia_module(tmp_path, monkeypatch):
asyncio.set_event_loop(loop)
import app.db as db_mod # type: ignore
import app.idempotency as idem_mod # type: ignore
import app.main as main_mod # type: ignore
importlib.reload(db_mod)
importlib.reload(idem_mod)
importlib.reload(main_mod)
main_mod._rate_buckets.clear()
main_mod._idempotency_cache.clear()
store = idem_mod.get_idempotency_store()
if hasattr(store, "reset"):
store.reset()
return main_mod