Commit Graph

237 Commits

Author SHA1 Message Date
vasilito 7d62a7c0ab docs: document content-hash cache system, binary store, package groups
- AGENTS.md: add cache system to STRUCTURE, WHERE TO LOOK, BUILD FLOW,
  BUILD COMMANDS (--force-rebuild), and CONVENTIONS (dep_hashes.toml,
  binary store restore, package_groups syntax)
- CHANGELOG.md: comprehensive entry for Phase 1-3 + kernel MWAIT +
  ninja-build Redox support
- local/AGENTS.md: note installer fork adds package groups support
- BUILD-CACHE-PLAN.md: fix TOML syntax (underscores not hyphens),
  update all phases to COMPLETE with implementation details, add cache
  flow diagram, add verification results
2026-06-30 17:39:35 +03:00
vasilito ac46660d2e build-cache: content-hash-based caching + binary store restore (Phase 1-2)
Phase 1 — Hash-based cache invalidation:
- DepHashes struct: BLAKE3 hash of each build dep stored in dep_hashes.toml
- collect_current_dep_hashes(): reads blake3 from dep .toml metadata
- dep_hashes_changed(): compares stored vs current hashes
- Replaces mtime comparison as primary cache invalidation check
- Mtime fallback preserved for backward compatibility (no dep_hashes.toml)
- --force-rebuild CLI flag bypasses cache entirely

Phase 2 — Binary store cache lookup:
- repo_builder publishes dep_hashes.toml alongside .pkgar/.toml in repo/
- When target/ is missing but repo/ has the package, restores stage
  artifacts by extracting pkgar, copying toml + dep_hashes.toml
- Auto-generates auto_deps.toml from repo depends field
- Only applies to non-remote, non-force-rebuild builds

See local/docs/BUILD-CACHE-PLAN.md for full architecture.
2026-06-30 15:59:20 +03:00
Red Bear OS 7a24b854c3 docs: Phase E — _TTS/_WAK hooks and DMAR opt-in
- CHANGELOG.md: added Phase E entry describing the new
  transition_to_s_state / wake_from_s_state / enter_sleep_state
  methods on AcpiContext, and the opt-in DMAR init with hard
  cap. Includes the final gap-closure status table showing
  9 closed, 1 closed-in-part, 2 still open (both require
  hardware-specific work).

- local/docs/ACPI-FORK-SYNC-STRATEGY-2026-06-30.md: added
  Phase E outcome section with the changes applied and
  out-of-scope items.
2026-06-30 07:16:39 +03:00
Red Bear OS cab9655a8b docs: comprehensive Phase D updates — CHANGELOG, strategy, improvement plan, boot-logs README
- CHANGELOG.md: added comprehensive 2026-06-30 entry covering
  the full ACPI fork-sync (Phases A-D) and the redbear-sessiond
  consumer port. Lists the 7 critical gaps that are now fully closed
  and the 2 still open (DMAR + _WAK infrastructure).

- local/docs/ACPI-FORK-SYNC-STRATEGY-2026-06-30.md: added Phase D
  outcome section with the Linux 7.1 cross-reference findings
  (acpi_enter_sleep_state pattern), the changes applied to acpid
  and redbear-sessiond, and the final gap-closure table.

- local/docs/ACPI-IMPROVEMENT-PLAN.md: updated "Current Truthful
  Status" to reflect that acpid now follows the Linux 7.1 sleep
  pattern with _PTS/_SST evaluation, thermal/power enumeration
  works, AML mutex is real, parse_lnk_irc validates ranges, and
  S5 works end-to-end. S1-S4 paths still need _WAK + wakeup
  vector + P-state preservation (Gap #4b scaffolded but not
  implemented). DMAR init still disabled (Gap #2 needs real-HW
  investigation).

- local/docs/boot-logs/README.md: added
  REDBEAR-MINI-BOOT-PS2D-INPUTD-LOG-FIX.md to the inventory.

Also:
- Removed scratch file local/docs/ACPI-FIX-PLAN-2026-06-30.md
  (superseded by the longer ACPI-FORK-SYNC-STRATEGY-2026-06-30.md).
2026-06-30 06:38:51 +03:00
vasilito 7dfebab9bf docs: comprehensive cross-references for 2026-06-30 input-stack fix
Updates six documentation files to point readers to the new
input-stack observability evidence and changelog entry. No
content claims are altered — only "see also" pointers and inventory
updates.

- CHANGELOG.md: new 2026-06-30 entry documenting the input-stack
  fix (commit de9d1f4 in local/sources/base/), the git server
  docs rewrite (commit 0c60adc6b), and the build-system
  hardening addendum (commit 41045fd2f). Includes the verified
  end-to-end interactive login evidence from the rebuilt ISO.

- local/docs/boot-logs/README.md: add the new
  REDBEAR-MINI-BOOT-PS2D-INPUTD-LOG-FIX.md file to the
  inventory table.

- local/docs/IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md:
  see-also pointer in the inputd validation deliverables
  section.

- local/docs/REDBEAR-BOOT-EXPERIENCE-PLAN.md: see-also pointer
  in the bootanim handoff section, noting that step 6
  (REBIND_DISPLAY drm to inputd) now has companion
  observability via the new inputd startup log.

- local/docs/USB-IMPLEMENTATION-PLAN.md: see-also pointer in
  the HID producer modernization section, noting that the fix
  lets operators distinguish "usbhidd dead" from
  "usbhidd alive but not enumerated by XHCI".

- local/docs/GREETER-LOGIN-IMPLEMENTATION-PLAN.md: see-also
  pointer in the service wiring section, noting that the greeter
  can rely on the new inputd/ps2d startup lines being present
  before inputd -A 3 runs.
2026-06-30 03:17:30 +03:00
vasilito ded5331006 docs: verify ps2d/inputd startup-log fix on rebuilt mini ISO
Update REDBEAR-MINI-BOOT-PS2D-INPUTD-LOG-FIX.md with the actual
runtime verification evidence captured at 2026-06-30T00:06:16Z:

- Both new startup log lines appear in initfs at the exact source
  line numbers (@inputd:661, @ps2d:96), proving the fix is baked
  into the running image.
- End-to-end interactive login succeeded: operator typed root +
  password at the Red Bear login: prompt and reached a
  redbear# shell (Red Bear OS v0.2.4 "Liliya").

This conclusively confirms the diagnosis: the input chain
(ps2d -> inputd -> fbcond -> getty -> login -> shell) was working
all along. The previous "freeze" was a test-harness issue (no
keystrokes sent to the guest), not an OS bug. The new log::info!()
lines make the input stack health visible in future boot logs.
2026-06-30 03:07:49 +03:00
vasilito 41045fd2f1 docs: capture ps2d/inputd boot-log diagnosis + addendum to BUILD-SYSTEM-IMPROVEMENTS
Two documentation changes:

1. New file local/docs/boot-logs/REDBEAR-MINI-BOOT-PS2D-INPUTD-LOG-FIX.md
   captures the 2026-06-30 diagnosis of why the mini boot appeared to
   freeze at the login prompt. Records:
   - The actual root cause (test harness not injecting keystrokes, not
     an OS bug — ps2d/inputd were working silently).
   - The committed fix (de9d1f4 in local/sources/base/ adds two
     log::info!() startup messages so operators can verify the input
     stack is alive from the boot log).
   - The expected post-fix boot log lines and how to interpret them.
   - Verification status (source-inspected; clean post-fix QEMU boot
     pending due to slow bootloader streaming under -nographic).

2. Addendum appended to local/docs/BUILD-SYSTEM-IMPROVEMENTS.md
   documenting four build-system ergonomics issues observed during
   the diagnosis session:
   - #11: local/sources/base/ inner git repo origin points to
     upstream Redox instead of Red Bear gitea.
   - #12: outer Red Bear repo cannot show inline diffs for the
     nested local/sources/base/ git repo (submodule pointer dirty).
   - #13: no preflight warning for stale local-fork source (a
     4-line edit caused a 30+ min rebuild with no advance notice).
   - #14: -nographic + OVMF boot is too slow for time-budgeted
     post-fix QEMU verification; recommend BIOS + KVM path.

Both items are S-sized and could be picked up in any future hardening
session. No code changes in this commit.
2026-06-30 02:55:51 +03:00
vasilito ab297a874a fix: gitlab→gitea URL + accumulated source fixes from build 2026-06-29 11:59:31 +03:00
vasilito 7b9552c960 docs: QUIRKS-AUDIT — factual inventory of consumers, tombstones, DMI dup
Following a full repo-wide grep and source review of all quirks
files (mod.rs, pci_table.rs, usb_table.rs, dmi.rs, toml_loader.rs,
pci.rs, i2c-hidd/quirks.rs), this companion to QUIRKS-SYSTEM.md
documents the current ground-truth state of the subsystem as of
2026-06-29.

