Skip to content

display node names and status in statusbar#537

Merged
mrshmllow merged 1 commit into
trunkfrom
marshmallow/p-umntskznkmok
Jul 6, 2026
Merged

display node names and status in statusbar#537
mrshmllow merged 1 commit into
trunkfrom
marshmallow/p-umntskznkmok

Conversation

@mrshmllow

@mrshmllow mrshmllow commented Jul 6, 2026

Copy link
Copy Markdown
Member

A cut down version of #416 that is far smaller and easier to maintain. Full nix job tracking can come at a later date

Summary by CodeRabbit

  • Bug Fixes
    • Improved terminal status updates so node progress now refreshes cleanly without leaving stale lines behind.
    • Status output is now easier to scan, with clearer ordering and better handling when many nodes are shown.
    • Shortened several step labels for more concise, readable progress messages.

@github-actions github-actions Bot added rust Pull requests that update rust code release PRs against main labels Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mrshmllow, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5ced586d-43d9-4669-96c2-08b9e8acbebf

📥 Commits

Reviewing files that changed from the base of the PR and between 3c397a1 and 405faef.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • crates/core/src/hive/steps/activate.rs
  • crates/core/src/hive/steps/build.rs
  • crates/core/src/hive/steps/evaluate.rs
  • crates/core/src/hive/steps/keys.rs
  • crates/core/src/hive/steps/ping.rs
  • crates/core/src/hive/steps/push.rs
  • crates/core/src/status.rs
📝 Walkthrough

Walkthrough

This PR shortens Display output strings for several hive step types (SwitchToConfiguration, Build, Evaluate, PushKeyAgent, Ping, PushEvaluatedOutput, PushBuildOutput) and reworks status.rs: NodeStatus gains ordering derives with reordered variants, Status.statuses is keyed by Name, and status rendering/clearing logic is rebuilt to sort, truncate, cap, and precisely clear multi-line terminal output.

Changes

Status and step display changes

Layer / File(s) Summary
Shortened step Display strings
crates/core/src/hive/steps/activate.rs, build.rs, evaluate.rs, keys.rs, ping.rs, push.rs
Display implementations for step types emit shorter text (e.g., "Build" instead of "Build the node").
NodeStatus ordering and Name-keyed storage
crates/core/src/status.rs
NodeStatus derives PartialOrd/Ord with reordered variants (Failed highest priority, Succeeded lowest); Status.statuses changes from HashMap<String, NodeStatus> to HashMap<Name, NodeStatus>; previous_number_lines field added; status_tick_worker updated to use Name keys.
Multi-line status message rendering
crates/core/src/status.rs
get_msg filters out succeeded nodes, truncates names, sorts by status priority then name, caps lines to terminal height, renders colored status labels, and shows "... and N more" when capped, using new strip_str/termion imports.
Terminal clear and write updates
crates/core/src/status.rs
clear moves the cursor up by previous_number_lines before clearing; wipe_out delegates to clear; write_status flushes and updates previous_number_lines based on rendered line count.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Worker as status_tick_worker
  participant Status as Status
  participant Terminal as Terminal Writer

  Worker->>Status: UiMessage::SetStatus (Name, NodeStatus)
  Status->>Status: insert into statuses map (keyed by Name)
  Worker->>Status: write_status(writer)
  Status->>Status: clear(writer) using previous_number_lines
  Status->>Status: get_msg() - filter, sort, cap, truncate
  Status->>Terminal: write rendered multi-line message
  Status->>Status: update previous_number_lines
Loading

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: showing node names and status in the statusbar.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch marshmallow/p-umntskznkmok

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/core/src/status.rs`:
- Around line 183-184: The trailing `padding` computation in `status.rs` is dead
because `strip_str(&line)` already makes the subtraction clamp to zero, so the
`write!` call in the status rendering path adds no real alignment. Remove the
unused padding logic from the code that builds `msg` (and drop the `strip_str`
import if nothing else uses it), or adjust the width calculation so it reflects
the intended remaining space after the name/status text. Use the existing status
formatting flow around `line`, `max_name_len`, and the final `write!` call to
keep the output unchanged except for eliminating the redundant work.
- Around line 218-228: `write_status` is tracking logical newline count instead
of the number of rendered terminal rows, which breaks `clear()` on wrapped
status text. Update `Status::write_status` so `previous_number_lines` reflects
physical rows based on terminal width (or ensure the status message always fits
on one visual row), and keep the clearing logic in sync with that row count.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6019689a-1a3f-40b5-8d5c-e335dd8ff824

📥 Commits

Reviewing files that changed from the base of the PR and between 9507e96 and 3c397a1.

📒 Files selected for processing (7)
  • crates/core/src/hive/steps/activate.rs
  • crates/core/src/hive/steps/build.rs
  • crates/core/src/hive/steps/evaluate.rs
  • crates/core/src/hive/steps/keys.rs
  • crates/core/src/hive/steps/ping.rs
  • crates/core/src/hive/steps/push.rs
  • crates/core/src/status.rs

Comment thread crates/core/src/status.rs Outdated
Comment on lines +183 to +184
let padding = " ".repeat(max_name_len.saturating_sub(strip_str(&line).len()));
let _ = write!(&mut msg, "{line}{padding}");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

padding here is always empty — dead computation.

strip_str(&line) returns the whole visible line (name + spacing + status label, including the leading \n), which is always longer than max_name_len, so max_name_len.saturating_sub(...) is 0 and padding is always "". Column alignment is already handled by the space run at Line 171, so this trailing padding does nothing. Drop it (and the strip_str import if unused elsewhere) or fix it to compute the intended remaining width.

♻️ Proposed cleanup
-            let padding = " ".repeat(max_name_len.saturating_sub(strip_str(&line).len()));
-            let _ = write!(&mut msg, "{line}{padding}");
+            let _ = write!(&mut msg, "{line}");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let padding = " ".repeat(max_name_len.saturating_sub(strip_str(&line).len()));
let _ = write!(&mut msg, "{line}{padding}");
let _ = write!(&mut msg, "{line}");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/core/src/status.rs` around lines 183 - 184, The trailing `padding`
computation in `status.rs` is dead because `strip_str(&line)` already makes the
subtraction clamp to zero, so the `write!` call in the status rendering path
adds no real alignment. Remove the unused padding logic from the code that
builds `msg` (and drop the `strip_str` import if nothing else uses it), or
adjust the width calculation so it reflects the intended remaining space after
the name/status text. Use the existing status formatting flow around `line`,
`max_name_len`, and the final `write!` call to keep the output unchanged except
for eliminating the redundant work.

