Skip to content

feat(app): one-click Crunch — upload the pack, stream progress, land crunch.json (#19)#20

Merged
StuMason merged 2 commits into
mainfrom
feat/one-click-crunch
Jul 3, 2026
Merged

feat(app): one-click Crunch — upload the pack, stream progress, land crunch.json (#19)#20
StuMason merged 2 commits into
mainfrom
feat/one-click-crunch

Conversation

@StuMason

@StuMason StuMason commented Jul 3, 2026

Copy link
Copy Markdown
Owner

What

Closes #19. The pack → crunch → crunch.json round-trip is now a button.

  • Crunch per take (library rows + inspector chips): tars everything except camera.mp4 (crunch analyses camera.proxy.mp4; the master stays local for edator), streams it to POST /pack, polls GET /jobs/{id} every 5s, writes the result to <take>/crunch.json.
  • Status via roll://crunch events following the emit_state pattern — live stage label, real progress fill for ocr (the only counted stage), spinner, crunched badge, Re-crunch (crunch keeps improving), Retry with the error on hover.
  • Resume: a crunch.job marker sits in the take dir while a job's in flight; on relaunch the app resumes polling anything the last session left running (~0.6–0.7× realtime processing is long enough to quit mid-crunch).
  • Fail fast: >300MB pre-check before taring; origin reachability check before any work, with the actual problem in the message.
  • Config: ~/.config/roll/config.json{"crunch_api_key": "…"} (URL + origin have defaults). The key never touches the repo.
  • Rust: crunch.rs module; tar via shell-out (COPYFILE_DISABLE, explicit file list — same lessons as roll-push.sh), streamed multipart (never held in RAM). New deps: reqwest / tokio / tokio-util.

⚠️ One deviation from the issue

The issue pins the origin to the tailnet IP (100.110.19.65:443) — that can't work: tailscale serve owns tailnet:443 on the box (it proxies the ts.net dashboard), so TLS with the crunch SNI gets alerted before Traefik ever sees it. The default origin is the box's public IP (159.195.194.97:443) instead — still zero Cloudflare in the path (no 100MB cap), still validates the real LE cert (verified: curl --resolve → 200, /pack → 401 without key), and works even when the tailnet's down.

Verified

  • cargo test: 6 unit tests (tar contract: master excluded, plain relative paths, no AppleDouble; config defaults) — green, 0 warnings. tsc + vite build clean.
  • Live e2e (CRUNCH_E2E_DIR=… cargo test e2e -- --ignored) driving the production functions against real crunch with a real 12s pack: tar 5MB → 202 job tXyJwvFCocr 4/14transcribeanalyzecompleted → crunch.json landed with the full result (camera/events/moments/segments/transcript), 20.8s end to end.

🤖 Generated with Claude Code

StuMason added 2 commits July 3, 2026 16:11
…crunch.json

Welds the pack → crunch → crunch.json round-trip into the app (was: manual
tar/upload/poll/copy-back). A Crunch button per take tars everything except
the full-res camera master (crunch analyses camera.proxy.mp4; the master
stays local for edator), streams it to POST /pack with the hostname pinned
to the origin's public IP — Cloudflare Free caps bodies at 100MB and real
packs blow through that — then polls the job and writes the result to
<take>/crunch.json.

- src-tauri/crunch.rs: tar (shell-out, COPYFILE_DISABLE, explicit file
  list), 300MB origin-cap pre-check, origin reachability check with a clear
  error, streamed multipart upload (never held in RAM), 5s poll with
  transient-error tolerance, roll://crunch events mirroring roll://state.
- crunch.job marker in the take dir → a relaunch resumes polling any job
  the last session left in flight (processing runs ~0.6-0.7x realtime).
- Config in ~/.config/roll/config.json ({"crunch_api_key": …}; URL/origin
  default) — the key never touches the repo.
- UI: CrunchControl in the library rows + inspector chips — live stage
  label, a real progress fill for ocr (the only counted stage), crunched
  badge, Re-crunch (crunch keeps improving), Retry with the error on hover.
- NOTE: the origin default is the box's PUBLIC IP, not the tailnet IP as
  issue #19 specified — tailscale serve owns tailnet:443 on that box, so
  TLS to the tailnet IP gets alerted before Traefik ever sees it.

Closes #19

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@StuMason
StuMason merged commit 471b722 into main Jul 3, 2026
3 checks passed
@StuMason
StuMason deleted the feat/one-click-crunch branch July 3, 2026 15:23
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.

feat(app): one-click Crunch — upload the pack to crunch, stream progress in the UI, land crunch.json in the take dir

1 participant