Skip to content

feat: pwm-tui ratatui demo proving the real checkpoint locally, no Docker#201

Merged
AbdelStark merged 2 commits into
mainfrom
feat/tui-real-demo
Jun 12, 2026
Merged

feat: pwm-tui ratatui demo proving the real checkpoint locally, no Docker#201
AbdelStark merged 2 commits into
mainfrom
feat/tui-real-demo

Conversation

@AbdelStark

Copy link
Copy Markdown
Owner

Closes #200.

What this adds

pwm-tui, an unpublished ratatui crate that runs the exact ./demo/run-real.sh path natively, with no Docker, as a live terminal UI with seven stages (FETCH, EXPORT, LOAD, INFER, COMMIT, VERIFY, TAMPER), per-stage detail panels (download gauges, exporter substage progress, op histogram, commitment table, verdicts), a toggleable raw log pane, a metrics footer, NO_COLOR support, and a panic hook that restores the terminal.

cargo run -p pwm-tui --release                       # first run downloads ~77 MiB + the torch env
cargo run -p pwm-tui --release -- --offline          # warm cache: no network at all
cargo run -p pwm-tui --release -- --headless --json  # CI mode: plain log + JSON summary
cargo run -p pwm-tui --release -- cache path|ls|clear

Cache management

  • Precedence: --cache-dir > PWM_CACHE_DIR > platform default (~/Library/Caches/ProvableWorldModel on macOS, ~/.cache/provable-world-model on Linux).
  • Every external asset (checkpoint, episode parquet, episode mp4) is sha256-pinned in source; a hit means the cached file reproduces its pin, a corrupt entry is deleted and re-fetched, a rotated upstream fails closed. This also closes the unpinned-curl gap in the existing demo path.
  • Downloads go through curl (already the Docker path's downloader; keeps the Rust tree free of a TLS stack the license gate would reject) into atomic .part files with resume and a per-file lock.
  • The exported bundle is cached under a key derived from the asset pins plus the sha256 of the Python exporter sources, so editing the exporter invalidates bundles automatically. A warm bundle hit skips Python entirely; repeat runs are pure Rust and take about a second.
  • --offline fails fast on a cold cache, --refresh re-downloads, --re-export forces stage 1, cache clear only deletes the cache's known subdirectories and requires --yes.

Shared computation, no drift

build_predictor_report and PredictorReport moved from bin/pwm.rs into pwm_testkit::report with phase callbacks; the pwm CLI and the TUI now render the same single load -> prove -> verify -> tamper computation. The exporter gained an LEWM_JSON_EVENTS NDJSON event mode (pretty log moves to stderr; the Docker path is byte-identical without the variable) and LEWM_PUSHT_PARQUET / LEWM_PUSHT_MP4 local-path overrides so stage 1 runs network-free.

Parity with the Real E2E gate (verified locally)

Cold run on this branch, same conditions the CI gate enforces:

  • accepted: true, weights_root_source: "export-bundle"
  • weights_root 3733fc82…, model 59cc509a…, quant a6fab519…, z_out_head [0, 7, -40, -11, -10, 3]: bit-identical to the Docker --profile real run
  • float_error 0.282924 <= float_tolerance 0.282925
  • tamper pass rejected with FreivaldsCheckFailed { op_id: 2 }
  • warm --offline run: FETCH all cache HITs, EXPORT skipped (bundle cache), exit 0; corrupt-entry re-fetch and cold---offline fail-fast both verified

Tests and gates

  • 18 unit tests in pwm-tui (cache hit/miss/corrupt, pinned fetch over file://, offline fail-fast, rotated-pin fail-closed, event parsing, app state folds, TestBackend render assertions), 2 in pwm_testkit::report, a new stdlib-only Python event-stream test wired into check-local.sh full.
  • check-local.sh quick green; cargo deny check green (documented ignore for the informational RUSTSEC-2024-0436 paste advisory: demo-only via ratatui 0.29, since ratatui 0.30 requires Rust 1.88 above the pinned MSRV 1.85, with instability pinned to 0.3.7 in Cargo.lock for the same reason); MSRV 1.85 workspace build green; rustdoc -D warnings green; release --ignored suite and mutation gate green.
  • New opt-in TUI Smoke workflow (manual + weekly): cold headless run asserting the four parity conditions from the JSON summary, warm offline run asserting the bundle-cache skip, and the cache subcommands.

Follow-ups (out of scope)

  • VERIFY from a disk-serialized artifact (explicit two-party handoff) once PredictorArtifact has a decode path.
  • P1 rollout / P2 planning visualization in the TUI.

…#200)

A new unpublished pwm-tui crate runs the run-real.sh path natively, no
Docker: sha256-pinned download + cache of the checkpoint and the real
lerobot/pusht episode (--cache-dir > PWM_CACHE_DIR > platform default),
uv-orchestrated network-free export with NDJSON progress, then the
in-process prove/verify/tamper of the real weights, rendered live
(stage rail, op histogram, commitments, verdicts) with --headless
--json for CI and cache path|ls|clear management. A warm bundle cache
skips Python entirely.

The pwm prove-predictor computation moved into pwm_testkit::report so
the CLI and the TUI render one computation; the exporter gained
LEWM_JSON_EVENTS and LEWM_PUSHT_PARQUET/MP4 overrides (Docker path
unchanged). deny.toml carries a documented ignore for the
informational paste advisory (ratatui 0.29; 0.30 needs Rust 1.88 >
MSRV 1.85).
@AbdelStark AbdelStark merged commit 34daea7 into main Jun 12, 2026
11 of 12 checks passed
@AbdelStark AbdelStark deleted the feat/tui-real-demo branch June 12, 2026 08:34
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.

TUI demo (ratatui): prove the real checkpoint end to end locally, no Docker, with checkpoint cache management

1 participant