Practitionist / Practitionist/elluminar_web

chore: cleanup abandoned UPLOADING MediaAssets (orphaned presigns)

Open
#68 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
17h 2m
Merged PRs (30d)
18

Description

From CodeRabbit review on PR #67.

Problem: every requestSubmissionUpload/requestResourceUpload presign creates a MediaAsset row with status UPLOADING. If the browser PUT or finalize fails — or the learner closes the tab — the row stays UPLOADING forever with no storage object behind it.

Proposed fix: scheduled job (fits the existing Netlify scheduled-maintenance cron pattern in netlify/functions/scheduled-maintenance.mjs):

  1. Find MediaAssets with status UPLOADING older than ~24h.
  2. Delete any orphaned storage object if one exists (bucket+path).
  3. Mark rows FAILED/DELETED (MediaStatus enum already has FAILED).

Note: finalize now verifies object existence before READY (PR #67), so these rows are unreachable by submit/attach flows — this is hygiene, not a security gap.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading netlify/functions/scheduled-maintenance.mjs and trace the MediaAsset model, MediaStatus enum, and requestSubmissionUpload/requestResourceUpload flows. Follow the existing scheduled-maintenance pattern to identify UPLOADING rows older than about 24 hours and their bucket and path fields. Done means abandoned rows are cleaned up, any existing orphaned object is handled, and valid uploads remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.