fleet-memory/hindsight-api-slim/hindsight_api
Nicolò Boschi e6333719ee
fix(entity_resolver): prevent _pending_stats/_pending_cooccurrences memory leak (#662)
* fix(entity_resolver): prevent _pending_stats/_pending_cooccurrences memory leak

Add discard_pending_stats() to EntityResolver to clean up both pending dicts
for the current task key. Call it at the start of each _run_db_work attempt so
that exceptions between accumulation and flush_pending_stats() — including
deadlock retries — never leave stale entries keyed by recycled task IDs.

Fixes #660

* test(entity_resolver): add unit tests for discard_pending_stats()

Covers: clears both dicts for current task, is idempotent when empty,
and does not touch entries belonging to other task keys.
No database required — purely in-memory logic.
2026-03-23 16:06:04 +01:00
..
admin feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
alembic Fix pg_trgm unavailability causing startup crash and silent retain failures (#626) (#649) 2026-03-23 09:18:59 +01:00
api test: add unit tests for pg_trgm auto-detection and ValidationResult.accept_with() enrichment (#650) 2026-03-23 10:33:09 +01:00
engine fix(entity_resolver): prevent _pending_stats/_pending_cooccurrences memory leak (#662) 2026-03-23 16:06:04 +01:00
extensions feat(extensions): add context enrichment to OperationValidatorExtension (#639) 2026-03-23 08:57:02 +01:00
webhooks feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
worker Fix orphaned batch_retain parents when child fails via unhandled exception (#618) 2026-03-19 14:55:26 +01:00
__init__.py Release v0.4.19 2026-03-18 14:29:15 +01:00
banner.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
config.py Add wall-clock timeout to reflect operations (#643) 2026-03-23 09:19:26 +01:00
config_resolver.py feat(retain): verbatim, chunks modes and named retain strategies (#593) 2026-03-17 18:08:25 +01:00
daemon.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
main.py Add wall-clock timeout to reflect operations (#643) 2026-03-23 09:19:26 +01:00
mcp_local.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
mcp_tools.py fix: MCP tool calls fail when MCP_AUTH_TOKEN and TENANT_API_KEY differ (#635) 2026-03-20 18:36:05 +01:00
metrics.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
migrations.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
models.py fix: MCP tool calls fail when MCP_AUTH_TOKEN and TENANT_API_KEY differ (#635) 2026-03-20 18:36:05 +01:00
pg0.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
server.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
tracing.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
utils.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00