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
68 lines
1.9 KiB
Go
68 lines
1.9 KiB
Go
package agenthost
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestValidateHistoricalSessionGraphAcceptsUltimateTurnIdentityAnchor(t *testing.T) {
|
|
graph := historicalIdentityAnchorGraph()
|
|
if err := ValidateHistoricalSessionGraph(graph); err != nil {
|
|
t.Fatalf("ValidateHistoricalSessionGraph() error = %v", err)
|
|
}
|
|
}
|
|
|
|
func TestValidateHistoricalSessionGraphRejectsInvalidTurnIdentityAnchors(t *testing.T) {
|
|
for _, test := range []struct {
|
|
name string
|
|
mutate func(*HistoricalSessionGraph)
|
|
}{
|
|
{
|
|
name: "self",
|
|
mutate: func(graph *HistoricalSessionGraph) {
|
|
graph.Sessions[0].Turns[1].IdentityAnchorTurnID = "implementation-turn"
|
|
},
|
|
},
|
|
{
|
|
name: "missing",
|
|
mutate: func(graph *HistoricalSessionGraph) {
|
|
graph.Sessions[0].Turns[1].IdentityAnchorTurnID = "missing-turn"
|
|
},
|
|
},
|
|
{
|
|
name: "nested",
|
|
mutate: func(graph *HistoricalSessionGraph) {
|
|
graph.Sessions[0].Turns = append(graph.Sessions[0].Turns, HistoricalTurn{
|
|
ID: "nested-turn", IdentityAnchorTurnID: "implementation-turn",
|
|
Phase: "settled", Origin: "user_prompt",
|
|
})
|
|
},
|
|
},
|
|
} {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
graph := historicalIdentityAnchorGraph()
|
|
test.mutate(&graph)
|
|
if err := ValidateHistoricalSessionGraph(graph); !errors.Is(err, ErrHistoricalStateConflict) {
|
|
t.Fatalf("ValidateHistoricalSessionGraph() error = %v, want conflict", err)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func historicalIdentityAnchorGraph() HistoricalSessionGraph {
|
|
return HistoricalSessionGraph{
|
|
RootSessionID: "session-root",
|
|
Sessions: []HistoricalSession{{
|
|
ID: "session-root", Kind: "root", AgentTargetID: "local:codex",
|
|
Provider: "codex", ProviderSessionID: "provider-session-root",
|
|
Turns: []HistoricalTurn{
|
|
{ID: "plan-turn", Phase: "settled", Origin: "user_prompt"},
|
|
{
|
|
ID: "implementation-turn", IdentityAnchorTurnID: "plan-turn",
|
|
Phase: "settled", Origin: "user_prompt",
|
|
},
|
|
},
|
|
}},
|
|
}
|
|
}
|