veza/veza-backend-api/internal/core
senke 8699004974 feat(track): native S3 multipart for chunked uploads (v1.0.9 item 1.5)
Replaces the historical chunked-upload flow when TRACK_STORAGE_BACKEND=s3:

  before: chunks → assembled file on disk → MigrateLocalToS3IfConfigured
          opens the file → manager.Uploader streams in 10 MB parts
  after:  chunks → io.Pipe → manager.Uploader streams in 10 MB parts
          (no assembled file on local disk)

Eliminates the second local copy of every upload and ~500 MB of disk
I/O per concurrent 500 MB upload. The local-storage path
(TRACK_STORAGE_BACKEND=local, default) is unchanged — it still goes
through CompleteChunkedUpload + CreateTrackFromPath because ClamAV needs
the assembled file (chunked path skips ClamAV by design, see audit).

New surface:
  - TrackChunkService.StreamChunkedUpload(ctx, uploadID, dst io.Writer)
    — extracted from CompleteChunkedUpload, writes chunks in order to
    any io.Writer, computes SHA-256 + verifies expected size, cleans
    up Redis state on success and preserves it on failure (resumable).
  - TrackService.CreateTrackFromChunkedUploadToS3 — orchestrates
    io.Pipe + goroutine, deletes orphan S3 objects on assembly failure,
    creates the Track row with storage_backend=s3 + storage_key.

Tests: 4 chunk-service stream tests (happy / writer error / size
mismatch / delegation) + 4 service tests (happy / wrong backend /
stream error / S3 upload error). One E2E @critical-s3 spec gated on
S3 availability via /health/deep so it ships today and starts running
once MinIO is added to the e2e workflow services block.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 23:12:56 +02:00
..
admin feat(v0.11.3): F421-F424 admin platform handler and routes 2026-03-10 18:19:45 +01:00
analytics fix(v0.12.6): apply all pentest remediations — 36 findings across 36 files 2026-03-14 00:44:46 +01:00
auth feat(auth): defer JWT to post-verify + verify-email header (v1.0.9 items 1.3+1.4) 2026-04-26 22:56:31 +02:00
collaboration adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
connecterrors feat(marketplace): stripe reversal error disambiguation + CHECK constraint + E2E — v1.0.7 item B day 3 2026-04-18 02:12:03 +02:00
discover style(backend): gofmt -w on 85 files (whitespace only) 2026-04-14 12:22:14 +02:00
distribution fix(distribution,audit): propagate ErrSubscriptionNoPayment to handler + P0.12 closure date + E2E regression TODO 2026-04-17 12:43:21 +02:00
education style(backend): gofmt -w on 85 files (whitespace only) 2026-04-14 12:22:14 +02:00
feed feat(v0.10.1): Tags & Genres discover - F351-F355 2026-03-09 01:52:56 +01:00
marketplace fix(marketplace): wrap DELETE+loop-CREATE in transaction 2026-04-21 09:57:50 +02:00
moderation feat(v0.11.2): F411-F420 moderation handler and routes 2026-03-10 17:49:51 +01:00
social fix(v0.12.6): apply all pentest remediations — 36 findings across 36 files 2026-03-14 00:44:46 +01:00
subscription feat(subscription): pending_payment state machine + mandatory provider (v1.0.9 item G — Phase 1) 2026-04-26 10:02:00 +02:00
track feat(track): native S3 multipart for chunked uploads (v1.0.9 item 1.5) 2026-04-26 23:12:56 +02:00