Skip to content

opentui_rust v0.2.3

Latest

Choose a tag to compare

@Dicklesworthstone Dicklesworthstone released this 22 Nov 06:51

Highlights

opentui_rust v0.2.3 is a patch release with no breaking public API changes. It resolves a real UTF-8 slicing panic in Rgba::from_hex uncovered by restoring and running the fuzz suite, repairs benchmark driver exit-code and regression propagation, switches the release profile to opt-level = 3 for significant rendering speedups, resolves RUSTSEC-2026-0486, and clears all --all-targets --all-features clippy and rustdoc warnings.

Bug Fixes & Safety

  • Fix UTF-8 panic in Rgba::from_hex (src/color.rs): Replaced byte-offset &str slicing with byte-slice pattern matching and direct ASCII hex nibble decoding. Multi-byte UTF-8 inputs of 3, 6, or 8 bytes (such as "#中", "日本", "🎨🎨") now safely return None instead of panicking on a non-char boundary, and signed inputs like "+1+2+3" are rejected.
  • Fix fuzz crate package binding & targets (fuzz/, closes #42): Added package = "opentui_rust" under [dependencies.opentui] in fuzz/Cargo.toml (preserving the opentui alias and path = ".."), regenerated fuzz/Cargo.lock, updated fuzz_input_parser.rs to cover PasteBufferOverflow, InvalidResizeFormat, and SequenceTooLong, and guarded substring slicing in fuzz_color_hex.rs with is_char_boundary. All three fuzz targets build cleanly with libfuzzer-sys and pass bounded fuzz runs (fuzz_input_parser 20,000 runs over retained seed corpus, fuzz_color_hex 50,000 runs, fuzz_keyboard_parser 20,000 runs; 0 crashes).
  • Fix benchmark driver failure & regression propagation (scripts/bench.sh, scripts/benchmark_regression.sh, tests/e2e_perf.rs, closes #43):
    • scripts/bench.sh: Captures real child and timeout (124) exit codes via PIPESTATUS[0], passes -- before Criterion baseline flags (--save-baseline / --baseline), detects Criterion regressions under --baseline, records overall status/exit code in benchmark_summary.json, and exits nonzero on any failure, timeout, or regression.
    • scripts/benchmark_regression.sh: Creates log directory before writing, fixes the grep -c ... || echo "0" double-zero bug, parses benchmark output cleanly, preserves cargo bench exit codes, and exits 1 when regressions are detected.
    • tests/e2e_perf.rs: Classifies zero baselines and invalid thresholds as PerfStatus::InvalidBaseline (never Pass), returns Result<PerfBaseline, String> from load_baseline() so missing, unreadable, malformed, or zero-valued baseline files fail loudly without falling back to defaults, and adds 7 harness-integrity unit tests (leaving tests/baselines/perf_baseline.json intact).

Performance ([profile.release] opt-level = 3)

  • Switched [profile.release] from opt-level = "z" to opt-level = 3 (preserving lto = true, codegen-units = 1, panic = "abort", strip = true).
  • Paired same-host interleaved A/B benchmarks (20 rounds on demo_showcase headless workloads, incumbent opt-level = "z" vs v0.2.3 opt-level = 3):
    • headless_smoke_80x24: 2.99 ms -> 2.36 ms (-21.0%, 1.27x faster; A/A noise -5.4%)
    • headless_smoke_200x60: 5.66 ms -> 4.32 ms (-23.6%, 1.31x faster; A/A noise -4.0%)
    • headless_dump_json_200x60: 5.76 ms -> 4.45 ms (-22.9%, 1.30x faster; A/A noise -0.4%, byte-identical 1,097 B JSON output)
    • headless_check_layout / headless_check_hitgrid: within A/A noise (+1.2% / -1.3%)
    • 60-benchmark Criterion suite (workloads, buffer, renderer, color): -33.0% median latency, up to 4.86x faster (diff_reuse_80x24), 4.83x faster (color_from_hex), 4.74x faster (cell_get_full/200x60), and 2.69x faster (full_cycle_with_ansi_80x24), with 0 regressions beyond noise.
    • Stripped demo_showcase release binary: 577,760 B -> 666,760 B (+89 KB, 651 KiB).

Dependencies & Security

  • Updated rustix 1.1.4 -> 1.1.6 to resolve RUSTSEC-2026-0486 (cargo audit: 0 vulnerabilities, 0 warnings for both Cargo.lock and fuzz/Cargo.lock).
  • Updated runtime transitive dependencies (smallvec 1.16.6, tinyvec 1.13.3 dropping tinyvec_macros 0.1.1) and Rust 1.85-compatible dev/build dependencies, alongside dependency bumps merged since v0.2.2 (unicode-width 0.2.3, unicode-normalization 0.1.26, libc 0.2.191, bitflags 2.13.2, insta 1.49.0, serde_json 1.0.154, vt100 0.18.1).
  • Kept proptest 1.11.0 to preserve rust-version = "1.85".

Verification

  • cargo fmt --all -- --check & cargo fmt --manifest-path fuzz/Cargo.toml -- --check: clean
  • cargo clippy --locked --all-targets --all-features -- -D warnings: clean (0 warnings)
  • cargo test --locked --no-fail-fast: 2,411 passed, 0 failed, 14 ignored across 29 targets
  • cargo test --locked --all-features --test visual_pty_test: 8 passed, 0 failed
  • RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps --all-features: clean
  • cargo audit & cargo audit --file fuzz/Cargo.lock: 0 vulnerabilities, 0 warnings
  • shellcheck -S warning scripts/bench.sh scripts/benchmark_regression.sh: clean

Full Changelog: v0.2.2...v0.2.3