fix: add metrics-interval validator + type/test gaps (review #850)

- Add Validator("VECTOR_SYNC_METRICS_REFRESH_INTERVAL", gte=1) so a 0/negative
  value can't turn the publish loop into a busy-spin.
- Annotate count_indexed's qdrant_client param as AsyncQdrantClient.
- Add tests: exact kwarg is forwarded to qdrant count, and the placeholder
  filter matches False (excludes placeholders) with chunk_index pinned to 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-04 19:39:46 +02:00
co-authored by Claude Opus 4.8
parent fbe70ecd9c
commit fc3e0f28f6
3 changed files with 28 additions and 1 deletions
+1
View File
@@ -271,6 +271,7 @@ _dynaconf = Dynaconf(
Validator("VECTOR_SYNC_SCAN_INTERVAL", gte=1),
Validator("VECTOR_SYNC_PROCESSOR_WORKERS", gte=1),
Validator("VECTOR_SYNC_QUEUE_MAX_SIZE", gte=1),
Validator("VECTOR_SYNC_METRICS_REFRESH_INTERVAL", gte=1),
Validator("VECTOR_SYNC_USER_POLL_INTERVAL", gte=1),
Validator("VERIFICATION_CONCURRENCY", gte=1),
Validator("DOCUMENT_CHUNK_SIZE", gte=1),
@@ -24,6 +24,7 @@ from typing import Any
import anyio
from anyio.abc import TaskStatus
from qdrant_client import AsyncQdrantClient
from qdrant_client.models import FieldCondition, Filter, MatchValue
from nextcloud_mcp_server.config import get_settings
@@ -41,7 +42,7 @@ logger = logging.getLogger(__name__)
async def count_indexed(
qdrant_client, collection: str, *, exact: bool = True
qdrant_client: AsyncQdrantClient, collection: str, *, exact: bool = True
) -> tuple[int, int]:
"""Return ``(documents, chunks)`` indexed in the collection.