Peach: Local-first video metadata scraper and media manager.
test: 覆盖独立包下载准备与 Git 隔离,更新焦点回归
longmeidao1987424ffe05
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.mdindex 6560014a8..ed68f8c29 100644--- a/docs/HANDOFF.md+++ b/docs/HANDOFF.md@@ -5,8 +5,7 @@## 界面、媒体与复核的既定判据- 统一处理、NFO 兼容见 `docs/REUSE.md`;[Banner](https://vercel.com/geist/banner) 2026-09-06 实测与 hash 见 `vercel-geist-library-banner.md`。-- 凭据输入框的焦点圈在控件外延伸 3px;`.fcollapse` 裁切高度动画,内层左右各留 4px。输入框与网格项同时允许收缩,否则手机上输入框的固有宽度会撑出卡片,再被外层裁切。验收需检查全部裁切祖先;桌面和 390px 视口都要覆盖。-- 独立包更新的暂存、重启确认和回滚入口是 `standalone_update.py`。用户数据目录必须在程序目录外;助手从自己的副本运行,避免自身 DLL 占用被替换目录。Windows 进程探测复用 `PidFileLock._running`。+- 凭据焦点圈外扩 3px,折叠正文左右留 4px;输入框允许收缩,验收所有裁切祖先。页面密度、控件、提示与响应式的实现门槛见 `.claude/skills/peach-web-ui/SKILL.md`,这里只留代码看不出来的判据。diff --git a/docs/STATUS.md b/docs/STATUS.mdindex e7d633407..830f75faa 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -4,9 +4,7 @@索引:`PRODUCT_BACKLOG.md`、`REUSE.md`、`HANDOFF.md`。-- uv:`TESTING.md`。--- 配置页提供 GitHub 测试版查询;独立 Windows 包支持应用内下载、校验、进度恢复和重启确认,替换失败可回滚。源码部署保留源码更新入口。凭据输入框保留完整焦点圈并适配窄屏。+- 更新:`REUSE.md`。## 运行态diff --git a/src/peach/versioning.py b/src/peach/versioning.pyindex f41a3e098..705c278d9 100644--- a/src/peach/versioning.py+++ b/src/peach/versioning.py@@ -67,6 +67,8 @@ class VersionSnapshot:@propertydef channel_label(self) -> str:+ if self.commit == "release":+ return "更新通道 · GitHub 测试版"if not self.remote_configured:return "本地开发版 · 未配置更新源"if not self.upstream:@@ -226,6 +228,9 @@ class VersionManager:调用方不需要再分一次类。"""checked = self.check()+ from .distribution import standalone+ if standalone():+ return checkedif checked.state != "available":return checkedsnapshot = checked.snapshotdiff --git a/tests/test_follow_web.py b/tests/test_follow_web.pyindex d4271e4ab..cfc811950 100644--- a/tests/test_follow_web.py+++ b/tests/test_follow_web.py@@ -1913,7 +1913,7 @@ class FollowWebSourceTests(unittest.TestCase):state = page[page.index(".fcstate{"):]self.assertIn("margin-left:auto", state[:state.index("}")])# 折叠/展开两种几何下 summary 的可用宽度必须一致,否则状态列差一个 gap。- self.assertPageContains("details.fcred{display:block}")+ self.assertPageContains("details.fcred{display:block;min-width:0}")def test_the_add_box_carries_no_standing_how_to_prose(self):# 空态保留状态和结果去向;操作说明常驻就是噪音。@@ -2012,7 +2012,7 @@ class FollowWebSourceTests(unittest.TestCase):"开合逻辑只该有一份")# 内边距归 .fcollapsebody:留在 .fcred[open] 上的话,收起那一帧高度已经归零、# 内边距还在,行尾会跳一下。- self.assertPageContains(".fcred .fcollapsebody{padding:8px 0 12px}")+ self.assertPageContains(".fcred .fcollapsebody{padding:8px 4px 12px}")self.assertPageLacks(".fcred[open]{padding-bottom")# 首段自己的上边距换成容器内边距,否则它跟容器外边距合并,scrollHeight 量矮一截。self.assertPageContains(".fcred .fcollapsebody>p:first-child{margin-top:0}")diff --git a/tests/test_onboarding.py b/tests/test_onboarding.pyindex 355ce0274..c9f67e76f 100644--- a/tests/test_onboarding.py+++ b/tests/test_onboarding.py@@ -955,7 +955,10 @@ class StandaloneConfigurationTests(_Case):execute = mock.Mock(side_effect=AssertionError("Git must not run"))manager = VersionManager(execute=execute)self.assertEqual(manager.inspect().branch, "测试包")- self.assertEqual(manager.check().state, "manual")+ with mock.patch("peach.release_updates.check", return_value={"state":"available", "latest_version":"1.0.0", "message":"有新版本可下载。"}):+ self.assertEqual(manager.check().state, "available")+ self.assertEqual(manager.update().state, "available")+ self.assertIn("GitHub", manager.inspect().channel_label)execute.assert_not_called()diff --git a/tests/test_standalone_update.py b/tests/test_standalone_update.pyindex 513155af6..158f6a432 100644--- a/tests/test_standalone_update.py+++ b/tests/test_standalone_update.py@@ -1,5 +1,7 @@"""独立包更新使用临时目录验证路径、进度、重启确认及回滚。"""import json+import hashlib+from contextlib import nullcontextfrom pathlib import Pathimport tempfileimport unittest@@ -60,6 +62,32 @@ class StandaloneUpdateTests(unittest.TestCase):with self.assertRaises(ValueError):update.start()+ def test_download_prepares_verified_package_without_stopping_the_app(self):+ target = self.root / "installed"; target.mkdir()+ (target / "Peach.exe").write_text("old")+ archive = self.archive(["Peach/Peach.exe", "Peach/_internal/standalone.txt"])+ with zipfile.ZipFile(archive, "a") as package:+ package.writestr("Peach/_internal/build-info.json", json.dumps({"version":"1.0.0","commit":None,"built_at":"fixture"}))+ content = archive.read_bytes()+ response = Mock()+ response.iter_bytes.return_value = [content[:10],content[10:]]+ client = Mock()+ client.stream.return_value = nullcontext(response)+ release = dict(state="available", latest_version="1.0.0", asset_size=len(content),+ asset_digest="sha256:" + hashlib.sha256(content).hexdigest(), asset_url="https://github.com/fixture")+ lock = Mock()+ with patch.object(update.sys,"executable",str(target/"Peach.exe")), patch.object(+ update.release_updates,"check",return_value=release), patch.object(+ update.httpx,"Client",return_value=nullcontext(client)), patch.object(update.subprocess,"Popen") as launch:+ update.prepare({"id":"download-fixture"},lock)+ state = update.read()+ self.assertEqual(state["state"],"ready",state)+ self.assertEqual(state["downloaded"],len(content))+ self.assertTrue((Path(state["helper"])/"Peach.exe").is_file())+ self.assertEqual((target/"Peach.exe").read_text(),"old")+ launch.assert_not_called()+ lock.release.assert_called_once()+def test_install_failure_restores_program_directory_and_preserves_data(self):target = self.root / "app"; target.mkdir()(target / "Peach.exe").write_text("old")