fix(search): address PR #834 review findings

Resolve the latest PR-review comment on the verify-on-read tag-gate work:

- tests: stringify note IDs in test_verify_on_read.py so SearchResult.id
  matches production (scanner stringifies all IDs on write) — helper and the
  keeps/deleted/mixed/dedupe assertions (blocking).
- tests: make the unshared-file negative control a PDF so the drop is
  unambiguously "unshared", not a mime_type_filter mismatch.
- config: add Validator("VECTOR_SYNC_PDF_TAG", len_min=1) — an empty tag name
  would make find_files_by_tag("") misbehave in the verifier and scanner.
- verification: correct the _verify_files comment — two batch fetches (tag
  REPORT + EXCLUDED_TAGS lookup) are held under one semaphore slot; the
  pure-Python intersection runs outside it.
- tests: de-duplicate the minimal-PDF constant into a shared PDF_BYTES in
  tests/integration/conftest.py, imported by both integration modules.

Verified: ruff/format/ty/unit all green; the two integration modules
(10 tests) pass against a local Nextcloud (app-only, no MCP profile needed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-02 23:09:46 +02:00
co-authored by Claude Opus 4.8
parent d4dbf01b0a
commit 8cae7d1708
5 changed files with 34 additions and 34 deletions
+2
View File
@@ -259,6 +259,8 @@ _dynaconf = Dynaconf(
Validator("DOCUMENT_CHUNK_SIZE", gte=1),
# Non-negative
Validator("DOCUMENT_CHUNK_OVERLAP", gte=0),
# Non-empty strings
Validator("VECTOR_SYNC_PDF_TAG", len_min=1),
# Enum constraints
Validator("LOG_FORMAT", is_in=["text", "json"]),
Validator(
+7 -3
View File
@@ -174,10 +174,14 @@ async def _verify_files(
tag_name = get_settings().vector_sync_pdf_tag
# One batch fetch per search, holding a single semaphore slot (same
# Two batch fetches per search held under a single semaphore slot (same
# backpressure rationale as _verify_news_items): the tagged-file REPORT
# plus optional Depth:infinity folder expansion and the EXCLUDED_TAGS
# lookup — are one round-trip set, not one per result.
# (plus optional Depth:infinity folder expansion) and the EXCLUDED_TAGS
# lookup (get_excluded_file_paths, itself ~2×N concurrent calls). Both are
# batched once per search, not once per result, and the slot bounds them.
# The pure-Python intersection that builds tagged_ids/accessible runs
# *outside* the slot — it needs no Nextcloud round-trip (mirrors the
# post-fetch present_ids build in _verify_news_items).
#
# TODO(perf): if folder expansion dominates query latency, cache the
# tagged-id set per user with a short TTL (mirroring the