[feat]:[FL-205][ATP模型文件存储改造]

- 移除 releases 层级
- 新增 voltage_level(电压等级)和 tower_type(塔型)作为目录层级
- 修改存储路径结构:/atp-library/{voltage_level}/{tower_type}/{asset_code}/r{release_no}
- 更新相关测试用例

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
chengkai3
2026-06-28 10:27:46 +08:00
parent 081c201b2e
commit b82e005b7c
2 changed files with 9 additions and 7 deletions
+6 -4
View File
@@ -64,7 +64,7 @@ VALID_RELEASE_STATUS = {"draft", "released", "archived"}
VALID_RUNNER_KIND = {"atp", "egm", "hybrid"}
VALID_RUN_STATUS = {"pending", "running", "success", "failed"}
LOG_MAX_CHARS = 200_000
ATP_ASSET_RELEASES_ROOT = "/atp-library/releases"
ATP_ASSET_RELEASES_ROOT = "/atp-library"
@dataclass(slots=True)
@@ -349,9 +349,11 @@ def _sanitize_storage_segment(value: str, *, fallback: str) -> str:
return normalized or fallback
def _build_release_storage_root(asset_code: str, release_no: int) -> str:
def _build_release_storage_root(asset_code: str, release_no: int, voltage_level: str, tower_type: str) -> str:
asset_segment = _sanitize_storage_segment(asset_code, fallback="asset")
return normalize_virtual_path(f"{ATP_ASSET_RELEASES_ROOT}/{asset_segment}/r{release_no}")
voltage_segment = _sanitize_storage_segment(voltage_level, fallback="unknown-voltage")
tower_segment = _sanitize_storage_segment(tower_type, fallback="unknown-tower")
return normalize_virtual_path(f"{ATP_ASSET_RELEASES_ROOT}/{voltage_segment}/{tower_segment}/{asset_segment}/r{release_no}")
def _write_archive_to_storage(
@@ -1045,7 +1047,7 @@ def create_release_from_archive(
next_release_no = int(
db.scalar(select(func.max(AtpAssetRelease.release_no)).where(AtpAssetRelease.asset_id == asset_id)) or 0
) + 1
storage_root_path = _build_release_storage_root(asset.code, next_release_no)
storage_root_path = _build_release_storage_root(asset.code, next_release_no, voltage_level, tower_type)
mount = _resolve_mount(db, "main")
driver = _build_driver_or_400(mount)
+3 -3
View File
@@ -140,14 +140,14 @@ def test_create_release_from_archive_extracts_zip_and_inherits_asset_dimensions(
assert created.release_no == 1
assert created.release_tag == "首版"
assert created.storage_root_path == "/atp-library/releases/ATP-ASSET-UPLOAD/r1"
assert created.storage_root_path == "/atp-library/220/sihuita/ATP-ASSET-UPLOAD/r1"
assert created.entry_file == "work.atp"
assert created.runner_kind == "hybrid"
assert created.voltage_level == "220"
assert created.tower_type == "sihuita"
assert created.scene_type == "raoji3"
assert (tmp_path / "vfs" / "atp-library" / "releases" / "ATP-ASSET-UPLOAD" / "r1" / "work.atp").exists()
assert (tmp_path / "vfs" / "atp-library" / "releases" / "ATP-ASSET-UPLOAD" / "r1" / "EGM" / "config.txt").exists()
assert (tmp_path / "vfs" / "atp-library" / "220" / "sihuita" / "ATP-ASSET-UPLOAD" / "r1" / "work.atp").exists()
assert (tmp_path / "vfs" / "atp-library" / "220" / "sihuita" / "ATP-ASSET-UPLOAD" / "r1" / "EGM" / "config.txt").exists()
finally:
session.close()