refactor: address PR #851 review round 4 (ingest transport)

- Clear the module-singleton ingest references (task_producer,
  document_send_stream, document_receive_stream) on lifespan shutdown via a new
  _clear_vector_sync_state() helper, mirroring the eviction_task_group cleanup.
  Defense-in-depth so a late webhook (or a module-singleton integration test)
  can't touch a producer/stream backed by an already-closed resource.
- Add IngestTransport.backend_name ("memory"/"postgres") and use it in both
  lifespan log lines, removing the last settings.ingest_queue read from the
  background-sync setup — the lifespan no longer inspects the backend at all.
- Cover backend_name in the build_transport adapter-selection tests.

Refs: Deck #196

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-04 20:42:57 +02:00
co-authored by Claude Opus 4.8
parent c0c52c1b34
commit c4401af9c6
3 changed files with 40 additions and 2 deletions
@@ -44,6 +44,7 @@ class TestBuildTransport:
assert isinstance(transport, LocalTransport)
assert isinstance(transport.producer, MemoryTaskProducer)
assert transport.backend_name == "memory"
# Memory backend exposes both raw stream ends.
assert transport.send_stream is not None
assert transport.receive_stream is not None
@@ -61,6 +62,7 @@ class TestBuildTransport:
assert isinstance(transport, DistributedTransport)
assert transport.producer is producer
assert transport.backend_name == "postgres"
# Schema applied once on the open pool before any defer.
producer.ensure_schema.assert_awaited_once()
# No in-process stream for the distributed backend.