Skip to content

feat: add resumable evidence uploads with chunking and session manage…#399

Open
Delightech28 wants to merge 3 commits intoPulsefy:mainfrom
Delightech28:feat/resumable-evidence-uploads
Open

feat: add resumable evidence uploads with chunking and session manage…#399
Delightech28 wants to merge 3 commits intoPulsefy:mainfrom
Delightech28:feat/resumable-evidence-uploads

Conversation

@Delightech28
Copy link
Copy Markdown

Description

This PR introduces resumable upload functionality for verification evidence. Large evidence uploads (up to 50MB) are now supported via a chunking mechanism to ensure network stability and recovery semantics without having to restart from zero when a connection drop occurs.

Changes

  • Database Schema: Introduced UploadSession and UploadChunk models to schema.prisma to track upload state, file constraints, expiration (24h TTL), and strictly guarantee sequential block delivery.
  • Uploads Module: Created a new UploadsModule and wired it into the core AppModule.
  • Endpoints:
    • POST /uploads/session: Initializes a multipart upload and asserts valid content types (image/*, application/pdf, etc.) and payload size limits.
    • PUT /uploads/session/:id/chunks/:chunkIndex: Idempotent binary ingestion endpoint for individual chunks, enabling resume semantics seamlessly over unstable networks.
    • POST /uploads/session/:id/finalize: Asserts chunk integrity (contiguous chunk indexing, total size alignment) and validates ownership before permanently marking the upload session as completed.

Validation & Security

  • Idempotent chunk logic ensures that multiple retries of a failing chunk on a spotty connection do not corrupt the database state.
  • Strict 24-hour expiration prevents orphaned upload sessions from persisting indefinitely.
  • Server-side chunk size aggregation ensures the final received data matches the initial declared totalSize bytes.
  • Ownership validation assertions guarantee that only the initiator of an upload session can finalize it.

closes #254

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 28, 2026

@Delightech28 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich
Copy link
Copy Markdown
Contributor

Please fix workflow

@Cedarich
Copy link
Copy Markdown
Contributor

Please fix failing build

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.

Resumable Evidence Upload Sessions

2 participants