MCPcopy
hub / github.com/google/ax / TestServer_Fork_RequiresDestID

Function TestServer_Fork_RequiresDestID

internal/server/server_test.go:92–129  ·  view source on GitHub ↗

TestServer_Fork_RequiresDestID verifies that ForkConversation rejects a request without DestConversationId. The substrate router relies on the dest ID to bring up the conversation's actor before the handler runs, so we can't accept empty IDs at this layer.

(t *testing.T)

Source from the content-addressed store, hash-verified

90// the dest ID to bring up the conversation's actor before the handler
91// runs, so we can't accept empty IDs at this layer.
92func TestServer_Fork_RequiresDestID(t *testing.T) {
93 ctx := context.Background()
94 srcCID := "src-conv"
95
96 log := &executortest.MemoryEventLog{}
97 log.AllEvents = []*proto.ConversationEvent{
98 {
99 ConversationId: srcCID,
100 Seq: 1,
101 Messages: []*proto.Message{
102 {Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "msg 1"}}}},
103 },
104 State: proto.State_STATE_COMPLETED,
105 },
106 }
107
108 c, err := controller.New(ctx, controller.Config{
109 EventLogBuilder: func() (executor.EventLog, error) {
110 return log, nil
111 },
112 PlannerBuilder: func(ctx context.Context, r *controller.Registry) (agent.Agent, error) {
113 return &dummyAgent{}, nil
114 },
115 })
116 if err != nil {
117 t.Fatal(err)
118 }
119 defer c.Close()
120
121 s := New(c)
122
123 if _, err := s.ForkConversation(ctx, &proto.ForkConversationRequest{
124 SrcConversationId: srcCID,
125 // DestConversationId intentionally left empty.
126 }); err == nil {
127 t.Fatal("expected InvalidArgument when DestConversationId is empty, got nil")
128 }
129}

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
NewFunction · 0.70
CloseMethod · 0.65
ForkConversationMethod · 0.65

Tested by

no test coverage detected