Files
Maven/cmd/mavend/fact_subject_test.go
T
claude a4abcdefa3 Give the daemon a heads_path and a fixture arm (V-664)
embedder.heads_path is empty by default and deploy/mavend.json sets
it. A missing or broken weights file logs and leaves the heads nil,
because refusing to start over a routing accelerator would trade a
working box for a better one.

TestONNXRoutingHeads is the same cascade TestONNXBaseline scores with
one arm added, so the two are directly comparable. It also checks the
Go tokenizer against the Python one, since the heads were trained
through transformers and are read through a hand-written tokenizer: a
mismatch shows up here as a score below what Python measured on the
same weights, and nowhere else. That is how the reversed word pieces
were found.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ptwopxyo3Z2kwFckHkLvN
2026-08-08 22:24:47 +04:00

55 lines
1.6 KiB
Go

package main
import (
"context"
"testing"
"time"
"github.com/kami/maven/internal/ipc"
"github.com/kami/maven/internal/memory"
"github.com/kami/maven/internal/router"
"github.com/kami/maven/internal/tool"
"github.com/kami/maven/internal/voice"
)
// TestApplyAction_FactCapture_QueuesEntityResolution covers the wiring from
// Vikunja #279: a voice-tapped fact's key doubles as its entity-resolution
// subject, so writing a fact through applyAction (not directly through the
// store) must leave it in the fact-enrichment pending queue.
func TestApplyAction_FactCapture_QueuesEntityResolution(t *testing.T) {
ctx := context.Background()
st := newTestStore(t)
api := ipc.NewStoreAPI(st)
now := time.Now()
emb := router.NewHashEmbedder(1024)
matcher := tool.NewMatcher(api)
rtr := buildRouter(emb, matcher, 0.55, nil, nil)
h := &reactiveHandler{
api: api,
recall: recallWiring{embedder: emb, memStore: memory.NewInMemoryStore()},
router: rtr,
replier: voice.NewStubReplier(),
now: func() time.Time { return now },
dataStore: st,
}
dec := router.Decision{
Intent: router.IntentFact,
Slots: router.Slots{Key: "the espresso machine", HasKey: true, Value: `"needs descaling"`},
}
h.applyAction(ctx, dec)
pending, err := st.PendingFactResolutions(ctx, 10)
if err != nil {
t.Fatalf("PendingFactResolutions: %v", err)
}
if len(pending) != 1 {
t.Fatalf("expected 1 fact queued for entity resolution, got %d: %+v", len(pending), pending)
}
if pending[0].Subject != "the espresso machine" {
t.Fatalf("expected subject to carry the fact key, got %q", pending[0].Subject)
}
}