背景
Windows Portable 7z 的更新机制已经多次在发版中回归,影响面大且用户无法自救,应定义为 P0。
近期 v2.5.3 暴露的问题:
Update-SD-Trainer.bat 提示 This portable package is not a git checkout,说明发布包内 SD-Trainer/.git 缺失。
update/update_sd_trainer.bat 曾由打包脚本生成裸 git pull,没有复用根目录健壮更新器。
- 纯 7z 用户、Git 版整合包用户、源码用户路径容易混淆,Release 说明和包内 README 不足以防止误用。
- 更新后根目录 launcher、子模块/内置标签编辑器、用户数据保护等都依赖人工 checklist,容易漏。
v2.6.0 已做一轮止血:
build_portable.ps1 自动嵌入 shallow .git 到 SD-Trainer/.git。
update/update_sd_trainer.bat 转调根目录 Update-SD-Trainer.bat。
- 打包前校验
mikazuki/dataset-tag-editor/scripts/launch.py。
- 新增
tests/test_portable_packaging_scripts.py 覆盖部分规则。
但这还不是系统性解决,需要把“可更新整合包”变成强门禁,而不是靠人工记忆。
目标
建立 Portable 更新机制的 P0 发布门禁,确保每次 7z 发出前自动证明:
- 新包内
SD-Trainer/.git/HEAD 存在,且是 shallow git checkout。
git remote -v 指向 https://github.com/wochenlong/lora-scripts-next.git。
Update-SD-Trainer.bat 能在包内识别当前分支并执行 fetch/ff-only 更新流程。
update/update_sd_trainer.bat 只是转调根 Update-SD-Trainer.bat,不得再出现裸 git pull。
- 更新后会刷新根目录
run_gui.bat / run_gui_portable.bat。
- 用户数据目录不会被覆盖:
sd-models/、output/、logs/、huggingface/、train/、config/、toml/autosave/、assets/config.json、config/.update_cache.json、sd-trainer-log.txt。
- 无
.git 的旧包必须明确失败并引导下载新 Release,不能显示“更新完成”。
建议任务
- 把
build/test_portable_release.ps1 正式纳入仓库或迁到 scripts/portable/ 下,避免 build/ 本地脚本丢失。
- 在发布检查里增加完整更新 smoke:
- 构建后进入
build/SD-Trainer-Portable/SD-Trainer。
- 验证
.git、remote、shallow 状态、当前版本。
- 模拟运行
update/update_sd_trainer.bat --nopause 或提供可测试模式。
- 验证根 launcher 被刷新。
- 为
build_portable.ps1 增加失败即中止的 .git 嵌入校验:缺 .git/HEAD、remote 不对、非 shallow 或体积异常都 fail。
- 为 Update 脚本增加自动化测试/静态测试,防止裸
git pull、覆盖用户目录、子模块失败阻断主更新等回归。
- 更新 Release checklist:没有通过 Portable 更新门禁不得发布 7z。
- 在 Release 说明中明确区分:Git 版整合包可用
Update-SD-Trainer.bat;无 .git 旧包只能下载新 7z。
验收标准
powershell -ExecutionPolicy Bypass -File <portable-release-test> -PortableRoot build/SD-Trainer-Portable -ArchivePath build/SD-Trainer-vX.Y.Z.7z 全 PASS。
- CI 或本地 release 脚本能在缺
.git、裸 git pull、子模块缺失、用户目录覆盖风险时失败。
- 新发布包内双击
Update-SD-Trainer.bat 不再出现“不是 git 仓库”。
- 从 v2.6.0 起,整合包更新机制不再依赖人工补
.git 或手工 checklist。
优先级
P0 / release-blocker
背景
Windows Portable 7z 的更新机制已经多次在发版中回归,影响面大且用户无法自救,应定义为 P0。
近期 v2.5.3 暴露的问题:
Update-SD-Trainer.bat提示This portable package is not a git checkout,说明发布包内SD-Trainer/.git缺失。update/update_sd_trainer.bat曾由打包脚本生成裸git pull,没有复用根目录健壮更新器。v2.6.0 已做一轮止血:
build_portable.ps1自动嵌入 shallow.git到SD-Trainer/.git。update/update_sd_trainer.bat转调根目录Update-SD-Trainer.bat。mikazuki/dataset-tag-editor/scripts/launch.py。tests/test_portable_packaging_scripts.py覆盖部分规则。但这还不是系统性解决,需要把“可更新整合包”变成强门禁,而不是靠人工记忆。
目标
建立 Portable 更新机制的 P0 发布门禁,确保每次 7z 发出前自动证明:
SD-Trainer/.git/HEAD存在,且是 shallow git checkout。git remote -v指向https://github.com/wochenlong/lora-scripts-next.git。Update-SD-Trainer.bat能在包内识别当前分支并执行 fetch/ff-only 更新流程。update/update_sd_trainer.bat只是转调根Update-SD-Trainer.bat,不得再出现裸git pull。run_gui.bat/run_gui_portable.bat。sd-models/、output/、logs/、huggingface/、train/、config/、toml/autosave/、assets/config.json、config/.update_cache.json、sd-trainer-log.txt。.git的旧包必须明确失败并引导下载新 Release,不能显示“更新完成”。建议任务
build/test_portable_release.ps1正式纳入仓库或迁到scripts/portable/下,避免build/本地脚本丢失。build/SD-Trainer-Portable/SD-Trainer。.git、remote、shallow 状态、当前版本。update/update_sd_trainer.bat --nopause或提供可测试模式。build_portable.ps1增加失败即中止的.git嵌入校验:缺.git/HEAD、remote 不对、非 shallow 或体积异常都 fail。git pull、覆盖用户目录、子模块失败阻断主更新等回归。Update-SD-Trainer.bat;无.git旧包只能下载新 7z。验收标准
powershell -ExecutionPolicy Bypass -File <portable-release-test> -PortableRoot build/SD-Trainer-Portable -ArchivePath build/SD-Trainer-vX.Y.Z.7z全 PASS。.git、裸git pull、子模块缺失、用户目录覆盖风险时失败。Update-SD-Trainer.bat不再出现“不是 git 仓库”。.git或手工 checklist。优先级
P0 / release-blocker