refactor(transfer): complete durable recovery state machine

This commit is contained in:
jxxghp
2026-08-28 00:03:36 +08:00
parent 513d867dd6
commit e9de149dbf
48 changed files with 5421 additions and 1140 deletions
@@ -11,6 +11,7 @@ flush 前的事件。因此这里断言的是「绕过 Oper 直接建模写库
"""
import pytest
from app.application.transfer.workflow import TransferPlanningInput
from app.db.models.transferhistory import TransferHistory
from app.db.models.transferpending import TransferPending
from app.schemas.types import MediaSource
@@ -158,6 +159,12 @@ def test_tables_without_identity_columns_are_untouched(db):
不带身份列的表不受影响——事件挂在 Mapper 上覆盖全部映射,必须靠列名检查收窄,
否则会去动一张根本没有这两列的表。
"""
planning_input = TransferPlanningInput(source_fileitem={
"storage": "local",
"path": "/mnt/a.mkv",
"type": "file",
"name": "a.mkv",
})
TransferPending.stage_admit(
db.session,
task_id="identity-free-table",
@@ -165,6 +172,9 @@ def test_tables_without_identity_columns_are_untouched(db):
src_path="/mnt/a.mkv",
state="accepted",
now_time="2026-08-14 10:00:00",
input_version=planning_input.schema_version,
planning_input=planning_input.to_payload(),
input_fingerprint=planning_input.fingerprint,
)
row = TransferPending.get_by_identity(