MCPcopy Index your code
hub / github.com/coder/coder / seedChatDebugRun

Function seedChatDebugRun

coderd/exp_chats_test.go:12470–12490  ·  view source on GitHub ↗

seedChatDebugRun inserts a debug run for a chat, bypassing the chatd service so HTTP handlers can be exercised in isolation. Steps are inserted separately via seedChatDebugStep.

(
	ctx context.Context,
	t *testing.T,
	db database.Store,
	chatID uuid.UUID,
	startedAt time.Time,
)

Source from the content-addressed store, hash-verified

12468// service so HTTP handlers can be exercised in isolation. Steps are
12469// inserted separately via seedChatDebugStep.
12470func seedChatDebugRun(
12471 ctx context.Context,
12472 t *testing.T,
12473 db database.Store,
12474 chatID uuid.UUID,
12475 startedAt time.Time,
12476) database.ChatDebugRun {
12477 t.Helper()
12478
12479 run, err := db.InsertChatDebugRun(dbauthz.AsSystemRestricted(ctx), database.InsertChatDebugRunParams{
12480 ChatID: chatID,
12481 Kind: string(codersdk.ChatDebugRunKindChatTurn),
12482 Status: string(codersdk.ChatDebugStatusInProgress),
12483 Provider: sql.NullString{String: "openai", Valid: true},
12484 Model: sql.NullString{String: "gpt-4o-mini", Valid: true},
12485 StartedAt: sql.NullTime{Time: startedAt, Valid: true},
12486 UpdatedAt: sql.NullTime{Time: startedAt, Valid: true},
12487 })
12488 require.NoError(t, err)
12489 return run
12490}
12491
12492func seedChatDebugStep(
12493 ctx context.Context,

Callers 2

TestChatDebugRunsFunction · 0.85
TestChatDebugRunFunction · 0.85

Calls 3

AsSystemRestrictedFunction · 0.92
HelperMethod · 0.65
InsertChatDebugRunMethod · 0.65

Tested by

no test coverage detected