38 lines
1.6 KiB
TypeScript
38 lines
1.6 KiB
TypeScript
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
|
// Retrieval is one platform service (ADR-061, RAG R9): the knowledge module's backend is the platform's
|
|
// knowledge service, an app keeps no vector store of its own, and a deployment that still names the old
|
|
// backend is told so by name instead of quietly getting another one.
|
|
|
|
import { readFileSync } from "node:fs"
|
|
import { KNOWLEDGE_BACKEND_VAR, KNOWLEDGE_BACKENDS, knowledgeBackendOf } from "@app/config"
|
|
import { describe, expect, it } from "vitest"
|
|
|
|
const read = (path: string): string => readFileSync(new URL(`../${path}`, import.meta.url), "utf8")
|
|
|
|
describe("the knowledge backend", () => {
|
|
it("is the platform's by default", () => {
|
|
expect(knowledgeBackendOf({})).toBe("platform")
|
|
expect(knowledgeBackendOf({ KNOWLEDGE_BACKEND: "" })).toBe("platform")
|
|
expect(knowledgeBackendOf({ KNOWLEDGE_BACKEND: " Platform " })).toBe("platform")
|
|
})
|
|
|
|
it("has no local backend to choose, and refuses the retired one by the variable's name", () => {
|
|
expect(KNOWLEDGE_BACKENDS).toEqual(["platform"])
|
|
expect(() => knowledgeBackendOf({ KNOWLEDGE_BACKEND: "vectors" })).toThrow(KNOWLEDGE_BACKEND_VAR)
|
|
})
|
|
|
|
it("leaves no vector store in the apps, their dependencies or the deployment contract", () => {
|
|
for (const file of [
|
|
"apps/web/src/server/ports.ts",
|
|
"apps/worker/src/ports.ts",
|
|
"apps/web/package.json",
|
|
"apps/worker/package.json",
|
|
"pnpm-workspace.yaml",
|
|
"compose.dev.yaml",
|
|
".env.example",
|
|
]) {
|
|
expect(read(file), file).not.toMatch(/qdrant|VECTOR_STORE|pgvector/i)
|
|
}
|
|
})
|
|
})
|