Findings:

- 11 Rust + 6 C consumers of the redox-driver-sys quirks engine
- 1 separate DMI quirks engine in i2c-hidd (uses RON, not TOML)
- 6 dead-code entry points that return empty flags:
  * lookup_pci_quirks_full actions (Vec::new)
  * lookup_xhci_controller_quirks_full (stub)
  * lookup_hid_quirks (stub)
  * load_dmi_acpi_quirks (stub)
  * load_platform_dmi_quirks (stub, empty PLATFORM_RULES)
  * load_drm_panel_orientation (empty PANEL_ORIENTATION_TABLE)
- 4 PciQuirkFlags bits (22-25) have no entry in PCI_FLAG_NAMES,
  so they cannot be set via /etc/quirks.d/*.toml
- DMI is consumed in two incompatible ways:
  * redox-driver-sys reads /scheme/acpi/dmi as a flat key=value file
  * i2c-hidd reads /scheme/acpi/dmi/{system_vendor,...} as per-field
    subpaths, and matches case-insensitive
- redbear-quirks stages 10 TOML files to /etc/quirks.d/; the
  TOML layer is fully live (this corrects an earlier claim
  that it was dormant)

The audit concludes that the system is correctly initialized and
utilized per its design. No redesign is needed; the existing
QUIRKS-SYSTEM.md is mostly accurate but understates how many
defined functions return empty data and how many flag names
are missing from the TOML schema.
2026-06-29 09:15:06 +03:00
vasilito d7ee730975 docs: CachyOS boot analysis reference + captured kernel log
Reference analysis for Red Bear OS integration based on running the
latest CachyOS desktop ISO (28 Jun 2026) under QEMU/KVM. Documents
the hardware-enumeration and kernel-init sequences a reference Linux
distro produces on the i440FX + PIIX machine type that Red Bear OS
also targets, with line-by-line mapping to Red Bear OS subsystems
(pcid, ided, e1000d, vesad, xhcid, hwd/acpid).

- local/docs/CACHYOS-INTEGRATION.md: Cross-cutting analysis
  (executive summary, hardware inventory, ACPI table coverage,
   PCI quirks, boot-phase ordering, init system comparison, action
   items).
- local/docs/boot-logs/cachyos-kernel-20260629-0520.log: Captured
  441-line dmesg-grade log from the CachyOS kernel boot (SeaBIOS
  handover through ACPI, PCI, USB, ATA, network enumeration and
  up to a rootfs shell prompt).
- local/docs/boot-logs/cachyos-boot-20260629-0520.md: Pointer
  document with the capture command and the rationale for the
  indirect-kernel invocation (the QEMU + CachyOS + KVM boot stalled
  at the ISOLINUX EDD probe when run from CD; bypassing with
  -kernel/-initrd and an explicit console=ttyS0 earlyprintk command
  line recovered the full log).

Sources used: https://cachyos.org/ (release info) and the on-disk
ISOLINUX + archiso boot path extracted from
cachyos-desktop-linux-260628.iso.
2026-06-29 04:49:59 +03:00
vasilito ee086ded2d redbear-power: RAPL MSR constants, unit parsing, MSR-based energy reading
- msr.rs: add all Intel RAPL MSR addresses (0x606-0x64D) and AMD Zen
  equivalents (0xC0010299-0xC001029B), RaplUnit struct for unit register
  parsing with energy_to_uj/power_to_w conversion, read_rapl_energy()
  and read_rapl_energy_uj() functions
- acpi.rs: read_rapl_package_energy() now tries MSR first (Intel then
  AMD PKG energy MSRs) with unit-based µJ conversion, falls back to
  Linux powercap sysfs
- local/docs/RAPL-IMPLEMENTATION-PLAN.md: comprehensive 3-phase plan
  based on Linux 7.1 kernel analysis, Intel SDM, Fuchsia RFC-0203
  patterns. Documents P0 blocker: /scheme/sys/msr/ not implemented
  in kernel
2026-06-28 16:55:51 +03:00
vasilito 8af119d1a9 Remove duplicate redbear-netctl-console recipe (nested inside redbear-netctl) 2026-06-28 00:01:47 +03:00
vasilito 1f0c0a01c5 redbear-power: doc v1.44 plan (affinity setter feasibility audit)
Adds §68 (v1.44 plan) and revises §67.7 (v1.43
deferred list) to reflect the v1.43 audit findings.

Key corrections captured in the doc:
  - The Redox kernel ALREADY implements
    sched_setaffinity and sched_getaffinity
    (local/sources/kernel/src/syscall/process.rs:322-382).
    Only the relibc POSIX <sched.h> wrapper is missing.
  - The existing P7-pthread-affinity relibc patch
    provides cpu_set_t, cpuset_to_u64, copy_u64_to_cpuset
    — v1.44 can reuse these instead of duplicating.
  - Kernel pid=0 limitation is documented at
    kernel/src/syscall/process.rs:336-338 as a TODO;
    v1.44's UX is honest about this ('pin redbear-power's
    own TUI to this process's CPU list, not the
    highlighted process's').
  - Per-thread CPU% is REJECTED for v1.44 because the
    Redox proc scheme doesn't expose /proc/<pid>/task/<tid>/stat.
    Same trap as v1.41 read_thread_io. Tracked as a kernel
    follow-up, not a redbear-power feature.
  - disk_history cap is REJECTED for v1.44 because the
    natural bound on block device count (~4-8 typical)
    makes the cap moot. Drive-by include it elsewhere.

Implementation plan documented:
  1. relibc patch P12-sched-setaffinity.patch (~110 LoC,
     reusing P7 helpers)
  2. redbear-power affinity.rs module (~30 minutes)
  3. main.rs key binding (capital A) + PID detail
     popup integration (~1.5 hours)
  4. 5-7 tests (round-trip, pid=0 limitation, parse/format,
     integration against /proc/self/status)
  5. Doc update §69 on what shipped

Effort estimate: ~1 working day, end-to-end. The
relibc patch alone is <3 hours given P7 reuse.

Downstream recipe impact audited (LOW):
  - Mesa and xz both wrap sched_getaffinity in
    defensive probes — they go from ENOSYS to
    'current process mask works' (strict improvement,
    no break).

No code changes — planning-only commit.
2026-06-21 15:27:47 +03:00
vasilito 0098147e5c docs(build-system): add v6.1 addendum for cleanup safety + qfeatures.h fix
Document two critical build-system findings:

C-7.1: Ad-hoc cleanup scripts deleted tracked sources
  - Added local/scripts/cleanup-build.sh (git-aware cleanup)
  - Updated AGENTS.md with safe cleanup procedure

C-7.2: qtdeclarative missing qfeatures.h caused division-by-zero
  - Added cmake --install to properly stage generated headers
  - Added explicit QT_FEATURE_quick_shadereffect/draganddrop flags
  - Added safety-net to regenerate qtquick-config.h if empty
2026-06-21 15:26:24 +03:00
vasilito 6a7abe0b87 feat(build-system): add safe cleanup script and update docs
Add local/scripts/cleanup-build.sh - a git-aware cleanup script that
uses 'git ls-files' to whitelist tracked files before deletion.
Prevents the class of cleanup disasters that deleted local recipe
sources and local fork sources.

Update AGENTS.md with the new safe cleanup procedure.
Update CONSOLE-TO-KDE-DESKTOP-PLAN.md to v5.8 with the qtdeclarative
qfeatures.h fix and the new safe cleanup script.
2026-06-21 15:15:57 +03:00
vasilito f83a059c25 redbear-power: v1.43 history reclaim LRU
The first item from the v1.42 deferred list: a
configurable LRU cap on the per-PID history maps.
On long uptimes with thousands of short-lived procs
(build servers, CI runners), the maps would grow
without bound, eventually consuming significant
memory. v1.43 caps the maps at 500 PIDs by default
and evicts the LRU entry on overflow.

The cap
  - App::max_history_pids: usize (default 500)
  - 0 = disable (reaper still prunes exited PIDs)
  - Shared across the 3 per-PID maps (io_history,
    cpu_history, rss_history). They are always
    populated in lockstep so a per-PID CPU history
    without the corresponding IO history would be
    a 'ghost' entry that confuses the renderer.
  - disk_history is NOT capped (keyed by disk name,
    natural bound on block device count).

LRU tagging
  - New App::pid_last_seen: BTreeMap<u32, u64>
  - New App::refresh_tick: u64 (incremented on every
    update_io_history call)
  - We use a refresh counter, not Frame::count(),
    because the history update happens during
    refresh (not during render). Frame::count would
    tag currently-visible PIDs rather than
    recently-updated PIDs — a different (and
    incorrect) notion.

Eviction algorithm
  1. Increment refresh_tick
  2. Reap exited PIDs from all 3 maps and
     pid_last_seen
  3. If pid_last_seen.len() > cap: sort by tick
     ascending, take the first overflow entries,
     remove from all 3 maps + pid_last_seen
  4. Continue with the existing pipeline

Cost: O(n log n) per refresh, n bounded by 500.
At 500 PIDs: ~4500 comparisons per refresh,
<100µs. Memory budget: ~28 KB at cap, vs
unbounded growth without the cap (~5.5 MB at
100k PIDs).

Tests
  - 3 new tests (eviction removes oldest, cap=0
    disables, no-op under cap).
  - 186/186 tests pass (was 183 in v1.42).

The improvement plan doc is also updated with §67
covering the v1.43 architecture, the cap policy,
the LRU tagging, the eviction algorithm, the
memory budget, and the v1.44 deferred list.
2026-06-21 14:00:02 +03:00
vasilito 0771fa2ff6 redbear-power: v1.42 CPU affinity
The next item from the v1.41 deferred list: read
/proc/<pid>/status:Cpus_allowed_list and display it as
both a single-char row indicator and a full expanded
list in the PID detail popup. htop parity.

Kernel format
  The kernel emits the list as comma-separated ranges:
    "0-3,5,7-11" means CPUs 0, 1, 2, 3, 5, 7, 8, 9,
    10, 11
  Cpus_allowed_list is the HARD affinity mask (settable
  via sched_setaffinity(2)). v1.42 reads it because it
  matches what an operator sees with 'taskset'.

New functions
  - read_cpu_affinity(pid): parses the kernel string
  - parse_cpu_list(s): public, testable parser
  - format_cpu_list(ids): inverse of parse_cpu_list
  - read_cpu_affinity_for_pid(pid): pub wrapper for the
    PID detail popup

Two display modes
  - Process panel row: '*' (subset), ' ' (all CPUs),
    '?' (unknown). Single char so COMM stays visible.
  - PID detail popup: full range string + expanded
    Vec (truncated to 8 items on large machines).

New field on ProcessInfo
  - cpu_affinity: Option<Vec<u32>>

Robustness
  - Whitespace tolerated
  - Out-of-order or duplicate IDs deduped and sorted
  - Non-numeric chunks silently dropped
  - Reversed ranges (start > end) silently dropped
  - Empty input returns empty Vec (popup distinguishes
    'no data' / None vs 'explicitly empty' / Some(empty))

Tests
  - 13 new tests (11 in process.rs for parse/format/
    read, 1 self-affinity test, 1 missing-pid test).
  - 183/183 tests pass (was 170 in v1.41).

The improvement plan doc is also updated with §66
covering the v1.42 architecture, kernel format, the
two display modes, the parse/format inverse pair, and
the v1.43 deferred list.
2026-06-21 13:38:24 +03:00
vasilito 34e9ec2a05 redbear-power: v1.41 per-thread IO aggregation
The next item from the v1.40 deferred list: walk
/proc/<pid>/task/*/io for every process and sum
read_bytes and write_bytes across all TIDs. Surfaces
'is one thread of this 32-thread process hammering
disk?' which the process total hides.

