Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
41 lines
1.6 KiB
Go
41 lines
1.6 KiB
Go
package storesqlite
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestGetSessionAndTurnUsesOneCanonicalSnapshot(t *testing.T) {
|
|
store := openTestStore(t, testOptions(&staticProjectPaths{}))
|
|
ctx := context.Background()
|
|
seedTurnTestSession(t, store, "ws-snapshot", "session-snapshot")
|
|
|
|
if _, accepted, err := store.RecordTurnTransition(ctx, TurnTransition{
|
|
WorkspaceID: "ws-snapshot", AgentSessionID: "session-snapshot", TurnID: "turn-1",
|
|
Phase: TurnPhaseRunning, OccurredAtUnixMS: 10,
|
|
}); err != nil || !accepted {
|
|
t.Fatalf("record running turn accepted=%v error=%v", accepted, err)
|
|
}
|
|
session, turn, found, err := store.GetSessionAndTurn(ctx, "ws-snapshot", "session-snapshot", "turn-1")
|
|
if err != nil || !found {
|
|
t.Fatalf("GetSessionAndTurn() found=%v error=%v", found, err)
|
|
}
|
|
if session.ActiveTurnID != turn.TurnID || turn.Phase != TurnPhaseRunning {
|
|
t.Fatalf("live snapshot session=%#v turn=%#v", session, turn)
|
|
}
|
|
|
|
if _, accepted, err := store.RecordTurnTransition(ctx, TurnTransition{
|
|
WorkspaceID: "ws-snapshot", AgentSessionID: "session-snapshot", TurnID: "turn-1",
|
|
Phase: TurnPhaseSettled, Outcome: TurnOutcomeCompleted, OccurredAtUnixMS: 20,
|
|
}); err != nil || !accepted {
|
|
t.Fatalf("record settled turn accepted=%v error=%v", accepted, err)
|
|
}
|
|
session, turn, found, err = store.GetSessionAndTurn(ctx, "ws-snapshot", "session-snapshot", "turn-1")
|
|
if err != nil || !found {
|
|
t.Fatalf("GetSessionAndTurn() terminal found=%v error=%v", found, err)
|
|
}
|
|
if session.ActiveTurnID != "" || turn.Phase != TurnPhaseSettled || turn.Outcome != TurnOutcomeCompleted {
|
|
t.Fatalf("terminal snapshot session=%#v turn=%#v", session, turn)
|
|
}
|
|
}
|