feat: add init sidecar for migrations and setup on compose up
All checks were successful
CVE Scan & Docker Build / security-scan (push) Successful in 50s
CVE Scan & Docker Build / build-and-push (push) Successful in 2m30s

Introduces a one-shot `init` service in docker-compose that runs Postgres
migrations, Neo4j index setup, and library-type seeding on every `up`.
Long-running services (`app`, `mcp`, `worker`) now depend on its
successful completion via `service_completed_successfully`, blocking the
stack on configuration errors (missing embedding model, dimension
mismatch, unreachable DB) rather than serving silent zero-result
searches.

Also standardizes reranker test fixtures to use the `/v1` OpenAI-style
base URL convention used across other service clients.
This commit is contained in:
2026-05-10 08:01:58 -04:00
parent 9ceb01f829
commit a945b382e6
15 changed files with 821 additions and 65 deletions

View File

@@ -61,6 +61,22 @@ POST http://pan.helu.ca:8400/v1/rerank
}
```
> **`LLMApi.base_url` convention.** Every Mnemosyne service client
> (`EmbeddingClient`, `RerankerClient`, `vision.py`, `concepts.py`)
> treats `base_url` as the **OpenAI-style `/v1` root** and appends a
> path-only segment: `/embeddings`, `/rerank`, `/chat/completions`.
> So a single `LLMApi` row with `base_url=http://pan.helu.ca:8400/v1`
> serves both the embedding and the reranker endpoints — no per-purpose
> duplication needed.
>
> Get this wrong (e.g. set `base_url=http://pan.helu.ca:8400` with no
> `/v1`, or have a client prepend `/v1` locally) and you get a
> double-prefixed URL like `…/v1/v1/rerank` that 404s silently —
> `SearchService._rerank` catches the exception, the UI shows
> "Re-rank: Skipped", and the search falls back to raw RRF order.
> Check `results.reranker_skip_reason` on the search page for the
> specific error.
## Deliverables
### 1. Search Service (`library/services/search.py`)