Skip to content

Move all item files from one storage to another - #515

Merged
KillerX merged 2 commits into
masterfrom
feat/move-storage-files
Oct 2, 2026
Merged

KillerX merged 2 commits into
masterfrom
feat/move-storage-files

Conversation

@KillerX

@KillerX KillerX commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a way to pick a source storage and move every Mediabanken item file on it to another storage. Until now, /move-files only moved the original shape of VX IDs pasted in by hand.

  • Trigger UI: a new "Move Whole Storage" form on /move-files with:
    • source and destination storage pickers
    • an optional folder, relative to the source storage root
    • a dry-run checkbox, checked by default
    • a confirmation prompt before a real run
  • MoveStorageFiles workflow: lists the source storage 500 files at a time and moves every file that belongs to an item (all shapes) using the existing Cantemo.MoveFileWait, one file at a time.
    • A file at least two folders deep keeps its relative path. A shallower file goes under YYYY/MM of the item's Cantemo creation date (system_metadata.created, new Cantemo.GetItemCreated activity). A shallow file whose item has no creation date isn't moved and is counted as failed.
    • The dry run lists source -> destination paths and counts how many files get a date folder (Redated).
    • Files that don't belong to any item stay where they are.
    • A failed move is logged and counted, and the workflow carries on.
    • The workflow continues as new when its history gets long.
    • Only one real move per source storage can run at a time (fixed workflow ID).
  • ListItemFilesOnStorage activity: wraps vsapi.ListFilesForStorage, which nothing called before. That method is now on the vidispine.Client interface, and the mock is regenerated.

Things to know

  • The dry-run counts are the workflow's result, so they only show in the Temporal UI. The trigger UI's workflow details page doesn't show results.
  • MoveFileWait can report success without the file having moved. A file still on the source after its move is counted as failed and not tried again, so the workflow can't loop on it.
  • I haven't checked the shape of the Vidispine response (includeItem=true → item[].shape[].id) against production. The first dry run on a small folder will confirm it: a count of 0 for a folder that has assets means it's wrong.

Test plan

  • go build ./... and go vet ./...
  • New MoveStorageFiles workflow tests: dry run, full move, a failed move is skipped, a file still on the source isn't retried, and invalid or identical storages are rejected, shallow files go under the creation month, a shallow file with no creation date isn't moved
  • Dry run on a small folder in production; check the counts in Temporal
  • Real run on that folder; confirm in Mediabanken that the files are on the destination storage

🤖 Generated with Claude Code

KillerX and others added 2 commits October 2, 2026 13:11
Add a MoveStorageFiles workflow and a "Move Whole Storage" form on the
trigger UI's /move-files page. It lists the source storage (optionally a
folder of it) page by page and moves every item file, any shape, to the
destination storage one at a time, keeping the relative path. A dry run
only counts files and bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KillerX
KillerX merged commit b1ae2b6 into master Oct 2, 2026
3 checks passed
@KillerX
KillerX deleted the feat/move-storage-files branch October 2, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant