Delete stale generated files on same-path content change instead of renaming - #7158
Open
lurkfueh wants to merge 1 commit into
Open
Delete stale generated files on same-path content change instead of renaming#7158lurkfueh wants to merge 1 commit into
lurkfueh wants to merge 1 commit into
Conversation
…enaming When a scene's file changes at the same path, the scan handler called MigrateHash, which renames the old hash's sprite/preview/transcode files onto the new hash's path instead of regenerating them. Every generator's "does this already exist" check then found a file already sitting there and skipped, leaving stale pre-edit content wearing the new hash's name - and the cover (a DB blob, never touched by MigrateHash) stayed stale too. Add InvalidateGeneratedFiles, used only for the same-path content-change case: deletes the old hash's generated files instead of renaming them, and clears the scene's cover. MigrateHash itself is unchanged and still renames for its real use case (the hash-naming-algorithm migration task, where content is unchanged). With the stale files/cover actually gone, every generator's existing exists-check works correctly on its own for any future regeneration path - scan, manual Generate, or scheduled. Also fixes ScenePlayer never refreshing a scene's video source/duration after such an edit: its player-(re)init effect only fired on scene ID change, so an in-place file edit under the same scene ID left the player showing the pre-edit duration/sources indefinitely. Fixes stashapp#7155 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
lurkfueh
marked this pull request as ready for review
August 14, 2026 07:33
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.
Description
Deletes generated content when a file is modified (i.e. trimmed) but the file path remains the same. Also modifies the UI scene player to track media fingerprint instead of just scene id when deciding to update the player.
Related Issue
Fixes #7155
Testing
pkg/scene/scan_test.gocovering my changesScreenshots
Checklist
AI Usage Disclosure
used claude to make the code changes, tested and verified that the changes work
Additional Context
Note, this does not touch transcodes (I think they should be removed also but want to hear from maintainers)