test(vector-sync): close round-8 coverage gaps (500 path, non-string list)

- route test for purge_doc_types raising on total failure -> 500
- route test for doc_types list containing non-strings -> 400
- reword the capabilities move_to_end comment (no-op on new keys; needed only
  for the expired-key in-place update)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-16 02:10:54 +02:00
co-authored by Claude Opus 4.8
parent ea53ed9ce0
commit 7067c5fff1
2 changed files with 32 additions and 2 deletions
+3 -2
View File
@@ -100,8 +100,9 @@ async def allowed_doc_types(
result = _parse_enabled_doc_types(payload)
_cache[user_id] = (now, result)
# New key: __setitem__ already appends (no-op). Existing expired key: the
# update keeps its old position, so move it to the end to preserve LRU order.
# Needed only for an existing (expired) key: __setitem__ updates it in place,
# keeping its old position, so move it to the end to preserve LRU order. For
# a brand-new key __setitem__ already appends, so this is a harmless no-op.
_cache.move_to_end(user_id)
while len(_cache) > _CACHE_MAXSIZE:
_cache.popitem(last=False) # evict least-recently-used