feat(work): persist agent execution state

This commit is contained in:
m
2026-08-22 12:08:43 +03:00
parent f792d208ef
commit 8081b4de34
5 changed files with 164 additions and 2 deletions
@@ -0,0 +1,33 @@
package agent_execution_test
import (
"os"
"strings"
"testing"
)
func TestDurableAgentExecutionMigrationDefinesOwnedState(t *testing.T) {
data, err := os.ReadFile("../../database/migrations/029_work_agent_execution_persistence.sql")
if err != nil {
t.Fatal(err)
}
sql := string(data)
for _, table := range []string{
"work.agent_dispatch_intents",
"work.agent_leases",
"work.agent_callback_heads",
} {
if !strings.Contains(sql, "CREATE TABLE IF NOT EXISTS "+table) {
t.Fatalf("migration does not define %s", table)
}
}
for _, marker := range []string{
"UNIQUE",
"CHECK (state IN ('ACTIVE','EXPIRED'))",
"CHECK (fencing_token > 0)",
} {
if !strings.Contains(sql, marker) {
t.Fatalf("migration/repository contract marker missing: %s", marker)
}
}
}