# Release

Reproducible prototype binary and corresponding-source ZIP artifacts are
generated by the release gate. Final release requirements remain defined in
`IMPLEMENTATION_PLAN.md`, Sections 13 and 21.

## Packaging gate

Before packaging a GUI-enabled build, run the UCRT GUI test preset and verify
that `build/windows-ucrt-gui-release/test-results/gui-probe-contract.json` exists and
contains `smartcut-gui-probe-contract-v1` with all probe outcomes `PASSED`.
The gate also emits `gui-probe-contract.json.release-summary.json` with the
`smartcut-gui-release-gate-v1` packaging result, creates the CPack ZIP, and
checks that the archive contains all three executables plus the FFmpeg,
libplacebo, and Qt runtime DLLs, plus the CycloneDX SBOM. It also rejects the
internal CLI/worker/GUI test harnesses and their isolated runtime directory.
It then extracts the archive into an isolated
temporary install root, launches the packaged CLI and GUI smoke test, and
removes the install root.
The same gate verifies every pinned source archive hash and produces the
corresponding source bundle `SmartCut64-1.0.3-source.zip` alongside the binary
package. It also requires the bundle to contain the tracked SmartCut64 C++
sources, CMake project, schemas, and dependency build scripts.

Run the complete Windows gate with:

`powershell -ExecutionPolicy Bypass -File scripts/release-gate.ps1`

By default this is a commercial-release gate and requires a configured RSA
public licence modulus of at least 2048 bits in the selected CMake cache. It
also requires `-PaidTestLicense <path>` (or the
`SMARTCUT_PAID_TEST_LICENSE` environment variable) naming a paid release-test
token signed by that exact key and bound to the release machine. The production
worker and CLI must both accept the token and preserve clean keyframe-copy
delivery. This catches a wrong public key or unusable paid entitlement before
packaging.

To make a deliberately non-paid Evaluation package, pass `-EvaluationOnly`;
that artifact must be clearly labelled and must not be represented as a paid
build. An empty or invalid production key otherwise fails the commercial gate
before compilation. The paid test token is public authorization data, but it
must not be included in any binary or source package.

The gate requires a completely clean worktree, including no untracked source
or release files; commit or otherwise resolve them before packaging. This
ensures the corresponding-source archive cannot silently omit newly added
source files.

## Latest verified gate

The latest FFmpeg 9 commercial release run completed its 91-test UCRT
configuration with every mandatory test passing, including the production entitlement delivery boundary,
source-codec smart export, Cut/Scene mode persistence, editable profiles,
stream selection, audio synchronization, Joiner projects, and interactive and
batch Ad-Detective regressions. Successful export reports are required to carry
the output SHA-256 digest and pinned dependency inventory. Application Verifier
is the sole skipped test because its Windows run requires an elevated
interactive UAC session. A clean release run refreshes
the resulting summary at:

`build/windows-ucrt-gui-release/test-results/gui-probe-contract.json.release-summary.json`

The refreshed 2026-08-03 package set passed isolated portable launch,
installer install/uninstall, licence/SBOM, and corresponding-source checks:

- SHA-256 values for the portable ZIP, per-user installer, and source ZIP are
  recorded in generated `SmartCut64-1.0.2-SHA256SUMS.txt` beside the verified
  1.0.2 artifacts.
  Keeping these release-instance values outside the source archive avoids a
  self-referential checksum.

## Packaging-readiness checklist

The checklist records engineering evidence only. It is not approval to sell or
distribute the software commercially; the independent licence, patent,
trademark, and consumer-terms review remains mandatory.

- [x] Native Windows Git reports a completely clean worktree at the release-gate
  commit; generated package outputs remain outside version control.
- [x] UCRT GUI matrix passes every mandatory test in the 91-test configuration, including decoded/clickable thumbnail
  filmstrips with source display-aspect geometry, rapid-preview coalescing and
  continuously advancing playback, populated VideoReDo-style cut lists and
  red/green removed/kept timeline ranges,
  long-index parsing,
  responsive source-open automation, isolated build-tree runtime
  launch without a developer `PATH`, 10,000 randomized seeks,
  checksummed index-cache recovery, typed probing, decoded frame indexing, and
  deterministic audio decode to interleaved PCM, and byte-identical MKV packet
  copy with metadata/timestamp validation, and independent Main 10 boundary-GOP
  encoding with strict decode/codec/profile/colour/timestamp checks. Real-file
  corpus coverage includes 207 files, ten video format signatures, and 22 audio
  codec/rate/layout signatures. MPEG-2, MPEG-4, H.264, HEVC Main/Main10, AV1,
  and VP9 representatives pass the applicable packet-copy/smart-render paths.
