Skip to content

Add a command to remove render rows whose video is gone - #11

Merged
davior merged 1 commit into
mainfrom
claude/determined-ride-g3mjr4
Oct 22, 2026
Merged

davior merged 1 commit into
mainfrom
claude/determined-ride-g3mjr4

Conversation

@davior

@davior davior commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Why

Before #10, renders were written to /data, outside the volume. Every rebuild deleted the files but kept the database rows, so a project's render list offers videos that 404 when played, and "Save to GAM" refuses them.

What

backend/app/render/cleanup.py, run as a module inside the container:

docker compose exec gvc-backend python -m app.render.cleanup            # list only
docker compose exec gvc-backend python -m app.render.cleanup --apply    # delete
  • It only checks finished renders (status == "done"), and counts one as orphaned when its video file isn't there. Failed and cancelled renders never had a file, and a running one is still writing it, so all three are left alone.
  • By default it only lists. The output shows the renders directory it checked, how many renders have their video and how many don't, and one line per orphan: id, project, version, preview or full, date, and its GAM asset if it was saved there. Deleting can't be undone, and a misconfigured data directory would make every render look orphaned, so the command warns when no render has its video.
  • --apply deletes the rows plus any leftover poster or subtitle files. A copy already saved to GAM lives in GAM independently and is untouched.

Testing

  • tests/test_render_cleanup.py sets up four renders through the real routes (one with its video, two orphaned, one of them saved to GAM, and one failed). The tests check that the default only lists, that --apply removes exactly the two orphans and their leftover files, and the warning when no video is found.
  • I ran the command against a freshly migrated empty database to confirm it runs as a module.
  • pytest -q: 665 passed.

Generated by Claude Code

Before DATA_DIR was set in the image, every rebuild deleted render files
and kept their rows, so render lists offered videos that 404 on play.
`python -m app.render.cleanup` lists finished renders with no video file,
and deletes them (and any leftover poster or subtitles) with --apply.
Failed, cancelled and running renders are never touched, and a copy saved
to GAM stays in GAM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016K8ApooCKMPBVQiLjaWjcp
@davior
davior marked this pull request as ready for review October 22, 2026 01:09
@davior
davior merged commit cee3d80 into main Oct 22, 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.

2 participants