require provenance in Supermemory smoke test
This commit is contained in:
@@ -53,6 +53,14 @@ def require_token(env_name: str) -> str:
|
|||||||
return token
|
return token
|
||||||
|
|
||||||
|
|
||||||
|
def contains_source(value: Any, expected: str) -> bool:
|
||||||
|
if isinstance(value, dict):
|
||||||
|
return value.get("source") == expected or any(contains_source(item, expected) for item in value.values())
|
||||||
|
if isinstance(value, list):
|
||||||
|
return any(contains_source(item, expected) for item in value)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def request_multipart_json(
|
def request_multipart_json(
|
||||||
url: str,
|
url: str,
|
||||||
*,
|
*,
|
||||||
@@ -326,6 +334,9 @@ def smoke(args: argparse.Namespace) -> None:
|
|||||||
)
|
)
|
||||||
if not found:
|
if not found:
|
||||||
raise RuntimeError(f"document {document_id or marker} was not searchable within {args.wait}s")
|
raise RuntimeError(f"document {document_id or marker} was not searchable within {args.wait}s")
|
||||||
|
raw_metadata_traceable = contains_source(search.get("results") or [], "poc-smoke")
|
||||||
|
if not raw_metadata_traceable:
|
||||||
|
raise RuntimeError("v4 document search did not return the source metadata required for attribution")
|
||||||
profile_shape_ok = isinstance(profile, dict) and "profile" in profile
|
profile_shape_ok = isinstance(profile, dict) and "profile" in profile
|
||||||
if not profile_shape_ok:
|
if not profile_shape_ok:
|
||||||
raise RuntimeError("v4 profile response is missing the profile field expected by Hermes")
|
raise RuntimeError("v4 profile response is missing the profile field expected by Hermes")
|
||||||
@@ -334,6 +345,7 @@ def smoke(args: argparse.Namespace) -> None:
|
|||||||
{
|
{
|
||||||
"document_id": document_id,
|
"document_id": document_id,
|
||||||
"documents_search": "ok",
|
"documents_search": "ok",
|
||||||
|
"raw_metadata_traceability": "ok",
|
||||||
"profile": "ok",
|
"profile": "ok",
|
||||||
"conversation_ingest": "accepted",
|
"conversation_ingest": "accepted",
|
||||||
"container_tag": container,
|
"container_tag": container,
|
||||||
|
|||||||
Reference in New Issue
Block a user