Garbage collection never deletes orphaned files from storage

オープン
#6,447 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
1/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
django, google-cloud, python
領域
backend, databases

調査の方向性

Read contentcuration/contentcuration/utils/garbage_collect.py and the named tests in contentcuration/contentcuration/tests/utils/test_garbage_collect.py; start by running the focused pytest command from the issue. The issue says contributions are not open for this task, so it is not suitable for a first contribution.

索引モデルが issue の本文から書いたものです。

説明

bug DEV: backend

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: unstable

Observed behavior

_clean_up_files assigns a Django Exists(...) expression to is_other_node_pointing and tests if not is_other_node_pointing:. The expression is never run as a query, and an Exists object is always truthy, so default_storage.delete is never called. manage.py garbage_collect deletes the File rows of orphaned nodes and leaves their storage objects in the bucket.

User-facing consequences

Storage objects of garbage-collected content are never reclaimed, so the bucket only grows.

Steps to reproduce

  1. In test_deletes_associated_files, add assert not default_storage.exists("storage/a/a/aaa.jpg") after clean_up_contentnodes().
  2. Run pytest contentcuration/contentcuration/tests/utils/test_garbage_collect.py -k test_deletes_associated_files.
  3. The new assertion fails: the object is still stored.

Acceptance Criteria

  • After clean_up_contentnodes(), a storage object referenced only by File rows of the cleaned-up nodes no longer exists in default_storage.
  • A storage object also referenced by a File row outside the cleaned-up nodes still exists.
  • clean_up_contentnodes() completes when a File row's storage object is already absent: GoogleCloudStorage.delete raises AttributeError for a missing object.

AI usage

Claude Code (Fable 5.2) found this while planning #6445 and wrote the issue.

主要言語
JavaScript
スター
214
フォーク
327
平均マージ
17時間 5分
マージ済み PR(30日)
25

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

learningequality/studio のほかの issue

learningequality/studio の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。