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):
- Find MediaAssets with status UPLOADING older than ~24h.
- Delete any orphaned storage object if one exists (bucket+path).
- 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.
From CodeRabbit review on PR #67.
Problem: every
requestSubmissionUpload/requestResourceUploadpresign 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):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.