Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

refactor(media): 删除旧快照根的运行期重映射层

longmeidaofb1617155a13
diff --git a/docs/PRODUCT_BACKLOG.md b/docs/PRODUCT_BACKLOG.md
index c4023b99f..55e15d123 100644
--- a/docs/PRODUCT_BACKLOG.md
+++ b/docs/PRODUCT_BACKLOG.md
@@ -62,7 +62,7 @@
合计:**30 项开放需求**,其中 6 项已有骨架,24 项尚未实现。已完成的需求不在这里留痕,去 Git 历史查。
-## 待执行的操作(38 项)
+## 待执行的操作(37 项)
需要另行授权、外部条件或人工判断才能做的具体操作与复核批次,比上面的需求细一层;做完就删,不在这里留痕。待办只放这一处:`docs/STATUS.md` 每次会话开头都要读,队列不该常驻在那种入口文件里。
@@ -104,13 +104,12 @@
35. 首要原则审查(2026-09-07,George Pickett 的 prompt,覆盖整个 `peach-app`)的剩余清理项。零风险的删除已随分支 `agent/claude/provider-registry-review` 落地,完整报告与判断依据在顶层 `attic/reviews/20260907-first-principles/review.md`;下面每条独立,可单独派工作树:
- follow:`connector_headers` 形参、`blocked_reason` 基类钩子、`FollowCandidate.version` 输入字段只有测试在用;`KemonoConnector.HOSTS`/`SubscribeStarConnector.HOSTS` 与登记表 `url_hosts` 是同一份主机表的第二份;Rule34Video 自带的探测循环可并入 `enrich()`;425/429 进 `_send` 的可重试集后两段手写重试可删。
- follow 弱假设:ETag/304 机制 2026-09-08 只读核查:45 条来源 `etag` 全空、`last_status` 从未出现 `not_modified`,只有 f95zone 的 7 条存下 `last_modified`——条件头有站点在回、304 没有站点回过,机制保留,不再列为待删。六处「读时修旧行」兼容层(`archive_file_url`、`_legacy_history_end`、`_f95_has_resource`、`split_posts`、`author_display_text` 修正、`f95_attachment_media_items`)换成一次带备份的迁移,需 ledger 写授权。
- - Web:`serve --no-ledger-sync`/`--ledger-sync-seconds` 处理代码已删、参数还在,托盘五处与 `docs/OPERATIONS.md` 仍在传——必须和托盘重建同批做,旧 EXE 拉起新代码的窗口期会被 argparse 拒收;四个域 Protocol(`LinkContract`、`PlaylistContract`、`ResourceSyncContract`、`ReviewContract`)换成直接用 `WebContract`,`ContractConformanceTests` 随之删;`same_origin`、来源在线判定、回环判定各有三份,各留一份;`_read_answers`/`_validate` 里「只发 media_dirs」的旧表单分支生产不可达,只靠测试活着;access `legacy` 模式的 `tok` cookie 只被接受不被升级,定截止日删接受分支;`legacy_snapshot_roots` 的运行期前缀重映射贯穿五个模块;2026-09-08 只读核查 12172 行 `snapshot_path` 里 9026 行仍是旧前缀,删链之前要先做第 37 条的迁移。
+ - Web:`serve --no-ledger-sync`/`--ledger-sync-seconds` 处理代码已删、参数还在,托盘五处与 `docs/OPERATIONS.md` 仍在传——必须和托盘重建同批做,旧 EXE 拉起新代码的窗口期会被 argparse 拒收;四个域 Protocol(`LinkContract`、`PlaylistContract`、`ResourceSyncContract`、`ReviewContract`)换成直接用 `WebContract`,`ContractConformanceTests` 随之删;`same_origin`、来源在线判定、回环判定各有三份,各留一份;`_read_answers`/`_validate` 里「只发 media_dirs」的旧表单分支生产不可达,只靠测试活着;access `legacy` 模式的 `tok` cookie 只被接受不被升级,定截止日删接受分支;`legacy_snapshot_roots` 的运行期前缀重映射已随 2026-09-08 的 `snapshot_path` 切换删除。
- 桌面:换 EXE 两条路径(`replace_windows_tray.py` + `windows_update` 内联备份,与 `windows_restart.swap_tray_binary`)留校验更强的后者;`test_runner.py` 把「记录无效」与「用例失败」分成不同退出码(第 33 条的根因);`sync.py` 的 `PUSH_INTERVAL_SECONDS`/`push_if_needed`/`interval` 生产只传 0;`scripts/manage_tray_startup.ps1` 已由 `desktop_startup.py` 接管(同时改 ADR-0011 与 `docs/OPERATIONS.md`);三张「哪些路径算运行时」清单合成一处。
- 领域层:`catalog_rules` 里站名交替串、TLD 列表、`_CODE_DATE` 各写两份;`transcodes.requires_conversion`/`browser_path` 是同一段缓存逻辑;`code_variants` 在 `jav_cover_fetch` 与 `catalog_rules` 各一份;`library_processing` 是第三条 r18 请求路径且跨模块拿私有 `_fetch`;`metadata_seesaa.RoutedMetadataProvider` 只有 `scrape_codes.py` 用,内联。
- - scripts:`audit_creator_attributions.py`(查的 `legacy:asset` 已无写入者)、`apply_metadata_tags.py`(绕过 `/review`)、`creator_tags.py --apply-review`(与 `web_review` 判据不同的第二条写路,`--export-review` 要留)建议删;`backfill_rule34_tag_types.py` 还有活干(第 38 条);7 处绕开 `scripting.open_for_write`、5 处自拼只读 URI、5 处手写线性重试要接上共享实现;`audit_video_endcards.py`、`audit_fc2_similarity.py`、`localize_series_names.py`、`find_ads.py` 还会用但文档没登记,归到 `peach-batch-jobs` 或 `docs/SOURCING.md`。
+ - scripts:`audit_creator_attributions.py`(查的 `legacy:asset` 已无写入者)、`apply_metadata_tags.py`(绕过 `/review`)、`creator_tags.py --apply-review`(与 `web_review` 判据不同的第二条写路,`--export-review` 要留)建议删;`backfill_rule34_tag_types.py` 2026-09-08 已跑完全部待补条目,连接器早已在入库时取类型,脚本可删;7 处绕开 `scripting.open_for_write`、5 处自拼只读 URI、5 处手写线性重试要接上共享实现;`audit_video_endcards.py`、`audit_fc2_similarity.py`、`localize_series_names.py`、`find_ads.py` 还会用但文档没登记,归到 `peach-batch-jobs` 或 `docs/SOURCING.md`。
- tests:约 3 700 条源码文本断言集中在 `test_web_ui.py`(近 90 天 20% 的提交都在改它)与 `test_follow_web.py`;页面断言设施两处各写一份;`test_fastapi_api.BASE_SCHEMA` 手写 19 张表已漂移,31 个文件手写 `CREATE TABLE` 而 `tests/support/ledger.py` 只有 14 个在用。方向是触碰时迁到 `test_web_js.py` 与 `fresh_ledger()`,不整体重写;`check_copy_final_state.py` 的词表不拦「过去/此前」。
- 前端:9 处 `await import('/dist/peach-ui.js')` 与文件顶部静态 import 并存(`test_frontend_build.py` 与 `test_web_ui.py` 钉住了这种写法,要同改);`wireNavigationDrag` 与 `ui-components.wireDragReorder` 双实现;`refreshStore` 零消费;`.fnote` 在 21 与 22 号 CSS 互相覆盖。
- 文档:同一条规则最多写在 15 处(测试入口);`CLAUDE.md` 正文与 AGENTS、worktree 技能重复;`peach-ledger-write`、`peach-reference-evidence`、`peach-worktree` 引用的 HANDOFF 节名已不存在;`docs/STATUS.md` 版本行落后;本文件有 7 对重复条目(7↔18、12↔21②、13↔22、9↔34、8↔30、28↔30)与一节评审记录;`docs/PIKPAK.md` 是按日期的 runbook,流程该归 `peach-batch-jobs`。
36. 域映射门槛只覆盖 `web/` 与 `frontend/`。同一个漏洞在别的前缀上照样成立:`tests/test_babepedia_match.py` 读 `scripts/match_babepedia_creators.py` 却只登记在 metadata 域,改那个脚本时 `auto` 选的是 tooling;`tests/test_frontend_build.py` 读 `docs/CLOUDDRIVE.md`,而 `.md` 一律归 checks。按 `test_runner.repository_paths_read_by` 全树扫一遍,`scripts/`、`docs/`、`.github/`、`resources/` 四类共约三十处。要补的是 `AUTO_SCOPE_PREFIXES` 本身——把逐个脚本映射到它真正的域,像 `scripts/localize_performer_names.py` 那两条那样——补完再把 `tests/test_test_planning.py` 那条门槛的前缀白名单去掉。
-37. 另行授权后先备份 ledger,把 `asset.snapshot_path` 里 9026 行 `R:\Resources\Intake\snapshots\…` 前缀改写成当前根 `R:\peach-data\generated\snapshots\…`(另 3146 行已是新前缀),前后按行数与文件存在性核对;迁移落地后再删 `legacy_snapshot_roots` 与 `LEGACY_SNAPSHOT_DECLARATIONS` 及五个模块里的运行期重映射。
-38. 另行授权后跑 `scripts/backfill_rule34_tag_types.py --apply --backup <落点>`:2026-09-08 只读核查 rule34xxx 的 2396 条 `follow_item` 里 566 条没有 `tag_types`,卡片上因此不显示标签;先 dry-run 看限流情况再 apply。
+37. 决定 800 行指向不存在文件的 `asset.snapshot_path` 怎么办:2026-09-08 切换快照根时 12172 行里 11372 行有文件(其中 2612 张从 `peach-sync/assets/snapshots` 副本补回),余下 800 行在 `generated/snapshots` 与 `peach-sync` 两处都没有(729 条非回收站资产,几乎全是 115 云盘视频);清单在顶层 `attic/reviews/20260908-snapshot-path-cutover/`。要么另行授权置 NULL 让 `scripts/sheets.py` 重抽(115 直连不计费,但每张约 285 MB 流量),要么就让卡片保持无缩略图。
diff --git a/scripts/creator_boards.py b/scripts/creator_boards.py
index 2190f8464..67dbb8743 100644
--- a/scripts/creator_boards.py
+++ b/scripts/creator_boards.py
@@ -33,7 +33,7 @@ from peach.jobs import (
job_main,
)
from peach.platform import system_volume
-from peach.media import remap_managed_path
+from peach.media import normalized_path
def build_parser() -> argparse.ArgumentParser:
@@ -53,12 +53,6 @@ def build_parser() -> argparse.ArgumentParser:
)
parser.add_argument("--db", type=Path, default=DATABASE_PATH)
parser.add_argument("--output-dir", type=Path, default=GENERATED_DIR / "boards")
- parser.add_argument("--snapshot-root", type=Path, default=GENERATED_DIR / "snapshots")
- parser.add_argument(
- "--legacy-snapshot-root",
- type=Path,
- default=Path(r"R:\Resources\Intake\snapshots"),
- )
parser.add_argument("--lock", type=Path, default=STATE_DIR / ".creator-boards.lock")
return parser
@@ -254,7 +248,7 @@ def build_from_snapshots(args: argparse.Namespace, ffmpeg: str, ffprobe: str) ->
for creator, name, asset_path, snapshot in rows:
if is_structural_creator(creator) or is_probable_mainstream_release(name, asset_path):
continue
- path = remap_managed_path(snapshot, args.snapshot_root, (args.legacy_snapshot_root,))
+ path = normalized_path(snapshot)
if path.is_file():
by_creator[creator].append(path)
ranked = [(creator, count) for creator, count in counts.most_common() if len(by_creator.get(creator, [])) >= 4][:args.top]
diff --git a/src/peach/api.py b/src/peach/api.py
index 4f1bf0e47..24ef39161 100644
--- a/src/peach/api.py
+++ b/src/peach/api.py
@@ -106,7 +106,7 @@ def create_app(
settings = settings or PeachSettings()
database = LedgerDatabase(settings.db_path)
contract = web_contract.WebContract(
- settings.db_path, settings.snapshot_root, settings.legacy_snapshot_roots,
+ settings.db_path, settings.snapshot_root,
candidate_root=settings.candidate_root,
cover_root=settings.cover_root,
avatar_root=settings.avatar_root,
@@ -132,12 +132,11 @@ def create_app(
filesystem = FilesystemBackend(
settings.allowed_media_roots,
settings.snapshot_root,
- settings.legacy_snapshot_roots,
)
media_engine = MediaEngine(repository, filesystem)
preview_service = PreviewService(
repository, resolver, settings.snapshot_root, settings.poster_root,
- settings.avatar_root, settings.logo_root, settings.legacy_snapshot_roots,
+ settings.avatar_root, settings.logo_root,
)
photo_service = PhotoThumbnailService(settings.photo_root)
transcode_service = TranscodeService(resolver, settings.transcode_root)
diff --git a/src/peach/config.py b/src/peach/config.py
index 4790dfe60..7636768d8 100644
--- a/src/peach/config.py
+++ b/src/peach/config.py
@@ -13,7 +13,7 @@ from dataclasses import dataclass
from pathlib import Path
from . import settings_file
-from .platform import translate_ledger_path, translate_roots
+from .platform import translate_roots
from .settings_file import PROJECT_ROOT, SettingsFileError
_SETTINGS = settings_file.active()
@@ -73,9 +73,6 @@ MDNS_HOSTNAME: str = f"{MDNS_NAME}.local"
SERVE_HOST: str = _SETTINGS.server.host
SERVE_PORT: int = _SETTINGS.server.port
-# 2026-08 仓库/数据拆分前写入 ledger 的旧快照根;运行时只做受控前缀重映射。
-LEGACY_SNAPSHOT_DECLARATIONS: tuple[str, ...] = (r"R:\Resources\Intake\snapshots",)
-
@dataclass(frozen=True)
class PeachSettings:
@@ -104,9 +101,6 @@ class PeachSettings:
# 本机挂载不到的来源不进授权列表,对应资产按「脱盘」处理而不是报错。
allowed_media_roots: tuple[Path, ...] = translate_roots(MEDIA_ROOT_DECLARATIONS)
snapshot_root: Path = GENERATED_DIR / "snapshots"
- legacy_snapshot_roots: tuple[Path, ...] = tuple(
- translate_ledger_path(root) for root in LEGACY_SNAPSHOT_DECLARATIONS
- )
poster_root: Path = GENERATED_DIR / "posters"
avatar_root: Path = GENERATED_DIR / "avatars"
logo_root: Path = GENERATED_DIR / "logos"
diff --git a/src/peach/media.py b/src/peach/media.py
index 3ff63d5b1..db184e3bc 100644
--- a/src/peach/media.py
+++ b/src/peach/media.py
@@ -73,26 +73,6 @@ def resolve_case_insensitive(path: Path | str) -> str:
return str(candidate)
-def remap_managed_path(
- path: Path | str,
- current_root: Path,
- legacy_roots: Sequence[Path] = (),
-) -> Path:
- """将拆分前的受控根映射到当前根,不接受 basename 搜索。"""
- candidate = normalized_path(path)
- current = normalized_path(current_root)
- if candidate == current or current in candidate.parents:
- return candidate
- for legacy_root in legacy_roots:
- legacy = normalized_path(legacy_root)
- try:
- relative = candidate.relative_to(legacy)
- except ValueError:
- continue
- return current / relative
- return candidate
-
-
@dataclass(frozen=True)
class StreamPlan:
"""协议层播放计划;来源层决定是否值得切到短分片。"""
@@ -124,7 +104,7 @@ class MediaOffline(MediaUnavailable):
class FilesystemBackend:
- """原生文件 backend;路径授权、旧快照映射和存在性检查集中在这里。"""
+ """原生文件 backend;路径授权和存在性检查集中在这里。"""
name = "filesystem"
@@ -132,23 +112,15 @@ class FilesystemBackend:
self,
allowed_roots: Sequence[Path],
snapshot_root: Path,
- legacy_snapshot_roots: Sequence[Path] = (),
):
self.allowed_roots = tuple(normalized_path(root) for root in allowed_roots)
self.snapshot_root = normalized_path(snapshot_root)
- self.legacy_snapshot_roots = tuple(
- normalized_path(root) for root in legacy_snapshot_roots
- )
def file_for(self, asset: MediaAsset, thumbnail: bool = False) -> Path:
raw = asset.snapshot_path if thumbnail else asset.path
if not raw:
raise MediaUnavailable(asset.id)
- path = (
- remap_managed_path(raw, self.snapshot_root, self.legacy_snapshot_roots)
- if thumbnail
- else normalized_path(raw)
- )
+ path = normalized_path(raw)
roots = (self.snapshot_root,) if thumbnail else self.allowed_roots
if not any(within_root(path, root) for root in roots):
self._raise_unavailable(asset.id, raw, thumbnail)
diff --git a/src/peach/previews.py b/src/peach/previews.py
index 8fbb08f23..0cb14a175 100644
--- a/src/peach/previews.py
+++ b/src/peach/previews.py
@@ -10,7 +10,7 @@ from PIL import Image, ImageOps
from .ffmpeg import FFmpegResolver
from .fsutil import atomic_path
-from .media import remap_managed_path
+from .media import normalized_path
from .repository import LedgerRepository
@@ -85,15 +85,13 @@ def _generate_lock(destination: Path) -> threading.Lock:
class PreviewService:
def __init__(self, repository: LedgerRepository, resolver: FFmpegResolver,
- snapshot_root: Path, poster_root: Path, avatar_root: Path, logo_root: Path,
- legacy_snapshot_roots: tuple[Path, ...] = ()):
+ snapshot_root: Path, poster_root: Path, avatar_root: Path, logo_root: Path):
self.repository = repository
self.resolver = resolver
self.snapshot_root = snapshot_root.resolve()
self.poster_root = poster_root.resolve()
self.avatar_root = avatar_root.resolve()
self.logo_root = logo_root.resolve()
- self.legacy_snapshot_roots = tuple(path.resolve() for path in legacy_snapshot_roots)
#: 标识清晰度按 (路径, mtime, 字节数) 记住,换了文件自然算新键。大位每格一次
#: 请求,不缓存就是一屏一百多次开图读头。
self._logo_sharpness: dict[tuple[str, int, int], tuple[int, int]] = {}
@@ -262,9 +260,7 @@ class PreviewService:
asset = self.repository.media_asset(asset_id)
if asset is None or not asset.snapshot_path:
raise PreviewUnavailable("snapshot unavailable")
- path = remap_managed_path(
- asset.snapshot_path, self.snapshot_root, self.legacy_snapshot_roots,
- )
+ path = normalized_path(asset.snapshot_path)
if not (path == self.snapshot_root or self.snapshot_root in path.parents) or not path.is_file():
raise PreviewUnavailable("snapshot unavailable")
return path
diff --git a/src/peach/web_resource_sync.py b/src/peach/web_resource_sync.py
index 5cfea0fc7..841d6ca1f 100644
--- a/src/peach/web_resource_sync.py
+++ b/src/peach/web_resource_sync.py
@@ -19,7 +19,7 @@ from typing import Callable, Protocol, Sequence
from .catalog_rules import dir_expr, normalise_code_key, photo_set_title
from .config import LOCATION_ROOT_DECLARATIONS
from .jobs import BackgroundJob
-from .media import remap_managed_path
+from .media import normalized_path
from .platform import is_unmapped, root_online, translate_ledger_path
@@ -28,7 +28,6 @@ class ResourceSyncContract(Protocol):
db_path: Path
snapshot_root: Path | None
- legacy_snapshot_roots: tuple[Path, ...]
cover_root: Path
poster_root: Path
avatar_root: Path
@@ -210,9 +209,8 @@ def _resource_orphan_plan(contract: ResourceSyncContract, excluded_ids: Sequence
for row in rows:
raw = row["snapshot_path"]
if raw:
- active_snapshots.add(remap_managed_path(
- raw, contract.snapshot_root, contract.legacy_snapshot_roots,
- ) if contract.snapshot_root is not None else Path(raw))
+ active_snapshots.add(normalized_path(raw)
+ if contract.snapshot_root is not None else Path(raw))
files: list[tuple[str, Path, int]] = []
cleanup_dirs: set[Path] = set()
diff --git a/src/peach/web_state.py b/src/peach/web_state.py
index 0a2d93ad3..b57d00076 100644
--- a/src/peach/web_state.py
+++ b/src/peach/web_state.py
@@ -19,7 +19,7 @@ import time
from collections import OrderedDict
from pathlib import Path
-from typing import NamedTuple, Sequence
+from typing import NamedTuple
from .catalog_rules import normalise_code_key
from .config import (
@@ -32,7 +32,7 @@ from .config import (
STATE_DIR,
)
from .jobs import BackgroundJob
-from .media import remap_managed_path
+from .media import normalized_path
# `previews` 是取图那一侧,不是 web 域处理器:依赖方向仍然只有一个走法。落盘名的
# 规则必须和 `/logo` 用的是同一个函数,否则可用性判定迟早和取图对不上。
from .previews import ENTITY_IMAGE_KINDS, LOGO_VARIANTS, entity_image_key, logo_key
@@ -99,7 +99,6 @@ class WebContract:
"""单个应用实例的数据库、写锁和聚合缓存;不共享模块级可变状态。"""
def __init__(self, db_path: Path, snapshot_root: Path | None = None,
- legacy_snapshot_roots: Sequence[Path] = (),
candidate_root: Path | None = None,
cover_root: Path | None = None,
avatar_root: Path | None = None,
@@ -160,7 +159,6 @@ class WebContract:
self.database = database or LedgerDatabase(db_path)
self.db_path = self.database.db_path
self.snapshot_root = Path(snapshot_root) if snapshot_root is not None else None
- self.legacy_snapshot_roots = tuple(Path(path) for path in legacy_snapshot_roots)
self.cache: OrderedDict[str, tuple[float, object]] = OrderedDict()
self.cache_lock = threading.Lock()
#: 按资产取键的读缓存,LRU 限界。键空间不封闭的场景走这里,见 `cached_lru()`。
@@ -265,9 +263,7 @@ class WebContract:
def has_snapshot(self, raw_path: str | None) -> bool:
if not raw_path:
return False
- path = (remap_managed_path(
- raw_path, self.snapshot_root, self.legacy_snapshot_roots,
- ) if self.snapshot_root is not None else Path(raw_path))
+ path = normalized_path(raw_path) if self.snapshot_root is not None else Path(raw_path)
return path.is_file()
def cover_path(self, code: str | None) -> Path | None:
diff --git a/tests/test_fastapi_api.py b/tests/test_fastapi_api.py
index 03c9a8486..c01adb248 100644
--- a/tests/test_fastapi_api.py
+++ b/tests/test_fastapi_api.py
@@ -131,7 +131,6 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):
self.db = self.root / "ledger.db"
self.media_root = self.root / "media"
self.snapshot_root = self.root / "snapshots"
- self.legacy_snapshot_root = self.root / "legacy-snapshots"
self.poster_root = self.root / "posters"
self.avatar_root = self.root / "avatars"
self.logo_root = self.root / "logos"
@@ -167,7 +166,6 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):
self.snapshot_file = self.snapshot_root / "cloud" / "local" / "one.jpg"
self.snapshot_file.parent.mkdir(parents=True)
self.snapshot_file.write_bytes(b"snapshot")
- self.legacy_snapshot_file = self.legacy_snapshot_root / "cloud" / "local" / "one.jpg"
(self.poster_root / "1_4.jpg").write_bytes(b"poster")
(self.avatar_root / "1.jpg").write_bytes(b"avatar")
(self.logo_root / "Studio_A.img").write_bytes(b"logo")
@@ -191,7 +189,7 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):
width,height,ctx_orient,snapshot_path,first_seen)
VALUES(1,'local',?,'one.mp4','video',100,
'Alice','Studio A',100,1920,1080,'横屏',?,'2026-08-14')""",
- (str(self.media_file), str(self.legacy_snapshot_file)),
+ (str(self.media_file), str(self.snapshot_file)),
)
con.execute("INSERT INTO asset_tag(asset_id,tag,source) VALUES(1,'Tag A','test')")
con.execute(
@@ -219,7 +217,6 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):
self.settings = PeachSettings(
db_path=self.db, configured=True, token="secret", page_path=self.page, vendor_path=self.vendor_root,
allowed_media_roots=(self.media_root,), snapshot_root=self.snapshot_root,
- legacy_snapshot_roots=(self.legacy_snapshot_root,),
poster_root=self.poster_root, avatar_root=self.avatar_root, logo_root=self.logo_root,
cover_root=self.cover_root, stream_root=self.stream_root,
ffmpeg_root=self.root / "ffmpeg", transcode_root=self.transcode_root,
@@ -1529,7 +1526,6 @@ class UnconfiguredMachineTests(unittest.IsolatedAsyncioTestCase):
vendor_path=missing / "web" / "vendor",
allowed_media_roots=(),
snapshot_root=missing / "snapshots",
- legacy_snapshot_roots=(),
poster_root=missing / "posters", avatar_root=missing / "avatars",
logo_root=missing / "logos", cover_root=missing / "covers",
photo_root=missing / "photos", stream_root=missing / "stream",
diff --git a/tests/test_media.py b/tests/test_media.py
index 6fef07851..de268d878 100644
--- a/tests/test_media.py
+++ b/tests/test_media.py
@@ -7,7 +7,7 @@ from unittest.mock import patch
import peach.media as media_module
from peach.ffmpeg import FFmpegResolver
from peach.media import (
- FilesystemBackend, MediaEngine, MediaUnavailable, normalized_path, remap_managed_path,
+ FilesystemBackend, MediaEngine, MediaUnavailable, normalized_path,
resolve_case_insensitive,
)
from peach.repository import MediaAsset
@@ -85,21 +85,6 @@ class MediaEngineTests(unittest.TestCase):
path = normalized_path(Path("B:/"))
self.assertTrue(path.is_absolute())
- def test_legacy_snapshot_path_is_rebased_by_prefix(self):
- with tempfile.TemporaryDirectory() as tmp:
- root = Path(tmp)
- current = root / "generated" / "snapshots"
- legacy = root / "old" / "snapshots"
- raw = legacy / "cloud" / "local" / "aa" / "one.jpg"
- expected = current / "cloud" / "local" / "aa" / "one.jpg"
- self.assertEqual(
- remap_managed_path(raw, current, (legacy,)),
- normalized_path(expected),
- )
-
- unrelated = root / "untrusted" / "one.jpg"
- self.assertEqual(remap_managed_path(unrelated, current, (legacy,)), unrelated.resolve())
-
def test_filesystem_backend_matches_case_insensitively_on_sensitive_mounts(self):
"""CloudDrive 大小写敏感:账本 `abw-118.mp4` 对磁盘 `ABW-118.mp4` 必须救回。"""
with tempfile.TemporaryDirectory() as tmp:
diff --git a/tests/test_web_perf.py b/tests/test_web_perf.py
index 722848b84..a91ec2db8 100644
--- a/tests/test_web_perf.py
+++ b/tests/test_web_perf.py
@@ -38,7 +38,7 @@ def _settings(root: Path, page: Path, **overrides) -> "PeachSettings":
return PeachSettings(
db_path=root / "ledger.db", token="", page_path=page,
vendor_path=root / "vendor", allowed_media_roots=(root / "media",),
- snapshot_root=root / "snapshots", legacy_snapshot_roots=(),
+ snapshot_root=root / "snapshots",
cover_root=root / "covers", poster_root=root / "posters",
avatar_root=root / "avatars", logo_root=root / "logos",
transcode_root=root / "transcodes", stream_root=root / "stream",