embedding-fetch-failure-message.test.mjs
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
1 day ago
| 1 | /** |
| 2 | * Semantic search surfaces embedding fetch errors in the Hub; messages must be actionable. |
| 3 | */ |
| 4 | import { describe, it } from 'node:test'; |
| 5 | import assert from 'node:assert'; |
| 6 | import { formatEmbeddingFetchFailure } from '../lib/embedding.mjs'; |
| 7 | |
| 8 | describe('formatEmbeddingFetchFailure', () => { |
| 9 | it('expands Ollama "fetch failed" with host and troubleshooting', () => { |
| 10 | const err = new TypeError('fetch failed'); |
| 11 | err.cause = new Error('connect ECONNREFUSED 127.0.0.1:11434'); |
| 12 | const s = formatEmbeddingFetchFailure('ollama', 'http://127.0.0.1:11434', 'nomic-embed-text', err); |
| 13 | assert.match(s, /Ollama embeddings unreachable/); |
| 14 | assert.match(s, /http:\/\/127\.0\.0\.1:11434/); |
| 15 | assert.match(s, /ollama serve/); |
| 16 | assert.match(s, /ollama pull nomic-embed-text/); |
| 17 | assert.match(s, /EMBEDDING_PROVIDER=openai/); |
| 18 | assert.match(s, /VOYAGE_API_KEY/); |
| 19 | assert.match(s, /ECONNREFUSED|fetch failed/); |
| 20 | }); |
| 21 | |
| 22 | it('uses default model label when model empty', () => { |
| 23 | const err = new TypeError('fetch failed'); |
| 24 | const s = formatEmbeddingFetchFailure('ollama', 'http://localhost:11434', '', err); |
| 25 | assert.match(s, /ollama pull nomic-embed-text/); |
| 26 | }); |
| 27 | |
| 28 | it('OpenAI path mentions API key and host', () => { |
| 29 | const err = new TypeError('fetch failed'); |
| 30 | err.cause = new Error('getaddrinfo ENOTFOUND api.openai.com'); |
| 31 | const s = formatEmbeddingFetchFailure('openai', 'https://api.openai.com/v1/embeddings', 'text-embedding-3-small', err); |
| 32 | assert.match(s, /OpenAI embeddings request failed/); |
| 33 | assert.match(s, /OPENAI_API_KEY/); |
| 34 | }); |
| 35 | |
| 36 | it('Voyage path mentions API key, provider, and re-index', () => { |
| 37 | const err = new TypeError('fetch failed'); |
| 38 | const s = formatEmbeddingFetchFailure('voyage', 'https://api.voyageai.com/v1/embeddings', 'voyage-4-lite', err); |
| 39 | assert.match(s, /Voyage embeddings unreachable/); |
| 40 | assert.match(s, /VOYAGE_API_KEY/); |
| 41 | assert.match(s, /EMBEDDING_PROVIDER=voyage/); |
| 42 | assert.match(s, /re-index/); |
| 43 | }); |
| 44 | }); |
File History
2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠
1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6
docs: accept Calendar Events v0 spec with Phase 0 security …
Human
1 day ago