Skip to content

keep track of nix tasks in status bar#416

Draft
mrshmllow wants to merge 15 commits intotrunkfrom
push-lszyzzpnqukm
Draft

keep track of nix tasks in status bar#416
mrshmllow wants to merge 15 commits intotrunkfrom
push-lszyzzpnqukm

Conversation

@mrshmllow
Copy link
Copy Markdown
Member

@mrshmllow mrshmllow commented Mar 26, 2026

Closes #405

  • limit nodes to 10~ on screen at once
  • Somehow test this

Summary by CodeRabbit

Release Notes

  • New Features

    • Status bar now displays nix-related statuses for builds, downloads, and uploads similar to nix-output-monitor
  • UI/UX

    • Simplified step display labels throughout deployment process
    • Enhanced status display with improved per-node activity tracking

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d64089a6-3e60-4277-a3cd-ae0ca5cdd96f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch push-lszyzzpnqukm

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 and usage tips.

@github-actions github-actions bot added rust Pull requests that update rust code release PRs against main labels Mar 26, 2026
@mrshmllow mrshmllow changed the title keep tack of nix tasks in status bar keep track of nix tasks in status bar Mar 26, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
crates/core/src/commands/mod.rs (1)

194-225: Activity lifecycle events look correct, but consider tracking Result data.

The LogMessage::Start and LogMessage::Stop handling correctly emits UI activity events. However, LogMessage::Result at line 224 is silently ignored.

In Nix's internal-json log format, Result messages carry completion status/data for activities. If you want to display download progress, build success/failure, or similar metrics in the status bar, you may need to:

  1. Track pending activities by id
  2. Update activity state when Result is received
  3. Send the accumulated result with ActivityEnd

If this is intentional (e.g., you only need start/stop signals for now), consider adding a brief comment explaining why Result is ignored.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/core/src/commands/mod.rs` around lines 194 - 225, LogMessage::Result
is currently swallowed; update the handler so results for activities are
captured and forwarded instead of ignored: maintain a map of pending activities
keyed by id (created in the LogMessage::Start branch where UI_SENDER sends
ActivityBegin for node task_name via create_activity_category), update that map
when LogMessage::Result arrives (using the same id) and send a
UiMessage::ActivityEnd (as in the LogMessage::Stop branch) including the
accumulated result data, then remove the id from the map; if you intentionally
want to ignore results, add a short comment on LogMessage::Result explaining
why.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/core/src/status.rs`:
- Around line 262-263: The status rendering currently returns early if
self.node_statuses.is_empty() and later ignores the nix_activities entry keyed
by None (and explicitly drops None), which hides ActivityBegin events with node:
None or activities recorded before a node row exists; update the rendering logic
to not return early when node_statuses is empty, include the global/unattributed
bucket by preserving and iterating the nix_activities entry for the None key (do
not remove it at lines that drop None), and render a global row for
nix_activities.get(&None) alongside per-node rows so ActivityBegin { node: None,
.. } events and pre-node activities are shown; adjust any loops that currently
only iterate over node_statuses (e.g., where rows are built at lines 281-289) to
also handle the None key and ensure the global bucket is formatted like other
node rows.
- Around line 406-416: The clear() method currently only clears based on the
saved logical newline count (previous_number_of_lines) and does not reset that
counter or account for soft-wrapped rows, so wrapped output can be left behind
or higher output erased; update clear() to reset previous_number_of_lines to 0
after wiping the screen and change the logic that computes
previous_number_of_lines (the code path that sets previous_number_of_lines when
rendering status lines and on UiMessage::Clear) to measure rendered terminal
rows (e.g., compute line wraps by clamping to the terminal width or using a
function that computes displayed rows per string) rather than raw .lines() count
so clearing and subsequent refreshes use the actual number of terminal rows.

---

