rubyforgood / rubyforgood/skillrx-beacon
Orphan Cleanup Service
Open
Nobody has claimed this yet.
cross-app sync
- Dominant language
- HTML
- Stars
- 4
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Remove entities no longer in manifest
class OrphanCleanup
def cleanup(manifest)
external_file_ids = manifest.dig_all("providers", "topics", "files", "id")
external_topic_ids = manifest.dig_all("providers", "topics", "id")
external_provider_ids = manifest["providers"].pluck("id")
external_tag_ids = manifest["tags"].pluck("id")
# ActiveStorage will purge attached blobs automatically
TopicFile.where.not(external_id: external_file_ids).destroy_all
Topic.where.not(external_id: external_topic_ids).destroy_all
ContentProvider.where.not(external_id: external_provider_ids).destroy_all
Tag.where.not(external_id: external_tag_ids).destroy_all
end
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the OrphanCleanup class and the code that supplies its manifest, then read how the provider, topic, file, and tag records are persisted. Verify the cleanup behavior against a manifest containing missing entities and confirm that records absent from the manifest are removed without affecting retained entities.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100