Harden semantic boundaries and repair dialogue state

Replace nearest-neighbour personal routing with a frozen class-balanced linear head measured on historical, stratified, cross-validation, holdout, and fresh challenge gates (V-702). Close the four repair handoff holes, preserve nested clarification flows, and route Russian possession statements through structural grammar rather than lexical exceptions (V-573). Owner explicitly requested direct commits to master.
This commit is contained in:
2026-08-13 03:00:31 +04:00
parent 35c6ff5a71
commit 8015fdbb79
24 changed files with 2644 additions and 172 deletions
+16
View File
@@ -62,6 +62,22 @@ func TestStackPoppedEntryIsGone(t *testing.T) {
}
}
func TestCompleteTopKeepsSuspendedFlow(t *testing.T) {
s := NewClarifyStore(time.Minute)
bottom := parked("напомни", pendingBase)
top := parked("погода", pendingBase)
s.Push("voice", bottom)
s.Push("voice", top)
completed, resumed := s.CompleteTop("voice", pendingBase)
if completed != top || resumed != bottom {
t.Fatalf("completed=%p resumed=%p, want top=%p bottom=%p", completed, resumed, top, bottom)
}
if got := s.Depth("voice"); got != 1 {
t.Fatalf("depth=%d, want one surviving flow", got)
}
}
// Past MaxStackDepth the oldest entry comes back to the caller instead of
// vanishing — it is the caller's job to say it was dropped.
func TestStackDepthBoundReturnsTheDroppedEntry(t *testing.T) {