Linux kernel attribution quirk
  /proc/<pid>/io:read_bytes is the process total,
  NOT the per-thread sum — the kernel attributes all
  IO to the process even when threads initiate it.
  So the two surfaces can match, diverge, or be
  independently None depending on kernel version and
  permission model. We never compare or subtract them.

New fields on ProcessInfo
  - thread_io_read_kb, thread_io_write_kb (summed bytes)
  - thread_io_read_rate_kbs, thread_io_write_rate_kbs
    (delta-based rate via the same compute_rate_kbs
    helper used for the process-total rates)

New sort modes
  - ThreadIo: read+write total
  - ThreadIoR: read only
  - ThreadIoW: write only
  The cycle reaches all 3 via a back-door arm of next()
  that returns to Rss (not Name) to avoid breaking the
  main loop.

New column in Process panel
  T-IO between the per-thread rate and the MEM column.
  Now 12 columns total. PID detail popup gets a
  [thread_io] section that re-reads the task dir on
  open for a current value.

Tests
  - 6 new tests (3 in process.rs for read_thread_io,
    3 for the sort modes + cycle).
  - 170/170 tests pass (was 164 in v1.40).

The improvement plan doc is also updated with §65
covering the v1.41 architecture, the Linux kernel
attribution quirk, the new fields, the sort cycle
back-door, the cost analysis (~500 reads/sec at
typical desktop loads, ~7500 at 128-thread server
loads — well within budget), and the v1.42
deferred list.
2026-06-21 13:19:20 +03:00
vasilito 2f8e35a88a redbear-power: v1.40 persistent session state
The first item from the v1.39 deferred list: the user's
tab, sort mode, sort direction, tree mode, filter, and
fold set now survive a restart of redbear-power.

Architecture
  - New module session.rs (separate from config.rs which
    is read-only system-wide config).
  - config.rs: behavior config (refresh interval, theme,
    keybindings) — read once at startup, never written.
  - session.rs: mutable per-user runtime state — read at
    startup AND written on every tab change and on quit.

Storage
  - $XDG_CONFIG_HOME/redbear-power/session.toml (preferred)
  - ~/.config/redbear-power/session.toml (fallback)
  - Writes are atomic: temp file + rename(). A crash
    between write and rename leaves the prior session
    intact.

Save hooks
  - Every set_tab() call: tab is the high-signal event
    the user explicitly opted into.
  - On graceful quit (q/Esc): captures the final sort,
    filter, and fold set.

Failure modes
  - load() never errors. Missing file = defaults.
    Corrupt file = defaults + one-line warning.
  - save() never errors. Permission denied = eprintln!
    warning. The next launch reads the prior session
    (or defaults) and starts from there.

Tests
  - 6 new tests in session.rs (round-trip, missing-file,
    malformed-toml, atomic-save, default-state, end-to-end
    via App::save_session()).
  - 164/164 tests pass (was 158 in v1.39).

The improvement plan doc is also updated with §64
covering the v1.40 architecture, storage paths, save
policy, failure modes, and the v1.41 deferred list.
2026-06-21 12:18:13 +03:00
vasilito 5bd371c070 redbear-power: v1.39 cursor preservation + T-IO column + process environ
v1.39 lands three htop/btop parity features plus the
audit-fix discipline introduced in v1.37/v1.38:

1. Cursor preservation across sort
   o and i keypresses no longer reset the cursor to row 0.
   The cursor follows the currently-selected PID through the
   re-sort. Implemented as App::remember_and_restore_cursor()
   which walks the post-filter visible list. Three regression
   tests: follows PID, respects filter, falls back when PID
   exits.

