Skip to content

feat(cardwire-gui): add a log page - #159

Merged
luytan merged 4 commits into
mainfrom
cardwire-gui-log
Aug 7, 2026
Merged

feat(cardwire-gui): add a log page#159
luytan merged 4 commits into
mainfrom
cardwire-gui-log

Conversation

@luytan

@luytan luytan commented Aug 7, 2026

Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and if applicable, a related issue.

If this PR introduce a new feature, explain your motivations

Fixes # (issue)

TODO

  • Copy-Paste this line

Checklist:

  • My code follows the style guidelines of this project (cargo fmt)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the mdBook documentation
  • My changes generate no new warnings (clippy/clang)
  • New and existing unit tests pass locally with my changes (either use nix flake check or wait for the ci)

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f6fe142c-dc0a-4106-9e18-9f17b74bd27a

📥 Commits

Reviewing files that changed from the base of the PR and between 879d1a9 and cf985dd.

📒 Files selected for processing (2)
  • crates/cardwire-gui/src/models.rs
  • crates/cardwire-gui/src/subscription.rs

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added a Logs page displaying blocked-process activity, timestamps, application names, process IDs, and GPU details.
    • Logs now load existing entries, update in real time, and retain up to 500 entries.
    • Added an empty state and scrollable log display for easier monitoring.
    • Improved GPU controls in manual mode with availability-based Block and Unblock actions.

Walkthrough

The GUI now receives blocked-process logs through D-Bus, stores up to 500 entries, and displays them on the Logs page. GPU controls now apply to available non-default GPUs in manual mode.

Changes

GUI log integration

Layer / File(s) Summary
Log contracts and bounded state
Cargo.toml, crates/cardwire-gui/Cargo.toml, crates/cardwire-gui/src/models.rs, crates/cardwire-gui/src/message.rs, crates/cardwire-gui/src/app.rs
The GUI adds chrono, LogEntry, LogState, and log-related Message variants. LogState replaces logs and retains at most 500 entries. AppState initializes and stores the log state.
D-Bus log ingestion
crates/cardwire-gui/src/subscription.rs, crates/cardwire-gui/src/app.rs
The logger subscription fetches initial logs and listens for new log signals. The application replaces or appends log state and reports errors.
Log rendering and GPU controls
crates/cardwire-gui/src/ui.rs, crates/cardwire-gui/src/app.rs
The Logs page renders counts, empty state, timestamps, applications, PIDs, and GPU names. GPU actions apply to available non-default GPUs in manual mode.

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

Sequence Diagram(s)

sequenceDiagram
  participant logger_sub
  participant CardwireLogger
  participant AppState
  participant LogsPage

  logger_sub->>CardwireLogger: Fetch blocked-process logs
  CardwireLogger-->>logger_sub: Initial LogEntry queue
  logger_sub->>AppState: FetchedLogs
  CardwireLogger-->>logger_sub: Log-change signal
  logger_sub->>AppState: NewLog(LogEntry)
  AppState->>LogsPage: Render LogState and GPU list
Loading

Possibly related PRs

Suggested reviewers: juandelpueblo

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description retains the template text and does not provide a change summary, motivation, issue, or completed checklist items. Replace the template text with a summary, motivation, issue reference, and the completed checklist results.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding a log page to the Cardwire GUI.
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.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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/cardwire-gui/src/models.rs`:
- Around line 96-99: Update LogState::replace to enforce MAX_GUI_LOG_ENTRIES
before assigning the incoming queue: remove the oldest entries until the queue
is within the limit, then store the trimmed queue in self.logs.

In `@crates/cardwire-gui/src/subscription.rs`:
- Around line 563-575: The subscription flow around proxy.process_blocked() and
proxy.receive_process_blocked_changed() can lose events between the snapshot and
signal registration. Replace this sequence with an atomic daemon
snapshot-and-subscribe operation; alternatively, subscribe first with ordered
event identifiers, then obtain and reconcile a snapshot so every blocked-process
event reaches LogState.
- Around line 591-595: Update the logger subscription stream-termination
handling around the `Message::FetchedMode` send to emit the log-specific error
message variant expected by the UI instead of reporting a mode-fetch failure.
Preserve the existing “Cardwire daemon disconnected” error text and async send
behavior.
🪄 Autofix

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: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 447e82ed-9d14-410b-b14b-aacbc99531d7

📥 Commits

Reviewing files that changed from the base of the PR and between 7b1f539 and 879d1a9.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • Cargo.toml
  • crates/cardwire-gui/Cargo.toml
  • crates/cardwire-gui/src/app.rs
  • crates/cardwire-gui/src/message.rs
  • crates/cardwire-gui/src/models.rs
  • crates/cardwire-gui/src/subscription.rs
  • crates/cardwire-gui/src/ui.rs

Comment thread crates/cardwire-gui/src/models.rs
Comment thread crates/cardwire-gui/src/subscription.rs
Comment thread crates/cardwire-gui/src/subscription.rs
@luytan
luytan merged commit 8a6bfce into main Aug 7, 2026
7 checks passed
@luytan
luytan deleted the cardwire-gui-log branch August 7, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant