feat(ui): add native full-width status row - #3
Closed
matthias-scale wants to merge 30 commits into
Closed
Conversation
Compile a powerline-style status row into the Herdr TUI above the sidebar/tabs. Collect host, user, network, memory, CPU, and battery metrics in Rust (no tmux/powerline shell scripts), map segment colors to the active theme, and drop tail segments responsively on narrow widths. Includes layout wiring, platform collectors, and characterization tests for full-width placement plus fixture identity/metrics render.
live_server_holds_one_pty_master_fd_per_pane counted only /proc/<pid>/fd links resolving to exactly /dev/ptmx. On devpts setups such as WSL2 and many containers, a PTY master fd resolves to /dev/pts/ptmx instead, so the test found zero masters and failed with "had 0 ptmx master fds; expected 1" even though the server held the pane's master fd. Match both ptmx node paths; pty slaves still resolve to /dev/pts/<N> and stay uncounted, so the one-master-per-pane invariant is unchanged.
* docs: add simplified chinese readme * fix: publish simplified chinese readme * fix: require localized readme for releases * docs: publish simplified chinese readme --------- Co-authored-by: Can Celik <ogulcancelik@gmail.com>
refs herdrdev#1850 Co-authored-by: Can Celik <ogulcancelik@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Port RaviTharuma source head af5ac9d as a native full-width desktop status row onto the maintained fork, targeting fork/pr-base only and never merging. Preserve session, identity, cwd/context, cache-only WAN/network, VPN, battery, date/time, active-theme colors, responsive elision, and focused-sidebar compatibility through a disposable synthetic merge rather than merging PR #1. AC3 (responsive metrics UI) — Right-side MEM and CPU segments use stable GiB/% units, expose explicit unavailable fallbacks, remain legible at 120 columns, and drop in the declared order at the narrow-width boundary. AC5 (negative runtime boundary) — render_status_bar must not perform I/O; first sampling starts immediately, the 2-second cadence permits a maximum of 1 sample in flight, snapshots older than 4 seconds render unavailable, failures retry at the next boundary, and no automatic public-IP request exists. AC6 (cross-platform boundary) — macOS host checks, exact-head Linux/Windows CI, headless tests, and a fallback/source contract prove platform behavior stays in src/platform/.rs and sampling uses only native APIs or local proc/sys files. AC6 also forbids process Command, HTTP clients, and external endpoints. AC8 (integration and delivery gate) — A fresh synthetic merge with fork PR #1 recorded full head, just check, independent review, no-mistakes, unresolved-thread count 0, and Linux/macOS/Windows exact-head fork CI all pass with 0 surviving P0/P1. The multihomed macOS default interface is resolved through native SystemConfiguration. Do not replace literal MEM/CPU with glyphs, do not fetch public IP, do not merge PR #1, do not target master, and do not merge this teammate-authored PR.
What Changed
Risk Assessment
🚨 High: Ordinary focus changes can display the previous pane or workspace’s cwd and branch, contradicting a required status-context invariant.
Testing
No baseline output was supplied; after selecting the required Zig 0.15.2, targeted macOS/shared/runtime/UI tests and visual evidence passed for full-width geometry, active-theme colors, focused-sidebar compatibility, 120-column MEM/CPU legibility, declared elision, explicit fallbacks, native/cache-only sampling, cadence/staleness, and renderer purity, while exact-head Linux/Windows CI and remaining delivery gates stay with the outer executor.
/var/folders/fw/7q2msnnn4d9ft4vd15kl5jp40000gn/T/no-mistakes-evidence/01KYR3AXB6XRNDM3WY3QY88WSH/native-status-row.png)Evidence: Self-contained HTML rendered from the real Ratatui buffer
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
src/platform/macos.rs:437- Intent requires preserving network metrics from source head af5ac9d. This hunk reads Darwinlibc::if_data32-bit byte counters and only widens them afterward, so every 4 GiB wrap makes bandwidth render 0 K/s (about every 34 seconds at 1 Gbit/s). RestoreNET_RT_IFLIST2/if_data64at the macOS platform boundary.src/ui.rs:216- Every view computation now synchronously resolves cwd, including mobile clients and configurations with the status row disabled. Without OSC 7, the path issync_status_focused_cwd→PaneRuntime::cwd→ platform process inspection on every PTY-driven render. Cache/update cwd at a bounded scheduled or focus/state-transition boundary and skip collection when the row is disabled.src/platform/macos.rs:628- AC6 requires “headless tests, and a fallback/source contract” proving no process, HTTP, or external-endpoint sampling. The only negative source scan covers the macOS sampler slice; Linux, Windows, fallback, the shared WAN helper, and attached-versus-detached headless scheduling remain outside that proof. Add the required cross-platform source contract and headless scheduling coverage.src/platform/linux.rs:111- AC3 requires explicit unavailable MEM fallbacks, but missing or malformedMemAvailableis treated as zero available memory, producing a false fully-used reading. Requireavailable_kibto be present so collection failure reaches the existingMEM --/-- GiBfallback.src/app/git_refresh.rs:130- Status-row branch demand causes every workspace repository to be refreshed every 1.5 seconds, although the row only displays the active focused cwd. Separate the active status target from sidebar-driven all-workspace targets to avoid indefinite Git discovery/status work for inactive repositories.🔧 Fix: fix status sampling and scoped refresh boundaries
1 error still open:
src/app/git_refresh.rs:48- Intent requires “Preserve ... cwd/context ... and focused-sidebar compatibility,” but focused-cwd projection now occurs only after the 1.5-second Git deadline check, while the pre-render projection was removed. After switching panes, tabs, or workspaces, the immediate frame combines the new identity with the previous focus's cwd and branch until the next refresh. Invalidate or update this projection at the shared focus-state transition, leaving process-derived resolution on the scheduled path.✅ **Test** - passed
✅ No issues found.
Initialjust test-one platform::status_metrics::testsandjust test-one platform::macos::status_metric_testsattempts identified PATH Zig 0.16.0 as incompatible; retried with the already-installed Zig 0.15.2.ZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one platform::status_metrics::testsZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one platform::macos::status_metric_testsZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one ui::status::testsZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one ui::tests::statusZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one desktop_statusZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one collapsed_sidebar_status_geometryZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one app::runtime::tests::disabled_statusZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one app::runtime::tests::stale_statusZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one apply_workspace_git_statuses_skips_status_projection_when_disabledZIG=/Users/matthiasschedel/.local/share/mise/installs/zig/0.15.2/zig just test-one platform::linux::status_metric_tests::memory_requires_valid_total_and_available_values(zero runnable tests on macOS because the Linux module is target-gated).HERDR_STATUS_EVIDENCE_HTML=…/native-status-row.html ZIG=…/zig-0.15.2/zig just test-one status_bar_visual_evidence_covers_wide_and_120_column_layoutsRendered the generated HTML through headless Chrome and visually inspected the 1900×950 PNG.Verified synthetic-merge ancestry withgit showandgit merge-base --is-ancestorfor af5ac9d9, fork base 1491b7dd, and target 54c0b626.Removed transient Chrome profiles; retained only the requested HTML and PNG evidence files.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.