feat(core,backends,frontends,storage): conversations, inject queue, session pool, gateway mcp tools, api frontend
This commit is contained in:
@@ -31,3 +31,31 @@ async def test_create_all_adds_missing_columns() -> None:
|
||||
session.add(conv)
|
||||
await session.commit()
|
||||
await db.dispose()
|
||||
|
||||
|
||||
async def test_create_all_backfills_defaults_for_old_rows() -> None:
|
||||
path = Path(tempfile.mkdtemp(prefix="beaver-migrate-")) / "old.db"
|
||||
raw = sqlite3.connect(path)
|
||||
raw.execute(
|
||||
"CREATE TABLE conversations (id INTEGER PRIMARY KEY, frontend VARCHAR NOT NULL, "
|
||||
"external_id VARCHAR NOT NULL, agent_name VARCHAR NOT NULL, session_id VARCHAR, "
|
||||
"created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL)"
|
||||
)
|
||||
raw.execute(
|
||||
"INSERT INTO conversations VALUES (1, 'markdown', 'x', 'a', NULL, '2026-01-01', '2026-01-01')"
|
||||
)
|
||||
raw.commit()
|
||||
raw.close()
|
||||
|
||||
db = Database(f"sqlite:///{path}")
|
||||
await db.create_all()
|
||||
async with db.session() as session:
|
||||
conv = (await session.exec(select(Conversation))).one()
|
||||
assert (conv.kind, conv.status, conv.pending_question, conv.flags) == (
|
||||
"deep",
|
||||
"open",
|
||||
False,
|
||||
{},
|
||||
)
|
||||
assert conv.running_turn is None
|
||||
await db.dispose()
|
||||
|
||||
Reference in New Issue
Block a user