Skip to content

Add User Hash and Media Path Repair Command - #1520

Merged
Badatos merged 7 commits into
EsupPortail:dev_v4from
LoicBonavent:add-user-hash-repair-command
Oct 6, 2026
Merged

Badatos merged 7 commits into
EsupPortail:dev_v4from
LoicBonavent:add-user-hash-repair-command

Conversation

@LoicBonavent

Copy link
Copy Markdown
Collaborator

Summary

  • Add check_user_hashes to detect and repair inconsistencies caused by accidental SECRET_KEY changes or username changes.
  • Support read-only checks with --dry, repeatable profile selection with --username, and filtering to video owners with --with-videos.
  • Rename or merge media directories without overwriting different files, and update matching database file paths and profile hashes.
  • Resolve verified encoding/transcription report collisions while preserving transcription artifacts.
  • Repair each profile independently: conflicts block only the affected profile, while valid profiles continue.
  • Roll back the affected profile’s database changes and file moves on failure; stop on database, filesystem or rollback errors.
  • Add grouped, colored reports distinguishing unchanged, repaired, blocked and unprocessed profiles, with a nonzero exit status when conflicts remain.
  • Add regression tests for dry runs, file references, directory merges, partial success, concurrent changes, report archiving and rollback behavior.

Validation

  • Activate the project environment with workon django_pod4.
  • Flake8 passes for the command and its tests.
  • All 48 tests pass in pod.video.tests.test_check_user_hashes, using pod.main.test_settings with an isolated SQLite test database and temporary media directories.
  • Tests cover Podfile documents and images, absolute paths, interrupted moves, concurrent changes, partial repairs, transcription report collisions, missing tasks, symlinks and unsupported storage.

@LoicBonavent LoicBonavent self-assigned this Sep 22, 2026
@LoicBonavent LoicBonavent added this to the 4.x milestone Sep 22, 2026
@LoicBonavent
LoicBonavent marked this pull request as draft September 22, 2026 15:01
@LoicBonavent
LoicBonavent marked this pull request as ready for review October 6, 2026 08:23
@LoicBonavent
LoicBonavent requested a review from Badatos October 6, 2026 08:24

@Badatos Badatos left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merci pour ce script, ca va en aider plus d'un ;)

@fanfounet
fanfounet self-requested a review October 6, 2026 09:53

@fanfounet fanfounet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job !

@Badatos
Badatos merged commit 572442a into EsupPortail:dev_v4 Oct 6, 2026
3 checks passed
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.

3 participants