From c00ead36c7d5ef64e112ff6e7fa9c000d2e2e957 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 9 Sep 2026 00:12:58 -0700 Subject: [PATCH] diagnose all Supermemory search modes --- servers/unraid/supermemory-poc/smoke.sh | 33 +++++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/servers/unraid/supermemory-poc/smoke.sh b/servers/unraid/supermemory-poc/smoke.sh index d25907d..4032dcf 100644 --- a/servers/unraid/supermemory-poc/smoke.sh +++ b/servers/unraid/supermemory-poc/smoke.sh @@ -67,23 +67,46 @@ if ! curl --fail --silent --show-error --max-time 15 \ "$base_url/v3/search" >/tmp/search-v3.json; then fail 41 search-v3-request fi -grep -q "$marker" /tmp/search-v3.json || fail 44 search-v3-no-hit +v3_hit=false +if grep -Eq '"total"[[:space:]]*:[[:space:]]*[1-9][0-9]*' /tmp/search-v3.json; then + v3_hit=true +fi curl --fail --silent --show-error --max-time 15 \ -H "$auth_header" \ -H 'Content-Type: application/json' \ --data "{\"q\":\"$marker\",\"containerTag\":\"$container_tag\",\"searchMode\":\"documents\",\"limit\":5}" \ "$base_url/v4/search" >/tmp/search-documents.json || fail 42 search-documents-request -grep -q "$marker" /tmp/search-documents.json || fail 45 search-documents-no-hit -grep -q 'poc-smoke' /tmp/search-documents.json || fail 46 search-documents-metadata-missing +documents_hit=false +documents_metadata=false +if grep -Eq '"total"[[:space:]]*:[[:space:]]*[1-9][0-9]*' /tmp/search-documents.json && grep -q "$marker" /tmp/search-documents.json; then + documents_hit=true +fi +if grep -q 'poc-smoke' /tmp/search-documents.json; then + documents_metadata=true +fi curl --fail --silent --show-error --max-time 15 \ -H "$auth_header" \ -H 'Content-Type: application/json' \ --data "{\"q\":\"海棠计划下一步是什么?\",\"containerTag\":\"$container_tag\",\"searchMode\":\"hybrid\",\"limit\":5}" \ "$base_url/v4/search" >/tmp/search-hybrid.json || fail 47 search-hybrid-request -grep -q '核对原始报告' /tmp/search-hybrid.json || fail 48 search-hybrid-no-hit -grep -q 'poc-smoke' /tmp/search-hybrid.json || fail 49 search-hybrid-metadata-missing +hybrid_hit=false +hybrid_metadata=false +if grep -Eq '"total"[[:space:]]*:[[:space:]]*[1-9][0-9]*' /tmp/search-hybrid.json && grep -q '核对原始报告' /tmp/search-hybrid.json; then + hybrid_hit=true +fi +if grep -q 'poc-smoke' /tmp/search-hybrid.json; then + hybrid_metadata=true +fi + +printf '{"smoke":"search-diagnostic","v3":%s,"v4_documents":%s,"v4_documents_metadata":%s,"v4_hybrid":%s,"v4_hybrid_metadata":%s}\n' \ + "$v3_hit" "$documents_hit" "$documents_metadata" "$hybrid_hit" "$hybrid_metadata" +[ "$v3_hit" = true ] || fail 44 search-v3-no-hit +[ "$documents_hit" = true ] || fail 45 search-documents-no-hit +[ "$documents_metadata" = true ] || fail 46 search-documents-metadata-missing +[ "$hybrid_hit" = true ] || fail 48 search-hybrid-no-hit +[ "$hybrid_metadata" = true ] || fail 49 search-hybrid-metadata-missing curl --fail --silent --show-error --max-time 60 \ -H "$auth_header" \