- [x] MSVC x64 matrix passes 6/6 tests.
  The production entitlement gate proves Evaluation full-recode watermark
  forcing, blocks production worker/CLI clean-copy and ambiguous-stream
  bypasses, permits genuine audio-only output, and keeps all bypass-enabled
  regression executables outside the install/package manifest.
- [x] Probe contract and release summary artifacts are present and passed.
- [x] Portable ZIP includes the CycloneDX SBOM and passes isolated install,
  launch, and removal validation.
- [x] Separate debug symbols and dependency licence texts are packaged.
- [x] SmartCut64's tracked application source and every hash-verified
  dependency source archive are packaged alongside the binary ZIP.
- [x] NSIS installer passes silent install, project-file/media-shell registration,
  isolated launch, registration cleanup, and uninstall.
- [x] MSVC AddressSanitizer 6/6 gate passes.
- [ ] Run the optional Application Verifier heap/handle gate on a host where
  Application Verifier is installed (the automated matrix otherwise skips it).
- [x] Sign the three first-party binaries and installer with the LINEKERPANDI
  LIMITED Azure Artifact Signing public-trust profile, timestamp each artifact,
  verify the signatures after packaging, and rerun portable/installer gates.
- [x] Configure the production entitlement public key and exact activation URL,
  prove that no private signing material enters source/build/package/CI
  artifacts, and retain the exact paid-gate evidence.
- [ ] Complete and verify two independently stored encrypted production-key
  backups, then configure production service secrets after live-store approval.
- [x] Pass paid clean-export and Evaluation missing/invalid/expired/
  wrong-installation gates on the exact release build. Decode representative
  Evaluation outputs to prove a visible mark on every video segment and confirm
  worker evidence reports full video recode.
- [x] Pass the exact signed-artifact 19-case mid-GOP matrix, requiring encoded
  boundary frames, copied interior frames, complete FFmpeg decode, and visible
  advancement at three distinct points in MPC-BE for MPEG-2, H.264, HEVC, AV1,
  VP9 and the represented audio combinations.
- [x] Product owner confirmed independent legal review completed on 2026-08-27.
  The broader multi-player, long-file and device-diverse GPU/media-corpus matrix
  remains documented residual test work.
- [x] Product owner confirmed SmartCut64 name/artwork clearance for the intended launch.
- [x] Product owner confirmed legal sign-off for codec-patent exposure in the
  intended countries and sales model.
- [x] Customer terms preserve GPL/LGPL rights, including
  modification, redistribution, reverse engineering, or Qt library replacement.
- [x] Produce a signed release-candidate ZIP and NSIS installer plus the exact
  corresponding-source ZIP and SHA-256 manifest.

The latest verified reproducible ZIP packaging prototype was generated with
CPack at `build/windows-ucrt-gui-release/SmartCut64-1.0.2-win64.zip` and includes the
SmartCut executables, bundled FFmpeg 9/libplacebo/x264/combined 8+10-bit x265
DLLs (including `avcodec-63.dll` and `swresample-7.dll`), Qt DLLs, and
their MinGW runtime dependencies. AV1/libaom and VP9/libvpx are linked into the
FFmpeg runtime from their exact locked static libraries. Its isolated launch test deliberately removes
MSYS2 from `PATH` so missing packaged dependencies fail the gate.
The product owner has approved the release for sale following legal sign-off.
Public checkout still awaits production service-secret/live-lifecycle
completion and its controlled live-order evidence. The broader device/player
interoperability matrix remains documented residual work. Portable
extraction/launch/removal and Windows installer install/uninstall validation
are automated and pass.

Sign and verify the staged binaries and NSIS installer with the active Azure
Artifact Signing public-trust profile:

`powershell -ExecutionPolicy Bypass -File scripts/sign-release-artifact.ps1 -BuildDir build/windows-ucrt-gui-release`

The dedicated `SmartCut64 Release Signing` service principal must have the
Artifact Signing Certificate Profile Signer role. Its authentication PFX and
DPAPI-protected password remain outside the repository under the current
Windows user's local application-data directory. The wrapper exposes them only
to the child signing process and restores the process environment afterward.
The script uses the non-secret account/profile metadata in
`scripts/artifact-signing-metadata.json`, Microsoft's timestamp service, and
verifies every resulting Authenticode signature. The legacy local
certificate-store path remains available through `scripts/sign-release.ps1`
with `-Provider CertificateStore -Thumbprint <certificate>`.