Nitpick comments:
In `@crates/core/src/commands/mod.rs`:
- Around line 194-225: LogMessage::Result is currently swallowed; update the
handler so results for activities are captured and forwarded instead of ignored:
maintain a map of pending activities keyed by id (created in the
LogMessage::Start branch where UI_SENDER sends ActivityBegin for node task_name
via create_activity_category), update that map when LogMessage::Result arrives
(using the same id) and send a UiMessage::ActivityEnd (as in the
LogMessage::Stop branch) including the accumulated result data, then remove the
id from the map; if you intentionally want to ignore results, add a short
comment on LogMessage::Result explaining why.
🪄 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: 21f46ab9-3095-4143-9ca1-58364fbee7ff

📥 Commits

Reviewing files that changed from the base of the PR and between 16bf259 and 308ab9b.

📒 Files selected for processing (17)
  • CHANGELOG.md
  • crates/cli/src/cli.rs
  • crates/cli/src/main.rs
  • crates/core/src/commands/common.rs
  • crates/core/src/commands/mod.rs
  • crates/core/src/commands/noninteractive.rs
  • crates/core/src/commands/pty/mod.rs
  • crates/core/src/commands/pty/output.rs
  • crates/core/src/hive/executor.rs
  • crates/core/src/hive/mod.rs
  • 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 on lines +262 to 263
if self.node_statuses.is_empty() {
return String::new();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Render the unattributed/global activity bucket.

Line 262 returns early when there are no node_statuses, Line 281 only renders rows that come from node_statuses, and Lines 374-376 explicitly drop the None key from nix_activities. Any ActivityBegin { node: None, .. } event—or any activity recorded before its node row exists—will be tracked but never shown, so the status bar underreports real Nix work.

Also applies to: 281-289, 374-376

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/core/src/status.rs` around lines 262 - 263, The status rendering
currently returns early if self.node_statuses.is_empty() and later ignores the
nix_activities entry keyed by None (and explicitly drops None), which hides
ActivityBegin events with node: None or activities recorded before a node row
exists; update the rendering logic to not return early when node_statuses is
empty, include the global/unattributed bucket by preserving and iterating the
nix_activities entry for the None key (do not remove it at lines that drop
None), and render a global row for nix_activities.get(&None) alongside per-node
rows so ActivityBegin { node: None, .. } events and pre-node activities are
shown; adjust any loops that currently only iterate over node_statuses (e.g.,
where rows are built at lines 281-289) to also handle the None key and ensure
the global bucket is formatted like other node rows.

Comment on lines 406 to +416
pub fn clear<T: std::io::Write>(&self, writer: &mut T) {
if !self.show_progress {
return;
}

let _ = write!(writer, "{}", cursor::Save);
// let _ = write!(writer, "{}", cursor::Down(1));
let _ = write!(writer, "{}", cursor::Left(999));
let _ = write!(writer, "{}", clear::CurrentLine);
for _ in 0..self.previous_number_of_lines {
let _ = write!(writer, "\r{}{}", clear::CurrentLine, cursor::Up(1));
}

let _ = write!(writer, "\r{}", clear::CurrentLine);
let _ = writer.flush();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Track rendered screen rows, not just logical lines().

Lines 411-415 clear only the newline count saved at Line 439, and clear() leaves that count intact after the wipe. After UiMessage::Clear, or whenever one of these longer rows soft-wraps in a narrow terminal, the next refresh can either erase output above the status block or leave wrapped fragments behind. Please reset the counter after clearing and base it on rendered terminal rows (or clamp the rendered width before writing).

Also applies to: 428-439

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/core/src/status.rs` around lines 406 - 416, The clear() method
currently only clears based on the saved logical newline count
(previous_number_of_lines) and does not reset that counter or account for
soft-wrapped rows, so wrapped output can be left behind or higher output erased;
update clear() to reset previous_number_of_lines to 0 after wiping the screen
and change the logic that computes previous_number_of_lines (the code path that
sets previous_number_of_lines when rendering status lines and on
UiMessage::Clear) to measure rendered terminal rows (e.g., compute line wraps by
clamping to the terminal width or using a function that computes displayed rows
per string) rather than raw .lines() count so clearing and subsequent refreshes
use the actual number of terminal rows.

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.

Status bar show progress of derivation / nix jobs

1 participant