2. Per-thread IO rate (T-IO column)
   New ProcessInfo::io_per_thread_rate_kbs() returns the
   aggregate IO rate divided by num_threads, surfacing
   thread-pool pressure that's hidden in the aggregate. A
   32-thread process at 320 KiB/s is the same as a 1-thread
   process at 10 KiB/s in aggregate, but very different
   in operator-relevant 'IO per worker' terms. Returns None
   when num_threads <= 0 (data error, not '0 KiB/s per
   thread' which would mislead the operator). Three unit
   tests cover the divide, the missing-total case, and the
   zero-threads case.

3. Process environ in PID detail
   /proc/<pid>/environ read as NUL-separated KEY=VALUE
   pairs, sorted by key for stable popup rendering.
   Rendered as the first 8 vars in the PID detail popup
   with a '(N variables)' header. htop F7 parity. Three
   unit tests: parse self environ, missing PID, value
   containing '=' (must split on FIRST '=' only).

The improvement plan doc is also updated with sections
56-63 covering v1.32 (sparklines) through v1.39
(per-thread IO + environ) since the doc previously
stopped at v1.31.

Test count: 158/158 pass (was 149 in v1.38.1).
2026-06-21 12:03:12 +03:00
vasilito 2597246908 redbear-power: v1.31 per-PID IO rate sparkline
Activates the v1.25-deferred 'persistent rate sparkline' future-use.
Each process in the Process tab now shows a 12-sample sparkline
of its IO rate history (last 78 seconds at the 6.5s process
refresh cadence).

- New App.io_history: BTreeMap<u32, VecDeque<u64>>
  Per-PID history of raw f64-bit rate samples. BTreeMap for
  stable iteration; VecDeque for O(1) push-back + pop-front.
- PROCESS_IO_HISTORY_LEN = 12 (12 samples * 6.5s = 78s of history)
- App::update_io_history() runs after sort_tree + apply_fold
  on every process refresh. Three-pass algorithm:
    1. Reap: drop history for PIDs that exited
    2. Append: push new f64-bit sample for PIDs with known rate
       (PIDs with None rate are skipped, no entry created)
    3. Normalize: divide each sample by the per-history max,
       scale to u8 0..=255. Separate pass so max is computed
       once per history, not per sample.
- render::io_rate_sparkline(&[u8]) helper maps 0..=255 to
  Unicode chars (\u2581\u2582... matches existing load sparkline)
- New 'IO-RATE' column in Process panel between RSS/VSZ and
  COMM. 12 chars wide. Empty spaces for PIDs with no history
  yet (first tick after startup).
- Why u64 storage of f64 bits: normalization needs the full
  f64 range; clamping to u8 before normalize would lose
  precision for high-rate PIDs.

Test count 117 -> 121 (+4):
- update_io_history_reaps_exited_pids
- update_io_history_normalizes_against_max (100/200*255=127.5
  rounds to 128; 200/200*255=255)
- update_io_history_handles_all_zero (no div by zero)
- update_io_history_skips_pids_without_rate (None rate \u2192
  no entry created; no panic)

Redox stripped binary: 4,201,320 bytes (+4 KiB from v1.30).
Memory: ~91 KiB for 600 PIDs (negligible).
Compile warnings: 55 (unchanged).

Notes:
- CPU% sparkline per process: defer (same pattern, separate work)
- RSS sparkline per process: defer
- Variable sparkline length: defer (header is 'IO-RATE' not
  'IO-RATE 12' so a future change to PROCESS_IO_HISTORY_LEN
  doesn't need a header update)
- Per-PID scaling (not global): each PID's max is 255. A
  long-running PID at 5 KiB/s steady shows full bars; a
  bursty PID that just started at 50 KiB/s also shows full
  bars. Global scaling would flatten the long-running one.

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA755
2026-06-21 07:19:16 +03:00
vasilito e2570104a5 redbear-power: v1.30 Process-tab cursor navigation
Activates the v1.29-deferred cursor-navigation future-use. The
Process tab is now fully interactive: j/k and arrow keys move
the cursor, PageUp/PageDown scroll by 8 rows, the visible row
is bolded as the cursor, Enter and Space operate on the
cursor's PID.

- move_selection is now tab-aware:
    PerCpu -> move_cpu_selection (old behavior)
    Process -> move_process_selection (new)
    other -> no-op
- move_process_selection clamps process_cursor to
  [0, visible.len()-1] (saturating_add for big deltas)
- page_selection is also tab-aware (8 rows per page for Process)
- j/k hotkeys (vim-style) call move_selection
- visible_processes() helper extracted (deduplicates the
  filter+collect logic that move_process_selection and
  selected_pid both needed)
- selected_pid() now uses process_cursor directly (was using
  table_state.selected() which was the Per-CPU widget's
  selection — wrong tab indirection)
- theme::CURSOR: bold style for the cursor row (no background
  color; background flickers on rapid style changes on some
  terminals; bold is stable)
- Render layer applies theme::CURSOR when current_tab==Process
  AND the visible_index matches process_cursor AND focused

Test count 111 -> 117 (+6 in new app::tests mod):
- move_process_selection_down_clamps_to_last
- move_process_selection_up_clamps_to_zero
- move_process_selection_empty_list_is_noop
- move_process_selection_respects_filter
- selected_pid_returns_none_when_empty
- selected_pid_returns_none_when_filter_excludes

make_app_with_processes(n) helper clears App::new()'s /proc
read first so the test fixtures don't mix with real procs.

Redox stripped binary: 4,197,224 bytes (+16 KiB from v1.29).
Compile warnings: 55 (unchanged).

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA754
2026-06-21 07:02:11 +03:00
vasilito 96491c8a8a docs: update CONSOLE-TO-KDE-DESKTOP-PLAN.md to v5.7
- qtsvg strtold compat fix
2026-06-21 02:30:59 +03:00
vasilito 988e8b29bb redbear-power: v1.29 fold/expand tree
Activates the v1.27-deferred fold/expand feature. The tree
view from v1.27 is now interactive: pressing Space on a
parent row toggles whether its descendants are visible.

- New App.folded: BTreeSet<u32> (PIDs whose subtrees are
  collapsed; stable iteration order for future debug dumps)
- New App.process_cursor: usize (Process-tab cursor; distinct
  from table_state which tracks the Per-CPU tab)
- New process::apply_fold(processes, folded) -> Vec<ProcessInfo>
  Hides descendants of any PID in . The fold target
  itself stays visible. Roots are never hidden. Cycles
  tolerated (sort_tree's visited set prevents infinite loops).
- Fold indicator in tree_prefix: \u25b6 for folded, \u25bc for
  expanded, no marker for leaf rows
- Space keypress (in tree mode only) toggles fold on the
  cursor's selected PID; flashes 'folded PID N' or
  'unfolded PID N' (or 'has no children to fold' for leaves)
- sort_tree kept pure; apply_fold is a separate post-step
  applied in app.rs after sort_tree

Test count 107 -> 111 (+4):
- apply_fold_empty_set_is_identity
- apply_fold_hides_descendants_of_folded_root (folds root)
- apply_fold_hides_subtree_of_folded_child (folds middle;
  sibling of folded node stays visible)
- apply_fold_unfold_restores (toggle off)

Redox stripped binary: 4,180,840 bytes (-8 KiB from v1.28;
linker dedup'd some shared code).
Compile warnings: 55 (unchanged).

Notes:
- No cursor navigation yet (j/k, down/up). Default cursor
  is row 0, so user can fold the first process but cannot
  yet move down. Defer to v1.30.
- No persist of fold state across redbear-power restarts.
  Would require a config file. Defer.

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA753
2026-06-21 01:55:48 +03:00
vasilito df3021575e redbear-power: v1.28 virtual size sort (activates vsize_kb)
Closes the v1.23-deferred 'vsize_kb' future-use. Adds SortMode::VSize
that sorts by virtual size, and swaps the Process panel's MEM
column to show VSZ (instead of RSS) when that sort is active.

The column-swap pattern (the column being sorted IS the column
being shown) keeps the panel at 10 columns instead of growing
to 11. htop uses the same pattern: when you sort by a field,
that field's column expands to show the data. No new column
means no terminal-width pressure at 1280x720 framebuffer.

The 'ppid' field's #[allow(dead_code)] is also removed (now
actively read by sort_tree + tree_prefix from v1.27). Both
fields now have proper doc comments explaining their use
(vs the v1.23 'reserved for future use' placeholder).

VSZ is a virtual address-space metric (mmap'd libraries, heap,
stack, reserved-but-uncommitted) and is often much larger than
RSS. Useful for 'who is using the most address space' but NOT
for 'who is using the most physical memory' (use RSS for that).
This caveat is now documented in the field's doc comment to
prevent operator confusion.

Test count 105 -> 107 (+2):
- sort_by_vsize_descending (basic)
- sort_by_vsize_uses_vsize_not_rss (contract test: huge VSZ +
  tiny RSS sorts above tiny VSZ + huge RSS; catches any
  'optimization' that uses the larger of the two fields)
- sort_cycle and io_name_is_io updated for VSize

Redox stripped binary: 4,189,032 bytes (+4 KiB from v1.27).
Compile warnings: 55 (no net change; the 2 removed
#[allow(dead_code)] annotations cancel against 2 new
warnings that did not exist before because the fields were
only accessed from the parse path).

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA752
2026-06-21 01:46:11 +03:00
vasilito 3dcdb758e7 redbear-power: v1.27 process tree view
Activates the v1.23-deferred 'ppid' future-use: parents render
above their children with ASCII tree connectors. The default
view is flat (no behavior change); the 'T' hotkey toggles
tree mode and flashes the status line.

Algorithm (in process::sort_tree):
1. Build pid -> index map
2. Group children by ppid (ppid -> Vec<index>)
3. Roots = ppid==0 or ppid not in pid set
4. Sort each sibling group by current SortMode (so e.g. RSS
   sort still shows top-RSS child first within a parent)
5. DFS from each root, emitting parent + descendants pre-order
6. Defensive: append unvisited procs at end (cycle fallback)

Cycle protection: visited set; revisiting a PID stops recursion
(its children are still emitted once).

Render: tree_prefix(pid, ppid, all) returns
  ''  (root)
  '  \u2514\u2500 ' (last child)
  '  \u251c\u2500 ' (non-last child)
Walks ppid chain to compute depth (max 64 hops).

Status line: 'view: tree' shown when on; help text mentions 'T'.

Test count 101 -> 105 (+4):
- sort_tree_emits_parents_before_children (4-proc tree)
- sort_tree_handles_orphans (ppid not in list)
- sort_tree_handles_cycles (1->2->1 cycle)
- sort_tree_empty_input

Redox stripped binary: 4,184,936 bytes (+16 KiB from v1.26).
Compile warnings: 55 (unchanged).

Notes:
- vsize_kb still has #[allow(dead_code)]; will be activated in
  a future memory-detail panel release.
- Tree is static (no fold/expand); defer to a v1.28 if needed.
- ppid's #[allow(dead_code)] can be removed in a follow-up
  (now actively read by sort_tree and tree_prefix).

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA751
2026-06-21 01:39:29 +03:00
vasilito 04894a18c9 redbear-power: v1.26 remove dead code (BREAKING)
Completes the v1.22 audit W2 cleanup. v1.23 deferred this for a
CHANGELOG note; this release documents the breaking change.

REMOVED (no callers anywhere in the source tree):

- ProcInfo::read_with_cpu_pct(prev, dt_secs, num_cpus)
  Was a 1-line wrapper around read_with_cpu_pct_sorted(..., Rss)
  that no caller actually used. Migration: call
  read_with_cpu_pct_sorted(prev, dt, ncpu, SortMode::default())
  inline (or just use ProcInfo::read() if RSS is fine).

- ProcInfo::available() -> bool
  Was a pre-flight check ('is /proc mounted?') that no caller
  used. read() already returns ProcInfo::default() when /proc
  is absent, so the empty result is the same signal. Migration:
  check !proc.is_empty() after a read, or call read() and
  handle the empty case.

OTHER CHANGES:

- Removed unused 'use std::path::Path;' (was only used by the
  removed ProcInfo::available).
- Updated read_with_cpu_pct_sorted doc comment to mention
  'CPU% and IO rates' (reflects the v1.25 addition).

BREAKING: any external consumer of redbear-power's process module
that called either of these methods will fail to compile. The
recipe's own source (the only known consumer) is updated.

Test count: 101 (unchanged; removed methods were untested).
Compile warnings: 55 -> 54 (the unused Path import is gone).

Redox stripped binary: 4,168,552 bytes (unchanged; the removed
code was tiny and the linker dedup'd the wrapper body).

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA750
2026-06-21 01:05:09 +03:00
vasilito aaa1b950b4 redbear-power: v1.25 IO rate column + rate sort modes
Per-process IO is now also a throughput metric (KiB/s), not just
cumulative. Cumulative bytes favor long-lived processes regardless
of activity; rate is what operators actually want for 'what is
hammering the disk right now'.

- New fields on ProcessInfo: io_read_rate_kbs, io_write_rate_kbs
  (Option<f64>; None when prev missing, current None, or dt<=0)
- New method: io_total_rate_kbs() (sum; same None semantics)
- New helper: compute_rate_kbs(prev, now, dt) -> Option<f64>
  uses saturating_sub for clock-reset safety
- read_with_cpu_pct_sorted now also computes the two rate fields
  (negligible cost: 2 subs + 2 divs per process per refresh)
- New SortMode variants: IoRate, IoReadRate, IoWriteRate
  inserted in cycle after IoWrite
- name() returns 'IO/s', 'R/s', 'W/s' for status line
- New sort_by_io_rate_field() helper (Option<f64> partial_cmp)
- New format_rate_kbs() on ProcessInfo (KiB/s, MiB/s, GiB/s, TiB/s;
  saturates negative to 0)
- New RATE column in the Process panel between IO and RSS

Test count 87 -> 101 (+14):
- 6 compute_rate_kbs edge cases (basic, None prev/now, dt<=0,
  saturating underflow, idle = zero)
- 2 io_total_rate_kbs (sum, None)
- 2 sort-by-rate (total, read-pushes-missing)
- 4 format_rate_kbs (sub-KiB, 1 MiB, 1 GiB, negative)
- sort_cycle and io_name_is_io updated for new variants

Redox stripped binary: 4,168,552 bytes (+49 KiB from v1.24;
14 new tests + 2 sort modes + 2 fields + render column + 3 helpers).
Compile warnings: 55 (unchanged).

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA749
2026-06-21 00:50:30 +03:00
vasilito 6f99194049 redbear-power: v1.24 split IO sort (IO-R, IO-W)
htop has had separate read/write sort modes since 2.0; v1.22
conflated them via io_total_kb(). v1.24 splits SortMode::Io
into three variants so operators can find read-heavy (DB
servers) vs write-heavy (log shippers) processes.

- New variants: SortMode::IoRead, SortMode::IoWrite
- Cycle updated: Rss -> Cpu -> Io -> IoRead -> IoWrite -> Pid
  -> Name -> Rss
- name() returns 'IO', 'IO-R', 'IO-W' for disambiguation
  (shown in status flash on 'o' keypress)
- Extracted sort_by_io_field() helper: shared 4-arm comparator
  for (Some, Some) descending, (Some, None) Less,
  (None, Some) Greater, (None, None) Equal. Eliminates the
  DRY violation of repeating the 4-arm match in three places.
- Sentinel semantics preserved: None still sorts below Some;
  column still renders em-dash for unreadable /proc/[pid]/io
- Column header unchanged: 'IO' column shows per-process
  total; sort direction is in the status line. Minimal change;
  adding separate R/W columns would push the panel past 100
  chars and lose comm truncation.

Test count 83 -> 87:
- sort_by_io_read_ignores_writes
- sort_by_io_write_ignores_reads
- sort_by_io_read_pushes_missing_to_bottom
- sort_by_io_write_pushes_missing_to_bottom
- io_name_is_io now also locks IO-R and IO-W strings
- sort_cycle and sort_cycle_includes_io updated for new cycle

Redox stripped binary: 4,119,400 bytes (-8 KiB from v1.23;
the helper dedup actually shrunk the binary).
Compile warnings: 55 (unchanged; all new variants are used).

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA748
2026-06-21 00:41:30 +03:00
vasilito fb146063a7 docs: update CONSOLE-TO-KDE-DESKTOP-PLAN.md to v5.6
- qtbase GLES3/KHR header fix
- KWin added to build
- KF6 packages unblocked (all 48 build)
- D-Bus daemon socket binding fixed
- Mesa virgl verified wired
2026-06-21 00:24:15 +03:00
vasilito 6dd2ddafd9 redbear-power: v1.23 IO sentinel + single-pass parse
The v1.22 audit + htop cross-reference surfaced a real defect:
on Redox, daemons whose /proc/[pid]/io is not exposed (permission
denied, proc scheme gap) silently clustered at 0 B in the IO
column, indistinguishable from genuinely idle processes. This
made SortMode::Io unreliable for finding the real IO hogs.

This release promotes the IO column to a proper sentinel model:

- io_read_kb / io_write_kb change from u64 to Option<u64>
- io_total_kb() returns Option<u64>; None when either field is None
- SortMode::Io uses 4-arm match on (a_total, b_total):
    * both Some -> descending by total
    * Some/None -> known sorts above unknown
    * None/None -> stable tie (input order)
- Render layer shows em-dash (\u2014) when total is None
- Single-pass /proc/[pid]/io parse replaces two-helper double-read
  (read_io_file returns Option<(u64, u64)> in bytes; caller /1024s
  to KiB so the None sentinel propagates end-to-end)
- #[allow(dead_code)] on ppid, vsize_kb with documented future use
  (process tree view, memory detail panel) per project warning policy

Test count 80 -> 83:
- Replaced misleading 'io_total_saturates_on_underflow' (tested
  normal sum) with 'io_total_saturates_at_u64_max' (genuine edge)
- Added 'io_total_returns_none_when_fields_missing'
- Added 'sort_by_io_pushes_missing_to_bottom'
- Added 'io_name_is_io' to lock the SortMode::Io.name() string

Compile warnings 56 -> 55 (the ppid/vsize_kb dead_code warning
is now suppressed; remaining 55 are pre-existing in other modules).

Redox stripped binary: 4,127,592 bytes (+4 KiB from v1.22).
Linux smoke test confirms em-dash renders for kscreenlocker_g,
kwin_wayland, tailscaled, polkit-kde-auth (all owned-UID procs
that the kernel hides /proc/[pid]/io from on this dev host).

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA747
2026-06-21 00:20:45 +03:00
vasilito 31e7c9d484 docs: update CONSOLE-TO-KDE-DESKTOP-PLAN.md to v5.5
- redox-drm kernel GPF fixed (IOPL acquisition)
- Qt6 Wayland null+8 crash verified already fixed
- tlc compile errors fixed
- Redox git forks research completed
2026-06-20 23:15:32 +03:00
vasilito cca510465d redbear-power: v1.22 sort by IO (per-process read+write bytes)
Process tab gains a new IO column sourced from /proc/[pid]/io
read_bytes and write_bytes, summing them as a single sortable value.

- New fields on ProcessInfo: io_read_kb, io_write_kb
- New method: ProcessInfo::io_total_kb()
- New helpers: read_io_bytes, write_io_bytes (silent on failure;
  /proc/[pid]/io may require CAP_SYS_PTRACE for owned UID)
- New SortMode::Io variant inserted into the cycle
  (Rss -> Cpu -> Io -> Pid -> Name)
- Updated render header: VIRT replaced by IO (RSS preserved)
- 4 new unit tests; total 80 pass
- Redox stripped binary: 4123496 bytes
- Linux smoke test confirms opencode dominates IO, kscreenlocker_g shows 0.0 KiB

Docs: local/docs/redbear-power-improvement-plan.md \xC2\xA746
2026-06-20 22:59:20 +03:00
vasilito d1f2e59755 redbear-power: v1.21 — SMART UI integration (Storage tab badges)
Wires the v1.20 SMART data module into the Storage tab UI.
Each disk now shows a health badge (✓ PASSED / ✗ FAILED / error).

Implementation:
- App.smart: SmartInfo field + 11-tick refresh (paired with Storage)
- Conditional refresh (if self.smart.available guard — avoids
  re-running smartctl if we already know it's missing)
- render_storage_panel: 4 SMART badge states
  1. !available → '(SMART: install smartmontools)'
  2. health.passed → ' ✓ PASSED'
  3. !health.passed → ' ✗ FAILED'
  4. health.error → ' (SMART: <error>)'

Linux host smoke test (this dev host without smartctl):
- Each disk shows '(SMART: install smartmontools)' hint
- No panic, graceful degradation
- Storage tab still works (no regression)

Performance: smartctl subprocess ~5-50ms per disk, 3 disks = 15-150ms
per 11-tick refresh (5.5 sec), well within budget.

76/76 tests pass (no new tests — UI integration only).

Cross-compile SHA256: ed804710fa834f4453a236aa034d50668b948b391ec1d2ccea294d438016d855.

Docs: improvement plan §45, CONSOLE-TO-KDE §3.3.2 v1.21,
RATATUI-APP-PATTERNS §13.14 + §14 (6400 LoC, 21 modules, 76 tests).
2026-06-20 22:50:04 +03:00
vasilito 1e86a8b0e0 docs: update CONSOLE-TO-KDE-DESKTOP-PLAN.md to v5.4
- redox-drm virtio-gpu crash fixed
- Greeter/SDDM Wayland socket timeout fixed
- ISO boots to text login prompt in QEMU
- Redox git forks research completed
2026-06-20 22:43:01 +03:00
vasilito f5311f16c8 redbear-power: v1.20 — SMART data module (graceful when smartctl missing)
Adds the smart.rs module for disk health monitoring. Since
smartctl is not installed on most systems (this dev host has it
absent), v1.20 implements the module with three-tier graceful
degradation per the zero-stub policy.

New module smart.rs (222 lines, 7 unit tests):
- SmartInfo struct with available + per-disk health records
- SmartHealth struct with passed + attributes + error
- SmartAttribute struct with id + name + value + worst + threshold + raw
- SmartInfo::smartctl_available() — checks smartctl --version
- SmartInfo::read(disks) — orchestrates per-disk smartctl -A -H
- parse_smartctl_output(text) — extracts passed/failed + attrs
- parse_attribute_line(line) — single 10-field SMART attribute
- parse_smart_value(s) — handles both hex (0x33) and decimal
- health_for(disk_name) — convenience accessor

Three-tier graceful degradation:
1. smartctl missing → available=false, disks=[]
2. smartctl errors per disk → error captured in SmartHealth
3. NVMe permission issues → error message, no fabrication

Updated main.rs: mod smart declaration.

76/76 tests pass (5 bench + 12 sensor + 13 network + 12 storage +
20 process + 7 pid_detail + 7 smart).

Linux host smoke test (this dev host without smartctl):
- available=false (graceful, no panic)
- Storage tab still works (no regression)

Cross-compile SHA256 unchanged from v1.19 (smart.rs is dead code
on Redox — compiles but never called).

Docs: improvement plan §44, CONSOLE-TO-KDE §3.3.2 v1.20,
RATATUI-APP-PATTERNS §13.14 + §14 (6360 LoC, 21 modules, 76 tests).
2026-06-20 22:39:27 +03:00
vasilito 3b251a1ea1 redbear-power: v1.19 — PID detail view (modal popup)
Closes the v1.13 §37.6 PID detail forward-work item. Press Enter
on a process row in the Process tab to open a modal popup with
detailed /proc/[pid] info.

New module pid_detail.rs (237 lines, 7 unit tests):
- read_status(pid) → ProcStatus: Name, State, Pid, PPid, Tgid,
  Threads, Uid (3-tuple), Gid (3-tuple), 12 Vm* memory fields
- read_io(pid) → ProcIo: rchar, wchar, syscr, syscw, read_bytes,
  write_bytes, cancelled_write_bytes
- read_smaps_rollup(pid) → ProcSmapsRollup: Rss, Pss, Private_Clean,
  Private_Dirty, Swapped (CAP_SYS_ADMIN gated)
- PidDetail::read(pid) — aggregator

Updated app.rs:
- pid_detail: Option<PidDetail> field
- selected_pid() method — returns PID of selected row (filter-aware)

Updated main.rs:
- Enter on Process tab → opens pid_detail for selected PID
- Enter on other tabs → toggle P-state expansion (existing behavior)
- Esc or any key while popup open → closes popup
- Popup rendered with Clear + centered Rect (70% × 80%)

Updated render.rs:
- New render_pid_detail(detail, pid) — full PID detail layout
  with [Identity] / [Memory] / [smaps_rollup] / [io] sections
- Fixed missing render_system_panel import (existing bug)

69/69 tests pass (5 bench + 12 sensor + 13 network + 12 storage +
20 process + 7 pid_detail).

Cross-compile SHA256: e34a22ed518b2e918bf8fb07eec77d8c5e2e2389a01ad00dad0d76f5c09578a4.

Docs: improvement plan §43, CONSOLE-TO-KDE §3.3.2 v1.19,
RATATUI-APP-PATTERNS §13.14 + §14 (6160 LoC, 20 modules, 69 tests).
2026-06-20 22:27:06 +03:00
vasilito 848d0fad94 redbear-power: v1.18 — Process filtering (closes v1.13 forward work)
Closes the v1.13 §37.6 forward-work item (the last one). Process
tab now supports case-insensitive substring filtering on the
process name (comm).

Implementation summary:
- New App.process_filter: String field
- Hotkey 'f' opens text-input mode (pattern reused from refresh-
  interval input):
  - chars → push to filter buffer
  - Backspace → pop
  - Enter → commit filter, flash match count
  - Esc → discard buffer + clear filter
- Filter applied in render_process_panel:
  - For each process, skip if non-empty filter doesn't match
    (case-insensitive substring on comm)
- Header line shows filter indicator + hint
- Helper proc_filter_match_count(app) for status message
- 4 new unit tests (case insensitive + substring + no match + empty)
- 62/62 tests pass

Build: clean
Cross-compile SHA256: 12913dedc9b0ea58ed3e7418527da34c903f70be703b8676e4273042c73ac875

Docs: improvement plan §42, CONSOLE-TO-KDE §3.3.2 v1.18,
RATATUI-APP-PATTERNS §13.14 + §14 (5840 LoC, 62 tests).
2026-06-20 22:11:37 +03:00
vasilito 08561033ae redbear-power: v1.17 — Sort modes in Process tab (closes v1.13 forward work)
Closes the v1.13 §37.6 forward-work item. Process tab now supports
sorting by RSS, CPU%, PID, or Name — cycle with hotkey 'o'.

Implementation summary:
- New SortMode enum: Rss (default) / Cpu / Pid / Name
- SortMode::next() cycles through all 4 modes
- SortMode::sort(&mut Vec<ProcessInfo>) reorders in place
- ProcInfo::read_sorted(sort_mode) — read with custom sort
- ProcInfo::read_with_cpu_pct_sorted(prev, dt, num_cpus, sort_mode)
  — re-sorts at end because CPU% may change rank
- App.process_sort: SortMode field
- 13-tick refresh uses sorted variant
- Hotkey 'o' cycles sort mode (with status flash)
- Header line shows 'sort: <mode> (press o to cycle)'
- 6 new unit tests (default + cycle + 4 sort modes)

Restored v1.16 changes (prior session left them partial):
- NetInfo::rx_kbps + tx_kbps fields + init
- NetInfo::read_with_throughput(prev, dt_secs)
- App::prev_net field
- 7-tick refresh uses read_with_throughput
- render_network_panel RX/TX lines show '{X} KiB/s'
- 3 network throughput unit tests

58/58 tests pass (5 bench + 12 sensor + 10 network + 12 storage + 19 process).
Cross-compile SHA256: 5d01429b91b5c8399f6772251fd28a44a083cc53f13f2b9dff6f92245787c393.

Docs: improvement plan §41, CONSOLE-TO-KDE §3.3.2 v1.17,
RATATUI-APP-PATTERNS §13.14 + §14 (5800 LoC, 58 tests).
2026-06-20 22:00:05 +03:00
vasilito d209b64ce9 redbear-power: v1.16 — Network throughput (closes v1.11 forward work)
Closes the v1.11 §35.7 forward-work item. Network tab now shows
real-time R/W throughput (KiB/s) per interface, computed from delta
of rx_bytes/tx_bytes between successive 7th-tick refreshes.

Source code already landed (network.rs + app.rs + render.rs).
This commit captures full v1.16 docs:

- Improvement plan §40 (Network Throughput)
- CONSOLE-TO-KDE §3.3.2 v1.16
- RATATUI-APP-PATTERNS §13.14 (audit table +16) + §14 (5755 LoC, 52 tests)

Implementation summary:
- New rx_kbps: f64 + tx_kbps: f64 fields on NetInterface
- New NetInfo::read_with_throughput(prev, dt_secs)
- Wall-clock dt (shared prev_refresh_secs with v1.14 + v1.15)
- saturating_sub on bytes prevents underflow
- 3 new unit tests (formula + underflow + zero dt)
- 52/52 total tests pass

Math sanity check (verified by unit test):
prev=1MB, now=5MB, dt=2sec → 1953.125 KiB/s
prev > now → saturating_sub → 0

Cross-compile SHA256: 053f1a0cca5185637d0316d56f5cf5832cf2e754b689bc24edf16ea5d0404fa2.
2026-06-20 21:41:07 +03:00
vasilito 6729409b4d redbear-power: v1.14 + v1.15 — CPU% + disk throughput + restoration
This commit restores and completes v1.14 (CPU% in Process tab) and
v1.15 (disk throughput in Storage tab). Previous sessions landed
partial work (cpu_pct field on ProcessInfo, read_kbps/write_kbps on
DiskStats) but never wired them up. This commit:

v1.14 — Process CPU% (Process tab):
- ProcInfo::read_with_cpu_pct(prev, dt_secs, num_cpus)
- App::prev_processes + prev_refresh_secs fields
- 13-tick refresh now uses read_with_cpu_pct with wall-clock dt
- 3 new unit tests (formula + zero + underflow)

v1.15 — Disk throughput (Storage tab):
- StorageInfo::read_with_throughput(prev, dt_secs)
- App::prev_storage field
- 11-tick refresh now uses read_with_throughput
- 3 new unit tests (formula + underflow + zero dt)

Updated render.rs:
- Process panel column header: PID STATE PRIO NI THR CPU% RSS VIRT COMM
- Storage panel Read/Written lines show 'X I/Os, Y KiB/s'

Tests: 49/49 pass (5 bench + 12 sensor + 7 network + 12 storage +
13 process).

Cross-compile SHA256: d1207b648ce89e19f8dd040f234648e1665f053ec31f8511ea187627d79bde2d.

Math sanity checks (verified by unit tests):
CPU%: delta=130 ticks, dt=2sec, num_cpus=4 → 1625.0%
Disk: prev=1MB, now=5MB, dt=2sec → 1953.125 KiB/s

Docs: improvement plan §38 (CPU%) + §39 (disk throughput),
CONSOLE-TO-KDE §3.3.2 v1.14 + v1.15, RATATUI-APP-PATTERNS §13.14 +
§14 (5720 LoC, 49 tests).
2026-06-20 21:30:39 +03:00
vasilito 9fa019e78a redbear-power: v1.14 — CPU% in Process tab (closes v1.13 forward work)
Closes the v1.13 §37.6 forward-work item. Process tab now shows
real-time CPU usage per process, computed from the delta of
total CPU ticks between successive 13th-tick refreshes.

Source code already landed (process.rs + app.rs + render.rs).
This commit captures full v1.14 docs:

- Improvement plan §38 (CPU% in Process Tab)
- CONSOLE-TO-KDE §3.3.2 v1.14
- RATATUI-APP-PATTERNS §13.14 (audit table +14) + §14 (19 modules, 47 tests)

Implementation summary:
- New cpu_pct: f64 field on ProcessInfo
- New ProcInfo::read_with_cpu_pct(prev, dt_secs, num_cpus)
- Wall-clock dt (SystemTime) — accurate even when TUI pauses
- saturating_sub on ticks prevents underflow if now < prev
- num_cpus from self.cpus.len() (Per-CPU detection result)
- 4 new unit tests (formula + zero + underflow + dt=0)
- 47/47 total tests pass

Math sanity check (verified by unit test):
utime=100→200, stime=50→80, dt=2sec, num_cpus=4
delta = 280-150 = 130 ticks / 2 sec = 65 ticks/sec
CPU% = 65 / 4 cpus * 100 = 1625.0%

Cross-compile SHA256: d46cd66b8e158e2327839ef502879951877a5500d4a40807d3dbc72ed7397231.
2026-06-20 20:56:54 +03:00
vasilito 1dcdc5d39d redbear-power: v1.13 — Process tab (procfs)
Adds the 9th tab in the multi-view system: Process, reading
process state and memory from /proc/[pid]/stat on Linux hosts.
Last major top-like view, complementing hardware tabs
(Storage/Network/Sensors) with software state.

New module process.rs (215 lines, 9 unit tests):
- ProcessInfo: pid, comm, state, ppid, utime, stime, priority,
  nice, num_threads, vsize_kb, rss_kb
- parse_stat_line() handles (comm) with spaces like (Web Content)
  via last-')' extraction (per man 5 proc format)
- Field indices: state=0, ppid=1, utime=11, stime=12,
  priority=15, nice=16, num_threads=17, vsize=20, rss=21
- read_comm() fallback for parens-parsing failures
- ProcInfo::read() scans /proc, sorts by RSS desc, truncates to 50
- format_memory_kb() with binary unit suffix

Updated app.rs:
- New field processes: ProcInfo, refreshed every 13th tick
  (6.5 sec). 13-tick modulus coprime with all (3,4,5,7,11).
- TabId::Process variant (9th tab)
- TabId::next() cycles PerCpu → System → Info → Motherboard →
  Battery → Sensors → Network → Storage → Process → PerCpu

Updated render.rs:
- New render_process_panel() with PID/STATE/PRIO/NI/THR/RSS/VIRT/COMM
  columns. Comm truncated to 20 chars. Sort by RSS desc (top-like).
- render_tab_bar() for 9 tabs with hotkey 1-9
- render_once dumps Process panel for headless verification

Updated main.rs:
- mod process; declaration
- New dispatch arm TabId::Process => render_process_panel
- Hotkey 9 jumps to Process tab
- render_process_panel added to imports

Linux host smoke test (596 processes, top 50):
- opencode 3.7 GiB, thunderbird 2.1 GiB, plasmashell 517 MiB
- kwin_wayland shows PRIO=-2 (real-time scheduling)
- Total RSS: 17.5 GiB

Unit tests: 43/43 pass (5 bench + 12 sensor + 7 network + 10 storage +
9 process).
Cross-compile SHA256: 2c30f86dce574f173efdcf8eb588f83abd8f0bdf2c5a2678452dd0e6a244dbf2.

Docs: improvement plan §37, CONSOLE-TO-KDE §3.3.2 v1.13,
RATATUI-APP-PATTERNS §13.14 + §14 (19 modules, 43 tests).
2026-06-20 20:41:44 +03:00
vasilito 8935be79eb tlc: PLAN.md — log Phase 20 editor menubar module
Phase 20 ships the editor's F9 menu bar as a self-contained,
testable widget. Mirrors Midnight Commander's
src/editor/editmenu.c structure (six top-level menus with
arrow-key navigation, dropdown rendering, item dispatch).

Components:
  src/editor/menubar.rs    — EditorMenuBar + EditorCmd + render()
  src/editor/mod.rs        — pub mod menubar declaration

Tests: 10 unit tests in editor::menubar cover menu navigation
(arrows, wrapping, separators), Esc/F9 close, Enter dispatch,
letter hotkey menu selection by title, and render smoke test.

Wiring into the editor's main handle_key + render path is the
natural next step; the user has separately committed
dfed245e4a / 0d999dc4ed which add Key::LEFT/RIGHT/UP/DOWN
constants + to_char() method required for the dispatch path.

PLAN.md header bumped to Phase 20 complete.
2026-06-20 20:03:43 +03:00
vasilito 933336180f docs: ratatui §13.14 + §14 — bump to v1.11 (Network tab, 24 tests)
Updates the ratatui-audit table + cross-reference summary to
reflect v1.11:

  §13.14 audit table:
    - v1.11 entry: 'No Network tab' → 'Implemented in v1.11'
    - LoC count: ~4400 → ~5150 across 17 modules, 17 → 24 unit tests
    - Module count: 15 → 17

  §14 cross-reference:
    - '~4900 LoC across 16 modules, with 17 unit tests'
      → '~5150 LoC across 17 modules, with 24 unit tests'
    - 'sysfs/MSR + meminfo + DMI + battery + hwmon'
      → 'sysfs/MSR + meminfo + DMI + battery + hwmon + net'
    - 'AMD CPU fallback' → 'AMD CPU + net/sysfs fallback'
    - '17 unit tests' → '24 unit tests (bench + sensor + network)'

Source code (network.rs + main.rs + render.rs) and full §35 +
v1.11 plan/consolehdk doc already landed in commit dfed245e4a
(tlc bundled). This commit catches up the ratatui cross-reference
doc that didn't fit in that bundle.
2026-06-20 19:41:59 +03:00
vasilito f9df87d56b tlc: guard install loop with file-existence check to skip missing binaries 2026-06-20 19:38:27 +03:00
vasilito ea854a71d9 redbear-power: v1.10 — Per-CPU Pkg temp from hwmon (k10temp fallback)
Closes the v1.9 forward-work item (§33.7). Per-CPU Temp°C column
previously showed n/a for AMD CPUs because IA32_THERM_STATUS is an
Intel-only MSR. v1.10 falls back to hwmon when MSR unavailable.

New helper SensorInfo::pkg_temp_c(cpu_index) in sensor.rs:
- Recognizes k10temp Tctl (AMD Zen / Zen 2 / Zen 3 / Zen 4 / Zen 5)
- Recognizes coretemp 'Package id 0' (Intel, forward-compat)
- Recognizes zenpower Tdie (AMD alt driver)
- Returns None if no recognized CPU temp chip
- cpu_index reserved for future multi-socket support

Updated App::refresh() — per-CPU loop:
- If MSR fails (Intel-only path), call self.sensors.pkg_temp_c(row.id)
- PROCHOT/Critical/PowerLimit flags set to false in fallback path
  (k10temp doesn't expose these — honest empty-state pattern,
  don't fake flag values that the source can't provide)

Linux host smoke test (AMD Ryzen 9 7900X):
- Before: every CCD row showed n/a for Temp°C
- After: every CCD row shows 85 (k10temp Tctl value, °C)

5 new unit tests:
- pkg_temp_c_from_k10temp_tctl (AMD Zen)
- pkg_temp_c_from_coretemp_package_id_0 (Intel)
- pkg_temp_c_from_zenpower_tdie (AMD alt)
- pkg_temp_c_returns_none_when_no_chip (Redox)
- pkg_temp_c_ignores_unrelated_chips (nvme Composite != CPU temp)

Total: 17/17 tests pass (5 bench + 12 sensor).

Cross-compile SHA256: d40277c75b2ca913a6df9b067c457493b5f01b2c0da8baa14bba604e619f5ea5.

Docs: improvement plan §34, CONSOLE-TO-KDE §3.3.2 v1.10,
RATATUI-APP-PATTERNS §13.14 + §14 (17 tests, 4945 LoC).
2026-06-20 18:59:27 +03:00
vasilito 69e6f2a84d redbear-power: v1.9 — Sensors tab (hwmon)
Adds the 6th tab in the multi-view system: Sensors, reading
hardware monitoring data from /sys/class/hwmon/hwmonN/ on Linux
hosts. Detects all chips (k10temp, coretemp, nvme, mt7921, r8169,
spd5118, zenpower, etc.) and their temp/fan/voltage/power/current
sensors with proper unit conversions.

New module sensor.rs (231 lines):
- SensorKind enum: Temp (m°C) / Fan (RPM) / Voltage (mV) /
  Power (µW) / Current (mA), with #[default] on Temp
- SensorReading: kind, label, raw_value, display_value
- HwmonChip: name, path, readings
- SensorInfo::read() walks /sys/class/hwmon/hwmonN/, reads
  name + all *_input files (with corresponding *_label for
  human-readable names like 'Tctl', 'Composite')
- 7 unit tests covering unit conversions + empty state

Updated app.rs:
- New field sensors: SensorInfo, refreshed every 3rd tick
  (1.5 sec at POLL_MS=500). 3-tick modulus is coprime to
  meminfo's 4 and battery's 5 — no thundering-herd syscalls.
- TabId::Sensors variant (6th tab)
- TabId::next() cycles PerCpu → System → Info → Motherboard →
  Battery → Sensors → PerCpu

Updated render.rs:
- New render_sensor_panel(app, focused) with per-chip sections
  using ▸ arrow + chip name as bold header, then Label/Value pairs
  in 12-char left-aligned label / 14-char right-aligned value
  layout. Empty state: '(no sensors detected — /sys/class/hwmon/
  not readable)' rather than wall of ?.
- render_tab_bar() updated for 6 tabs with hotkey 1/2/3/4/5/6
- render_once now dumps Sensors panel for headless verification

Updated main.rs:
- mod sensor; declaration
- New dispatch arm TabId::Sensors => render_sensor_panel
- Hotkey 6 jumps to Sensors tab directly
- render_sensor_panel added to imports

Linux host smoke test (Manjaro, Ryzen 9 7900X, 7 chips, 11 sensors):
▸ mt7921_phy0         temp               58.0 °C
▸ r8169_0_e00:00      temp               51.0 °C
▸ k10temp             Tccd1              82.6 °C
                      Tccd2              57.1 °C
                      Tctl               85.6 °C
▸ nvme                Sensor 2           53.9 °C
                      Composite          50.9 °C
                      Sensor 1           50.9 °C
▸ spd5118             temp               50.0 °C
▸ spd5118             temp               51.5 °C
▸ nvme                Composite          48.9 °C

Unit conversions verified: m°C → °C (50850 → 50.9°C), mV → V,
µW → W, mA → A. Unit tests: 12/12 pass (5 bench + 7 sensor).

Source state: 4885 LoC across 16 modules.
Redox stripped: 3.8 MB (SHA256 7a7c31bc...).

Docs: improvement plan §33, CONSOLE-TO-KDE §3.3.2 v1.9,
RATATUI-APP-PATTERNS §13.14 + §14 (16 modules, 12 tests).
2026-06-20 18:46:30 +03:00
vasilito 32fac97c3f docs: ratatui §14 cleanup — collapse duplicated §14 headers + add v1.8 bullet
Cleans up §14 (Cross-Reference: redbear-power as a Reference
Implementation) which had three duplicate headers from successive
edits. Collapses to a single canonical version and adds the
v1.8-specific bullet:

  'Testable — bench module has 5 unit tests covering all stress
   modes + toggles'

Net change: -25 lines, +2 lines.

Source code for v1.8 (bench.rs + main.rs + render.rs) and full
docs for §32 + v1.8 in improvement plan + CONSOLE-TO-KDE plan
landed in commit d6ac3d1377 (qtbase bundled). This commit
completes the doc-only cleanup that didn't fit in that bundle.
2026-06-20 18:22:58 +03:00
vasilito d6ac3d1377 qtbase: add PKG_CONFIG_EXECUTABLE for cross-compilation CMake configure 2026-06-20 18:19:20 +03:00