Fix/backup-restore-watch-control-files - #4150
Conversation
Backup runs with a ROOT maintenance context, which bypasses the watch-task control file filter in _is_accessible, so packs can carry viking://resources/.watch_tasks.json and .bak. Restore then rejected the whole pack via validate_import_target_uri. Exclude the files on the backup side and skip (instead of reject) them on the restore side so packs created by older versions round-trip. Fixes volcengine#4139
|
this covers both suggested fixes. I verified that |
Address review feedback on volcengine#4150: exercise .watch_tasks.json.bak and .tmp alongside the main file in both the backup-exclusion and the restore-skip tests, and add a doc note that watch task schedules are instance-local and do not migrate with backups.
|
Thanks for the review! Both suggestions are addressed in the latest push (
Both new tests pass and |
Description
Backup of a workspace with an active watch task fails to round-trip:
ov backuppacksviking://resources/.watch_tasks.json(and.bak), butov restorerejects the resulting pack withcannot import watch task control file, so any user with a watch task can neither backup nor restore.Two root causes, both fixed:
_is_accessible, so the control files end up in the pack.validate_import_target_uri, which unconditionally rejects watch control files, failing the entire pack.Fix both sides:
_backup_entries).Human Involvement
Related Issue
Fixes #4139
Type of Change
Changes Made
openviking/storage/ovpack/operations.py: skipis_watch_task_control_urientries in_backup_entries; passskip_watch_control_files=Truefromrestore_ovpack.openviking/storage/ovpack/validation.py: addskip_watch_control_fileskeyword tovalidated_import_members; when set, log a warning and skip watch control members instead of validating/rejecting them.tests/misc/test_ovpack_import_policy.py:test_backup_excludes_watch_task_control_files(regression for the backup side) andtest_restore_skips_watch_task_control_files(a pre-fix pack containing.watch_tasks.jsonrestores successfully, skipping the control file).Testing
Local verification on Windows:
tests/misc/test_ovpack_import_policy.py: 20 passed (incl. both new tests).ruff check/ruff format --checkclean on all three changed files;mypyclean on both changed source files..watch_tasks.jsonbut restore rejects it — backup/restore round-trip broken whenever a watch task exists #4139 first):ov restoreof the previously-failing pack now succeeds, server logs[ovpack] Skipping watch task control file: viking://resources/.watch_tasks.json(and.bak) thenSuccessfully restored backup; a freshov backupno longer contains the control files.Checklist
Screenshots (if applicable)
N/A
Additional Notes
The fix is additive and non-breaking: the default behavior of
validated_import_members(used byimport_ovpack) is unchanged — import still rejects watch control files; only the backup-restore path opts into skipping them.