Repository navigation
Module operations keep subprojects consistent with files on disk - #115
Merged
Merged
Conversation
As a principle, module (subproject) management operations should keep the modules consistent with the files/directories on disk, in the same way the project constructor builds them, because import/export and label reloading depend on that correspondence. Dangerous operations are double-confirmed. Core: - Add `File.moveTo(target)` to the scripting File API - Add `confirmation` to LabelerConf.ModuleOperation: when set, a common confirmation dialog is shown before the scripts run, and the undo history is cleared after the operation is applied (disk changes cannot be undone) Bundled labelers (rename/remove now confirmed): - utau-singer: rename moves the subproject folder; remove deletes it recursively; both are blocked for the root subproject and for folders containing other subprojects; rename/add now sort modules by name - nnsvs/diffsinger: rename moves the wav and lab files and updates the entries' sample references; remove deletes the wav and lab files Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
`confirmation` is now purely a double-confirm dialog; a separate `irreversible` flag controls clearing the undo history after the operation, so a labeler can define a confirmed-but-undoable operation (e.g. removing a TextGrid tier, which only affects the file on export). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #114, based on testing feedback: renaming a subproject did not rename the corresponding folder/files, leaving the project inconsistent with the disk.
Principle
Module management operations must keep subprojects consistent with the files/directories on disk, in the same way the project constructor builds them — import (name-based module matching), export, and label reloading all depend on that correspondence. Operations that change files on disk are dangerous and get a double confirmation.
Core changes
File.moveTo(target)added to the scripting File API (creates parent dirs, throws if target exists) +docs/file-api.md. Available to plugins too.ModuleOperation.confirmation(localized message): when declared, the app shows a common confirmation dialog after the parameter dialog and before running the scripts (the "double confirm").ModuleOperation.irreversible(boolean): when true, the undo history is cleared after the operation is applied, because undoing the project to a state inconsistent with renamed/deleted files is not safe (per discussion). Kept separate fromconfirmationso a labeler can define a confirmed-but-undoable operation (e.g. removing a TextGrid tier, which only affects the file on export). A failed or cancelled operation leaves both project and history untouched. No serialVersion bump — v3 is unreleased.rawFilePathfresh, so it tracks the moved raw label file.Bundled labelers (rename/remove are now confirmed + irreversible)
sampleDirectory/rawFilePath); remove deletes the folder recursively. Both are blocked for the root subproject (its folder is the root sample directory) and for folders that contain other subprojects' folders (per discussion: error-and-block rather than cascade). Rename/add now sort the module list by name, matching constructor ordering.samplereference; remove deletes the wav and lab files. Both validate that target file names are free on disk before touching anything.All scripts validate fully before performing any disk operation, so a rejected operation never leaves partial changes.
Docs & tests
labeler-development.md:confirmation/irreversiblefields, the disk-consistency principle, and the undo-history behavior.AppStateModuleOperationTest).A follow-up PR in
vlabeler-textgridwill add a confirmation (not irreversible) to its remove operation and forbid changing the wav prefix on rename.🤖 Generated with Claude Code