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
+14 -2
View File
@@ -117,8 +117,20 @@ async def purge_doc_types_route(request: Request) -> JSONResponse:
return JSONResponse({"purged": {}})
purged = await purge_doc_types(doc_types)
logger.info("Vector-sync purge by admin %s: %s", user_id, purged)
return JSONResponse({"purged": purged})
# Surface a partial-failure signal so Astrolabe knows which types were
# NOT purged (consent not yet enforced for them) — the scanner backstop
# still catches these, but the caller shouldn't assume full success.
failed = [dt for dt in dict.fromkeys(doc_types) if dt not in purged]
body: dict = {"purged": purged}
if failed:
body["failed"] = failed
logger.info(
"Vector-sync purge by admin %s: purged=%s failed=%s",
user_id,
purged,
failed,
)
return JSONResponse(body)
except ProvisioningRequiredError as e:
logger.info("Provisioning required for user %s: %s", user_id, e)