This commit is contained in:
@@ -142,9 +142,11 @@ async def migrated_pre_v3_repository(tmp_path: Path) -> Repository:
|
||||
return repository
|
||||
|
||||
|
||||
async def test_schema_v2_migration_reconstructs_identity_order_and_iterate_commands(
|
||||
async def test_schema_v2_migration_preserves_jobs_and_reconstructs_state_machine_identity(
|
||||
migrated_pre_v3_repository: Repository,
|
||||
) -> None:
|
||||
terminal = await migrated_pre_v3_repository.get_job("pre-v3-job-a-terminal")
|
||||
queued = await migrated_pre_v3_repository.get_job("pre-v3-job-b-queued")
|
||||
with (
|
||||
closing(sqlite3.connect(migrated_pre_v3_repository.database_path)) as connection,
|
||||
connection,
|
||||
@@ -153,6 +155,10 @@ async def test_schema_v2_migration_reconstructs_identity_order_and_iterate_comma
|
||||
"SELECT id, delivery_id, receive_sequence, command_body FROM jobs "
|
||||
"ORDER BY receive_sequence"
|
||||
).fetchall()
|
||||
storage_fields = connection.execute(
|
||||
"""SELECT id, started_comment_id, created_at, started_at, finished_at
|
||||
FROM jobs ORDER BY receive_sequence"""
|
||||
).fetchall()
|
||||
|
||||
assert migrated == [
|
||||
(
|
||||
@@ -164,21 +170,6 @@ async def test_schema_v2_migration_reconstructs_identity_order_and_iterate_comma
|
||||
("pre-v3-job-b-queued", "delivery-queued", 2, "/agent iterate refine plan"),
|
||||
]
|
||||
|
||||
|
||||
async def test_schema_v2_migration_preserves_pre_v3_job_fields(
|
||||
migrated_pre_v3_repository: Repository,
|
||||
) -> None:
|
||||
terminal = await migrated_pre_v3_repository.get_job("pre-v3-job-a-terminal")
|
||||
queued = await migrated_pre_v3_repository.get_job("pre-v3-job-b-queued")
|
||||
with (
|
||||
closing(sqlite3.connect(migrated_pre_v3_repository.database_path)) as connection,
|
||||
connection,
|
||||
):
|
||||
storage_fields = connection.execute(
|
||||
"""SELECT id, started_comment_id, created_at, started_at, finished_at
|
||||
FROM jobs ORDER BY receive_sequence"""
|
||||
).fetchall()
|
||||
|
||||
assert (
|
||||
terminal
|
||||
and (
|
||||
@@ -386,7 +377,18 @@ def durable_snapshot(database_path: Path) -> tuple[object, ...]:
|
||||
return (
|
||||
connection.execute("SELECT version FROM schema_migrations ORDER BY version").fetchall(),
|
||||
connection.execute(
|
||||
"SELECT id, delivery_id, receive_sequence, command_body FROM jobs ORDER BY id"
|
||||
"""SELECT id, kind, target_key, repo_owner, repo_name, issue_number, pr_number,
|
||||
requester, message, comment_id, delivery_id, receive_sequence,
|
||||
command_body, workflow_id, status, stage, error, runtime_session_id,
|
||||
accepted_comment_id, started_comment_id, comment_body, created_at,
|
||||
started_at, finished_at
|
||||
FROM jobs ORDER BY id"""
|
||||
).fetchall(),
|
||||
connection.execute(
|
||||
"""SELECT id, kind, repo_owner, repo_name, issue_number, pr_number, base_sha,
|
||||
branch, workspace_path, primary_session_id, reviewer_session_id,
|
||||
artifact, review_json, status, runtime, created_at, updated_at
|
||||
FROM workflows ORDER BY id"""
|
||||
).fetchall(),
|
||||
connection.execute(
|
||||
"""SELECT event_id, job_id, event_type, payload_json
|
||||
|
||||
Reference in New Issue
Block a user