Repository navigation
fix(recovery): refuse implicit bulk V2 library backups; require legacy-only scope - #36
servicememeai wants to merge 19 commits into
Conversation
servicememeai
left a comment
There was a problem hiding this comment.
存储可靠性评审:当前不能认定离线备份完整
补齐 data/libraries 是正确且重要的修复;但本 PR 仍有会使恢复声明失真的前提缺口,建议暂不合并为“可靠备份”。
validate_managed_root()自行解析.env里的CF_LIBRARY_STORAGE_HOST_DIR,并读取固定路径配置;实际有效 bind mount 可能来自 shell 环境、Compose override/不同COMPOSE_FILE。例如.env仍写默认目录、启动时用环境变量改到外部目录,工具可复制未被使用的旧目录并生成校验通过的 manifest。必须验证实际解析后的 Compose 挂载或明确拒绝无法确认的部署,不能以路径字符串猜测完整性。stopped()仅以基础-f docker-compose.yml运行ps,还需明确怎么覆盖 worker、可选服务、同数据根的其他写者;仅有--ack-writers-stopped参数并不能自动保证一致快照。- 工具明确不支持 S3 一致备份,却仍复制可选
data/minio,没有在 S3/multi 模式 fail closed;RustFS 也是可选 S3 后端但不在清单。建议严格把此工具限制为 offline local-only,发现实际 S3 后端配置就拒绝并说明使用独立备份方案,避免造成错误的完整性印象。
最小验收:真实 default compose 及覆盖 mount 的拒绝、旧 CE / 新 auto-local 的三类对象和 SQL 同一停写点、恢复后 HEAD/版本/字节一致 + seaf-fsck;合成 copy/hash 测试不能证明全栈恢复。避免为此扩建备份框架。
…legacy local backup
|
2026-10-24 P0 最小修复更新(继续 Draft):
|
2026-10-24 effective Compose path verificationPASS — GitHub Actions run #40081101691 (commit The PR-only Compose job was removed after passing to prevent high-cost routine CI and avoid shipping a special branch rule; ordinary quick CI remains. Remaining acceptance: actual stopped Seafile CE local volumes + consistent MariaDB/filesystem restore verification, plus proof that writer containers are stopped. This utility stays legacy-only and refuses V2/S3. Keep Draft; never run a default/all-library backup. |
The fail-closed bulk-backup gate parsed .env with a raw partition("=") and
strip() of quotes, so Compose-legal forms such as 'export KEY=auto', quoted
values and trailing '# comments' resolved to V2/S3 in Docker but passed this
safety check. Normalise each line like the Compose dotenv parser for the
guarded keys and cover the bypass formats with tests.
|
Independent review fix pushed in fb5d9cc (review-only commit rebased onto the current PR head, no history rewrite):
Review verdict unchanged: MERGE AFTER one real legacy rehearsal (stop writers -> |
Scope correction (2026-10-24)
This PR was originally drafted to silently include all
data/librariesobjects in a whole-instance snapshot. That would cause a large time/space operation and could still miss externally mounted library roots. It has been reworked to reject this unsafe behavior, honoring the user's per-library default.Current changes
cf_recovery.pyvolume scope (data/db,data/seafile, optional legacydata/minio). It does not copydata/librariesimplicitly.--ack-writers-stoppedand new--legacy-ce-onlyflags.data/librariesdirectory. Do not return a misleading successful backup for a partial V2 snapshot.seaf-fsckexport → optional verify).Distinction
cf_recovery backup --legacy-ce-onlyis an explicitly requested whole-deployment legacy CE disaster snapshot, not a normal per-library operation. This PR does not convert it into a V2 per-library exporter. Current V2 libraries must be handled only by explicit repo-scoped maintenance; future whole-instance DR requires a separate reviewed design/backup contract.Draft until the new gating tests and an actual CE / V2 config case are checked. No real backups or services were touched.