journeys tui-kit: tk-gradient, the 120 fps gradient in compiled Rust (byte-identical, rate verdict)
LA
5d ago+1240+1240+0123456789012345678901234567890123456789-10-10-01234567890123456789
Summary
This is item 1 of the compiled-load plan (STATUS 4801; cmux-ad 03:40Z: "every load generator that must keep a rate moves to compiled code"). The 120 fps gradient is now tk-gradient, written in Rust.
- The crate:
scripts/journeys/tui-kit/rust/is its own Cargo workspace, std only, with no dependencies. It is not part of cmux-tui, and CI does not build it. It builds from a copy of the kit withtuikit.py build-bins(cargo--release --offline). - The frames:
tk-gradientdraws tuikit.py's gradient frames byte for byte. tuikit.py passesgradient_style(seed)on the command line, so the seed semantics stay Python's. - Pacing:
--pace spinis the default, as in #31671.hybridandsleepare also there. - The log: it writes the same JSON-line events as the Python engine (
monois the same clock astime.monotonic()). Theendevent hasachieved_fps,target_fpsandverdict:NOT RUNbelow 95 % of the target. - Engine choice:
tuikit.py gradient --engine auto(the default) execstk-gradientwhen it is built, and runs the Python engine when it is not. The Python engine'sendevent now gets the same verdict fields, so a slow Python run showsNOT RUN, notok. - heavy_profile: it records
gradient_engine, and a new--build-binsflag builds the programs first. - pace_probe: it adds
rust-spin,rust-hybridandrust-sleepvariants. - tui-kit-selftest.sh: it builds the programs, then runs
cargo test -- --ignored(the crate's own tests are ignored in a plaincargo test). Then it runstest_tuikit.pywithCMUX_TUIKIT_REQUIRE_RUST=1, so the parity and rate tests fail and never skip. ItsTUI-KIT-PACEline isrust-spin.
Testing
Observed / Not run
Observed (cmux-orchestrator-1):
test_tuikit.py: 36 tests OK. The 2 Rust tests skip here, because I build no Rust on this VM. The new tests are:- the bytes match Python's for 5 seeds, sizes and cell widths;
- the Rust engine holds 120 fps (achieved at least 95 %, p95 interval under 12.5 ms);
- a Python run below the floor is
NOT RUN.
test_load_profiles.py: 13 tests OK.rustfmt --edition 2021 --check: clean.scripts/cmux-next/prepush-gate.py: no new violations.
Not run:
- The crate is not compiled yet. I do not compile Rust on this VM, and the fleet runs
tui-kit-selftest.shonly at a feat-cmux-next commit. The first compile and the first parity and rate results come from the self-test after this lands. - If the build fails,
tuikit.py gradientkeeps the Python engine (auto). Its runs then showNOT RUNin their logs, and nothing else depends on the binary. A failure is fixed forward.
Changelog
none
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Adds tk-gradient, a compiled Rust implementation of the 120 fps gradient load, so rate-holding load no longer runs in Python. Its frames are byte-identical to the Python engine's, and both engines now log the same end event verdict.
New binary
scripts/journeys/tui-kit/rust/is its own std-only Cargo workspace with no dependencies; CI does not build it.tuikit.py build-binscompiles it viacargo --release --offline; the seed style still comes from the Python kit'sgradient_style(seed).- The Rust binary supports the same pacing modes (
spindefault,hybrid,sleep) and JSON-line log format as the Python engine.
Integration
tuikit.py gradient --engine auto(default) execstk-gradientwhen built and falls back to the Python engine otherwise.- Both engines'
endevents now includeachieved_fps,target_fps, andverdict; runs below 95% of the target fps logNOT RUNinstead ofok. pace_probe.pyaddsrust-spin,rust-hybrid, andrust-sleepvariants;heavy_profile.pyrecordsgradient_engineand gains--build-bins.tui-kit-selftest.shbuilds the crate, runs its ignored tests, then runstest_tuikit.pywithCMUX_TUIKIT_REQUIRE_RUST=1so parity and rate tests fail rather than skip.