agent build
This commit is contained in:
@@ -693,8 +693,13 @@ func TestMigration000005IsReversible(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Every migration still has a matching down file, and 000005 is the newest.
|
||||
func TestMigrationPairsIncluding000005(t *testing.T) {
|
||||
// Every migration has a matching down file, and the set is what we think it is.
|
||||
//
|
||||
// The list is written out rather than counted. A migration is the one kind of
|
||||
// change that cannot be undone by editing a file, so adding one should require
|
||||
// naming it here — a bare count would let a stray file slip in by incrementing
|
||||
// a number, which is exactly the review nobody performs.
|
||||
func TestMigrationPairsAreComplete(t *testing.T) {
|
||||
ups := testutil.MigrationFiles(t, ".up.sql")
|
||||
downs := testutil.MigrationFiles(t, ".down.sql")
|
||||
if len(ups) != len(downs) {
|
||||
@@ -706,17 +711,36 @@ func TestMigrationPairsIncluding000005(t *testing.T) {
|
||||
t.Errorf("%s has no matching down migration (found %s)", up, downs[i])
|
||||
}
|
||||
}
|
||||
if len(ups) != 5 {
|
||||
t.Errorf("%d migrations, want 5", len(ups))
|
||||
|
||||
want := []string{
|
||||
"000001_initial_schema.up.sql",
|
||||
"000002_application_interview_id.up.sql",
|
||||
"000003_drop_screened_consistent_check.up.sql",
|
||||
"000004_auth_sessions.up.sql",
|
||||
"000005_agent_skill_definitions.up.sql",
|
||||
"000006_agent_runs.up.sql",
|
||||
"000007_agent_confirmations.up.sql",
|
||||
"000008_knowledge.up.sql",
|
||||
"000009_confirmation_replay.up.sql",
|
||||
"000010_definition_versions.up.sql",
|
||||
}
|
||||
if ups[4] != "000005_agent_skill_definitions.up.sql" {
|
||||
t.Errorf("the last migration is %s", ups[4])
|
||||
if len(ups) != len(want) {
|
||||
t.Fatalf("%d migrations, want %d — update this list deliberately", len(ups), len(want))
|
||||
}
|
||||
for i, name := range want {
|
||||
if ups[i] != name {
|
||||
t.Errorf("migration %d is %s, want %s", i+1, ups[i], name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 000005 creates exactly two tables and nothing else. The Phase 4B decision was
|
||||
// explicit about which tables must NOT appear; this is that decision, asserted.
|
||||
func TestMigrationAddsExactlyTwoTables(t *testing.T) {
|
||||
// The tables that exist, counted, plus the ones that deliberately do not.
|
||||
//
|
||||
// The Phase 4B decision was explicit about which tables must NOT appear, and
|
||||
// that half of this test is the durable half — the forbidden list below is a
|
||||
// design decision, not a snapshot. The count is the snapshot, and it is here so
|
||||
// that a table arriving without a decision behind it fails somewhere.
|
||||
func TestMigrationsAddOnlyTheTablesWeDecidedOn(t *testing.T) {
|
||||
f := newFixture(t, "defs_tablecount")
|
||||
|
||||
var n int
|
||||
@@ -725,14 +749,22 @@ func TestMigrationAddsExactlyTwoTables(t *testing.T) {
|
||||
WHERE table_schema='public' AND table_type='BASE TABLE'`).Scan(&n); err != nil {
|
||||
t.Fatalf("count tables: %v", err)
|
||||
}
|
||||
// 17 from 000001 + sessions from 000004 + the two here. schema_migrations is
|
||||
// golang-migrate's and is absent when the files are applied directly.
|
||||
if n != 20 {
|
||||
t.Errorf("%d base tables after every migration, want 20", n)
|
||||
// 17 from 000001, + auth_sessions (000004), + agent_definitions and
|
||||
// skill_definitions (000005), + agent_runs (000006), + agent_confirmations
|
||||
// (000007), + knowledge_documents and knowledge_chunks (000008),
|
||||
// + definition_versions (000010). schema_migrations is golang-migrate's and
|
||||
// is absent when the files are applied directly.
|
||||
if n != 25 {
|
||||
t.Errorf("%d base tables after every migration, want 25", n)
|
||||
}
|
||||
|
||||
// `definition_versions` was on this list, deferred by the Phase 4B decision.
|
||||
// It is built now — §3's "specs are immutable once published" needs it, and
|
||||
// a run recording an agent_version that resolves to nothing is a record
|
||||
// nobody can explain. Removed from the list deliberately rather than
|
||||
// silently, which is the whole reason the list is written out.
|
||||
for _, forbidden := range []string{
|
||||
"definition_versions", "definition_permissions", "agent_skills",
|
||||
"definition_permissions", "agent_skills",
|
||||
"agent_subagents", "agent_knowledge", "conversations",
|
||||
"conversation_messages", "conversation_feedback",
|
||||
} {
|
||||
|
||||
Reference in New Issue
Block a user