Skip to content

Manifest-based binary resolution (glibc/musl aware, sha256-verified) + cross-platform encode tests#21

Merged
zackees merged 1 commit into
mainfrom
feat/manifest-resolver-and-encode-tests
Jul 9, 2026
Merged

Manifest-based binary resolution (glibc/musl aware, sha256-verified) + cross-platform encode tests#21
zackees merged 1 commit into
mainfrom
feat/manifest-resolver-and-encode-tests

Conversation

@zackees

@zackees zackees commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Implements the client-side foundation of #20 and the cross-platform encode-test guarantee, without disturbing any existing install.

What this PR does

Backward compatibility (hard requirement)

  • The legacy ffmpeg_bins per-platform zip URLs are untouched and remain the default source. Old installs — which ship their own run.py — keep resolving to the exact same URLs. This PR only changes behavior for new/updated installs, and even then falls back to the legacy URL on any failure.

Manifest-based resolution (static_ffmpeg/manifest.py)

  • Detects a platform tuple {os, arch, libc}. Linux distinguishes glibc vs musl (via platform.libc_ver()ldd → musl-loader probe), so we can ship both a glibc-2.17 baseline and a musl build per arch.
  • Resolves the tuple against a zackees/manifest.json Catalog (channel → release → per-platform asset).
  • Verifies sha256 after download; a mismatch deletes the file and raises.
  • Best-effort & disabled by default: returns None (→ legacy fallback) when the manifest is unset, unreachable, malformed, or missing the platform. Opt in with STATIC_FFMPEG_MANIFEST_URL; flip the default once ffmpeg-bins2 + CDN are live.

Tests

  • tests/test_encode.py: a real small encode — synthesizes 1s of video+audio via lavfi, encodes to H.264/AAC mp4, and probes it back asserting a video stream. Rides all five existing per-platform test workflows (Win x64, macOS x64/ARM, Ubuntu x64/ARM), so every platform is guaranteed to actually encode, not just print -version.
  • tests/test_manifest.py: offline resolver unit tests (glibc/musl split, sha256 verify, disabled→None) + an 8-target contract test against manifest.example.json.

Docs

  • manifest.example.json documents the exact catalog contract for all 8 issue targets (win x64/arm, mac x64/arm, linux x64/arm × glibc/musl), with CDN-fronted urls[].
  • README section on resolution + the backward-compat guarantee.

Verified locally

  • pytest tests/15 passed, 1 skipped (Windows-only permission test).
  • flake8 clean · mypy clean · pylint 10.00/10.

Out of scope (tracked follow-ups on #20)

These are operational/infra steps that can't be completed from a coding session and stay tracked on the issue:

  • Building FFmpeg (full features incl. nonfree) via zackees/forge for all 8 targets.
  • Creating ffmpeg-bins2, storing binaries in LFS, and serving them via the CDN-fronted www site.
  • Publishing the real manifest.json (real versions/sizes/sha256/urls) and flipping DEFAULT_MANIFEST_URL on.
  • New test workflows for Windows-ARM64 and Linux-musl (need the new binaries first).

Closes part of #20.

🤖 Generated with Claude Code

…platform encode tests

Implements the client-side half of issue #20 while guaranteeing existing
installs are never disturbed.

- add static_ffmpeg/manifest.py: platform-tuple detection (os/arch/libc, so
  glibc vs musl Linux builds are distinguished), zackees/manifest.json Catalog
  resolution, and sha256-verified downloads. Best-effort and disabled by
  default (opt in via STATIC_FFMPEG_MANIFEST_URL) until ffmpeg-bins2 + CDN are
  live.
- run.py resolves via the manifest first and falls back to the frozen legacy
  ffmpeg_bins URLs on any failure; downloads are sha256-verified when the
  manifest supplies a hash. Current/old behavior is unchanged.
- tests/test_encode.py: real end-to-end encode (lavfi -> H.264/AAC mp4) + probe,
  riding every existing per-platform test workflow.
- tests/test_manifest.py: offline resolver unit tests + an 8-target contract
  test against manifest.example.json.
- document the migration and backward-compat guarantee in README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@zackees zackees merged commit e6a1a2a into main Jul 9, 2026
20 checks passed
@zackees zackees deleted the feat/manifest-resolver-and-encode-tests branch July 9, 2026 20:55
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.

1 participant