Skip to content

NAT-548: Integrate upload preparation and pause/cancel lifecycle - #171

Merged
eugene-mux merged 52 commits into
feature/nat-534-hevc-standard-ingestfrom
em/nat-548-upload-preparation
Oct 22, 2026
Merged

eugene-mux merged 52 commits into
feature/nat-534-hevc-standard-ingestfrom
em/nat-548-upload-preparation

Conversation

@eugene-mux

@eugene-mux eugene-mux commented Oct 8, 2026 •

Copy link
Copy Markdown

Description

Replaces legacy upload preparation with the Standard Input pipeline and gives pause/cancel a consistent lifecycle across uploads and the manager. Generated uploads remain gated until payload identity and server-offset verification are available; new attempts select the original file.

Changes

  • Wire inspection and planning to the validated SDR adapter behind the generated-payload safety gate, with closed typed diagnostics.
  • Retain verified output on preparation pause, delete only tracked SDK files, cancel in-flight HTTP requests, and suppress late callbacks and pause/cancel result-listener callbacks.
  • Restore saved uploads from original bytes without preparation, keep explicitly paused records stopped during initialization, and block unsafe generated resume and force restart.
  • Use selected-payload length for progress and persist completed chunk progress cumulatively.
  • Preserve original multi-audio files so Mux retains its primary/default audio choice; skip local conversion rather than select an unverified first track.

Validation

  • 256 library tests pass in each debug and release variant.
  • SDK and sample release builds and lint-vital checks pass.
  • API 36.1 emulator checks pass for H.264 original upload/resume and H.264 multi-audio/HEVC original fallback using intercepted local requests.
  • API 36.1 live SDK uploads of the Swift standard H.264 fixture, a separately prepared/validated 720p H.264 file, and its original multi-audio reference all reach Mux ready with no non-standard input reasons. Generated upload orchestration remains gated.
  • The live comparison found first/default audio mismatch (440 Hz stereo versus 880 Hz mono). Multi-audio conversion now falls back to original bytes; an affected live rerun reaches ready with no non-standard input reasons and preserves Mux’s 880 Hz mono primary audio. Local checks prove the fallback remains enforced even when the generated-resume gate is verified, and single-track conversion still works.
  • Live API 36.1 multi-chunk H.264 (134 MB) and HEVC (25 MB) original uploads pass pause after an acknowledged 8 MiB chunk, process relaunch, and resume through manager/fresh Builder handles. Both handles receive exactly one success callback, network-body hashes and server Range acknowledgements match the source, persistence clears, and both Mux assets reach ready with the expected 4K input-resolution reason. Generated-payload resume remains gated.
  • Existing cancellation/restart tests verify active awaitSuccess() callers receive a failure on upload cancellation, follow force restarts through the new job, and still throw on genuine caller-coroutine cancellation. Managed/unmanaged restart publication races are covered; pause behavior remains unchanged and is documented.

Note

High Risk
Core upload orchestration, persistence/resume rules, and removal of the legacy transcoder affect all direct uploads; generated-payload blocking and destination replacement change failure/retry semantics integrators may rely on.

Overview
Replaces the legacy on-device transcoder with the Standard Input preparation path (UploadPreparation, SDR adapter) and models each upload as an UploadAttempt tied to an UploadSession so handles, the manager, and persistence stay aligned across pause, cancel, restart, and destination replacement.

Lifecycle and API behavior are tightened: cancel ends a handle (later start/awaitSuccess fail with UploadCancelledException); awaitSuccess follows force restarts and surfaces replacement/cancel outcomes without treating upload pause as caller cancellation; listeners are deduplicated and late events suppressed after pause/cancel. MuxUploadManager pauses via attempts, keeps failed jobs discoverable for retry, and won’t let a stale handle cancel a replacement. SDK initialize restores only non-paused cached jobs (resumeCachedJobs(includePaused = false)); explicit resumeAllCachedJobs still resumes paused work.

Resume safety for generated payloads: persistence tracks attempt IDs, original vs generated selection, and per-destination blocks after any generated bytes were sent—unsafe resume throws GeneratedResumeBlockedException and requires a new Direct Upload URL. Verified generated files get identity checks before upload; chunk HTTP uses cancellable async OkHttp and progress is acknowledged per chunk on the attempt.

Policy change: multi-audio inputs fall back to original bytes (planner/validator/preparation) so local conversion cannot pick an unverified first track over Mux’s ingest choice. Builder docs now describe fallback to original when local standardization isn’t safe.

Reviewed by Cursor Bugbot for commit 0c6bd8b. Bugbot is set up for automated code reviews on this repo. Configure here.

@eugene-mux eugene-mux changed the title Integrate upload preparation and pause/cancel lifecycle NAT-548: Integrate upload preparation and pause/cancel lifecycle Oct 8, 2026
@eugene-mux
eugene-mux marked this pull request as ready for review October 8, 2026 21:44
@eugene-mux
eugene-mux requested a review from a team as a code owner October 8, 2026 21:44
@eugene-mux
eugene-mux requested a review from daytime-em October 8, 2026 21:44
@eugene-mux
eugene-mux added this pull request to stack #166 October 8, 2026 21:44

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@eugene-mux
eugene-mux force-pushed the em/nat-548-upload-preparation branch from 539b523 to e0738b5 Compare October 16, 2026 18:08
@eugene-mux
eugene-mux force-pushed the em/nat-548-upload-preparation branch from e0738b5 to 95520c2 Compare October 16, 2026 18:09

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@eugene-mux
eugene-mux force-pushed the em/nat-548-upload-preparation branch from 95520c2 to 0097f2a Compare October 16, 2026 18:35

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f50afbc. Configure here.

The previous base 1cc4386 and rebased base fff4029 have identical trees. Preserve the already validated NAT-548 integration while recording the current base ancestry.
Base automatically changed from em/nat-547-sdr-conversion to feature/nat-534-hevc-standard-ingest October 22, 2026 21:02
The approved predecessor base fff4029 and feature branch 094af9b have identical trees. Record the feature branch ancestry without modifying approved source or tests.
@eugene-mux
eugene-mux merged commit 3af2dd2 into feature/nat-534-hevc-standard-ingest Oct 22, 2026
1 of 2 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 4, 2026
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.

2 participants