Closes the read-side gap for Phase 1 uploads. Tracks with
storage_backend='s3' now get a 302 redirect to a MinIO signed URL
from /stream and /download, letting the client fetch bytes directly
without the backend proxying. Range headers remain honored by MinIO.
Changes:
- internal/core/track/service.go
- New method `TrackService.GetStorageURL(ctx, track, ttl)` returns
(url, isS3, err). Empty + false for local-backed tracks (caller
falls back to FS). Returns a presigned URL with caller-chosen TTL
for s3-backed rows.
- Defensive: storage_backend='s3' with nil storage_key returns
(empty, false, nil) — treated as legacy/broken, falls back to FS
rather than crashing the request.
- Errors when row claims s3 but TrackService has no S3 wired
(should be prevented by Config validation rule 11).
- internal/core/track/track_hls_handler.go
- `StreamTrack`: tries GetStorageURL(ctx, track, 15*time.Minute)
before opening the local file. On s3 hit → 302 redirect. TTL 15min
fits a full track consumption with margin.
- `DownloadTrack`: same pattern with 30min TTL (downloads can be
slower on mobile; single-shot flow).
- Both endpoints keep their existing permission checks (share token,
public/owner, license) unchanged — redirect happens only after the
request is authorized to see the track.
- internal/core/track/service_async_test.go
- `TestGetStorageURL` covers 3 cases: local backend (no redirect),
s3 backend with valid key (redirect + TTL forwarded), s3 backend
with nil key (defensive fallback).
Out of scope Phase 2 remaining (A5): transcoder pulls from S3 via
signed URL, HLS segments written to MinIO.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>