From fb23918ae28ed5c19f883bb273672591b98a73b3 Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 8 Sep 2026 00:03:43 -0700 Subject: [PATCH] add staged Supermemory smoke diagnostics --- servers/unraid/supermemory-poc/smoke.sh | 79 +++++++++++++++++++++---- 1 file changed, 67 insertions(+), 12 deletions(-) diff --git a/servers/unraid/supermemory-poc/smoke.sh b/servers/unraid/supermemory-poc/smoke.sh index 88a4c2d..239fa28 100644 --- a/servers/unraid/supermemory-poc/smoke.sh +++ b/servers/unraid/supermemory-poc/smoke.sh @@ -15,20 +15,55 @@ api_key=$(cat "$data_dir/api-key") auth_header="Authorization: Bearer $api_key" marker="supermemory-poc-google-embedding-2-$(date +%s)" +fail() { + code="$1" + phase="$2" + printf '{"smoke":"failed","phase":"%s","exit_code":%s}\n' "$phase" "$code" + exit "$code" +} + plan="$data_dir/embedding-plan.json" for _ in $(seq 1 30); do [ -f "$plan" ] && break sleep 1 done -grep -q 'openai' "$plan" -grep -q 'google/gemini-embedding-2' "$plan" -grep -q '1024' "$plan" +grep -q 'openai' "$plan" || fail 11 embedding-plan-provider +grep -q 'google/gemini-embedding-2' "$plan" || fail 12 embedding-plan-model +grep -q '1024' "$plan" || fail 13 embedding-plan-dimensions -curl --fail --silent --show-error --max-time 60 \ +if ! curl --fail --silent --show-error --max-time 60 \ -H "$auth_header" \ -H 'Content-Type: application/json' \ - --data "{\"content\":\"$marker:中文跨文档检索测试;海棠计划的下一步是核对原始报告。\",\"containerTag\":\"$container_tag\",\"customId\":\"$marker\",\"metadata\":{\"source\":\"poc-smoke\",\"status\":\"temporary\"}}" \ - "$base_url/v3/documents" >/tmp/add.json + --data "{\"containerTags\":[\"$container_tag\"],\"limit\":20}" \ + "$base_url/v3/documents/list" >/tmp/documents.json; then + fail 21 documents-list +fi + +if grep -q 'supermemory-poc-google-embedding-2' /tmp/documents.json; then + if grep -Eq '"status"[[:space:]]*:[[:space:]]*"failed"' /tmp/documents.json; then + fail 31 document-processing-failed + fi + if ! grep -Eq '"status"[[:space:]]*:[[:space:]]*"done"' /tmp/documents.json; then + if grep -Eq '"status"[[:space:]]*:[[:space:]]*"embedding"' /tmp/documents.json; then + fail 32 document-stuck-embedding + fi + if grep -Eq '"status"[[:space:]]*:[[:space:]]*"chunking"' /tmp/documents.json; then + fail 33 document-stuck-chunking + fi + if grep -Eq '"status"[[:space:]]*:[[:space:]]*"indexing"' /tmp/documents.json; then + fail 34 document-stuck-indexing + fi + fail 35 document-not-done + fi +else + if ! curl --fail --silent --show-error --max-time 60 \ + -H "$auth_header" \ + -H 'Content-Type: application/json' \ + --data "{\"content\":\"$marker:中文跨文档检索测试;海棠计划的下一步是核对原始报告。\",\"containerTag\":\"$container_tag\",\"customId\":\"$marker\",\"metadata\":{\"source\":\"poc-smoke\",\"status\":\"temporary\"}}" \ + "$base_url/v3/documents" >/tmp/add.json; then + fail 22 document-add + fi +fi found=false for _ in $(seq 1 90); do @@ -36,27 +71,47 @@ for _ in $(seq 1 90); do -H "$auth_header" \ -H 'Content-Type: application/json' \ --data "{\"q\":\"海棠计划下一步是什么?\",\"containerTag\":\"$container_tag\",\"searchMode\":\"hybrid\",\"limit\":5}" \ - "$base_url/v4/search" >/tmp/search.json - if grep -q '核对原始报告' /tmp/search.json && grep -q 'poc-smoke' /tmp/search.json; then + "$base_url/v4/search" >/tmp/search-v4.json || fail 41 search-v4-request + if grep -q '核对原始报告' /tmp/search-v4.json && grep -q 'poc-smoke' /tmp/search-v4.json; then + found=true + break + fi + + curl --fail --silent --show-error --max-time 60 \ + -H "$auth_header" \ + -H 'Content-Type: application/json' \ + --data "{\"q\":\"海棠计划下一步是什么?\",\"containerTags\":[\"$container_tag\"],\"searchMode\":\"hybrid\",\"limit\":5}" \ + "$base_url/v4/search" >/tmp/search-v4-tags.json || fail 42 search-v4-tags-request + if grep -q '核对原始报告' /tmp/search-v4-tags.json && grep -q 'poc-smoke' /tmp/search-v4-tags.json; then + found=true + break + fi + + curl --fail --silent --show-error --max-time 60 \ + -H "$auth_header" \ + -H 'Content-Type: application/json' \ + --data "{\"q\":\"海棠计划下一步是什么?\",\"containerTag\":\"$container_tag\"}" \ + "$base_url/v3/search" >/tmp/search-v3.json || fail 43 search-v3-request + if grep -q '核对原始报告' /tmp/search-v3.json && grep -q 'poc-smoke' /tmp/search-v3.json; then found=true break fi sleep 2 done -[ "$found" = true ] +[ "$found" = true ] || fail 44 search-no-traceable-hit curl --fail --silent --show-error --max-time 60 \ -H "$auth_header" \ -H 'Content-Type: application/json' \ --data "{\"containerTag\":\"$container_tag\",\"q\":\"海棠计划\"}" \ - "$base_url/v4/profile" >/tmp/profile.json -grep -q '"profile"' /tmp/profile.json + "$base_url/v4/profile" >/tmp/profile.json || fail 51 profile-request +grep -q '"profile"' /tmp/profile.json || fail 52 profile-shape curl --fail --silent --show-error --max-time 60 \ -H "$auth_header" \ -H 'Content-Type: application/json' \ --data "{\"conversationId\":\"$marker\",\"containerTags\":[\"$container_tag\"],\"messages\":[{\"role\":\"user\",\"content\":\"这只是隔离测试。\"},{\"role\":\"assistant\",\"content\":\"不会作为正式事实。\"}],\"metadata\":{\"source\":\"poc-smoke\",\"status\":\"temporary\"}}" \ - "$base_url/v4/conversations" >/tmp/conversation.json + "$base_url/v4/conversations" >/tmp/conversation.json || fail 61 conversation-ingest touch "$sentinel" printf '%s\n' '{"embedding_plan":"openai/google/gemini-embedding-2/1024","llm":"gemini-3.5-flash-lite","chinese_hybrid_search":"ok","metadata_traceability":"ok","profile":"ok","conversation_ingest":"accepted"}'