Comment thread crates/core/src/status.rs
Comment on lines 218 to +228
pub fn write_status<T: std::io::Write>(&mut self, writer: &mut T) {
if self.show_progress {
let _ = write!(writer, "{}", self.get_msg());
if !self.show_progress {
return;
}

let msg = self.get_msg();

let _ = write!(writer, "{msg}");
let _ = writer.flush();

self.previous_number_lines = msg.lines().count().saturating_sub(1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the file structure first
ast-grep outline crates/core/src/status.rs --view expanded

# Show the relevant section with line numbers
sed -n '1,320p' crates/core/src/status.rs | cat -n

# Search for cursor movement / clearing logic and terminal width usage
rg -n "cursor::Up|previous_number_lines|terminal width|width|wrap|truncate|clear" crates/core/src/status.rs crates/core/src -S

# Lightweight behavioral probe: inspect whether rendered status text is width-bounded
python3 - <<'PY'
from pathlib import Path
p = Path("crates/core/src/status.rs")
text = p.read_text()

# Print the specific functions around write_status and clear if present
for name in ["write_status", "clear", "get_msg"]:
    idx = text.find(f"fn {name}")
    if idx != -1:
        start = max(0, text.rfind("\n", 0, idx-1)-1)
        end = min(len(text), text.find("\n    pub fn ", idx+1) if text.find("\n    pub fn ", idx+1) != -1 else len(text))
        print(f"\n--- {name} ---")
        print(text[idx:end])
PY

Repository: forallsys/wire

Length of output: 28968


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look for any width-aware cursor clearing or wrapping logic elsewhere
rg -n "terminal_size\(|cursor::Up\(|clear::CurrentLine|strip_str\(|wrap|truncate|width" crates/core/src -S

# Estimate the maximum visible length of the summary line and a typical status line from the code.
python3 - <<'PY'
from pathlib import Path
import re

text = Path("crates/core/src/status.rs").read_text()

# Extract the get_msg function body roughly
m = re.search(r'pub fn get_msg\(&self\) -> String \{([\s\S]*?)^\s*\}\s*$', text, re.M)
body = m.group(1) if m else text

# Visible summary skeleton examples based on the code
examples = [
    "[0 / 0] 0s",
    "[123 / 456] (12 Failed, 34 Deploying) 999s",
    "[123 / 456] (12 Failed) 999s",
    "[123 / 456] (34 Deploying) 999s",
]
for s in examples:
    print(len(s), s)
PY

Repository: forallsys/wire

Length of output: 6310


Track rendered rows, not msg.lines()
previous_number_lines only counts logical \ns, but clear() moves up one physical row per count. Any wrapped status line will leave stale rows behind on narrow terminals. Count rendered rows with the terminal width, or keep each status line to a single visual row.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/core/src/status.rs` around lines 218 - 228, `write_status` is tracking
logical newline count instead of the number of rendered terminal rows, which
breaks `clear()` on wrapped status text. Update `Status::write_status` so
`previous_number_lines` reflects physical rows based on terminal width (or
ensure the status message always fits on one visual row), and keep the clearing
logic in sync with that row count.

@mrshmllow mrshmllow changed the title display names in statusbar display node names and status in statusbar Jul 6, 2026
@mrshmllow
mrshmllow force-pushed the marshmallow/p-umntskznkmok branch from 3c397a1 to 405faef Compare July 6, 2026 11:43
@mrshmllow
mrshmllow merged commit 7fd1e92 into trunk Jul 6, 2026
8 checks passed
@mrshmllow
mrshmllow deleted the marshmallow/p-umntskznkmok branch July 6, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release PRs against main rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant