Files
Agent-System-Backend/internal/rag/hash_embed_test.go
T
weichenandCursor cd5b82186d Add the public extension surface and platform services
Why: Downstream products must extend the base through a public package and host API instead of editing internal code.
Evidence: go test ./... passed, including plugin v2 assets, sidecar startup, migration v13, pending confirms, HITL timeout, hash embedder, command pairs, and the extension surface snapshot.
Impact: apiVersion 2.0-experimental rejects empty network allowlists for declarative HTTP. Hash embeddings stay opt-in via models.embedding.provider=hash. Plugin secrets resolve per owner at execution time.
Refs: docs/proposals/2026-10-01-plugin-contract-v2.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 10:35:02 +00:00

23 lines
463 B
Go

package rag
import (
"context"
"testing"
)
func TestHashEmbedderStable(t *testing.T) {
a, err := HashEmbedder{}.Embed(context.Background(), []string{"需求追溯"})
if err != nil {
t.Fatal(err)
}
b, _ := HashEmbedder{}.Embed(context.Background(), []string{"需求追溯"})
if len(a) != 1 || len(a[0]) != hashDim {
t.Fatalf("dim: %d", len(a[0]))
}
for i := range a[0] {
if a[0][i] != b[0][i] {
t.Fatal("hash embedder must be stable")
}
}
}