fix(vector-sync): address round-5 review — partial-failure signal, markers

- purge route: include a "failed" key in the 200 body listing requested doc
  types that were not purged, so Astrolabe knows consent isn't yet enforced
  for them (scanner backstop still catches up)
- tests: add @pytest.mark.unit / module-level pytestmark to the new test
  modules so they run under `pytest -m unit`; add a partial-failure route test
- capabilities: comment why the cache is keyed per-user despite a global value
- semantic/scanner: doc/comment clarifications (sorted-order, eviction timing)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-16 01:47:44 +02:00
co-authored by Claude Opus 4.8
parent b0751102d7
commit d0db530ac9
10 changed files with 64 additions and 7 deletions
+6
View File
@@ -28,6 +28,12 @@ logger = logging.getLogger(__name__)
# changes rarely, but search/scan paths consult it frequently, so trade a little
# staleness for keeping the OCS round-trip off the hot path. Mirrors the
# list_accessible_owners cache in search/access_filter.py.
#
# Keyed by user_id even though enabled_doc_types is an admin-wide value: the OCS
# call is authenticated per-user (and ``installed`` resolves per-user on the
# Astrolabe side), so we cache per-user for correctness. The redundancy is
# bounded by _CACHE_MAXSIZE; on an admin change all entries reconverge within
# one TTL window.
_CACHE_TTL_SECONDS = 30.0
_CACHE_MAXSIZE = 1024
# user_id -> (monotonic_ts, frozenset[doc_type] | None). None = no restriction.