feat: add a new signal for new apps entry - #169
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Smart Policy D-Bus interface now reports newly discovered applications. The daemon emits metadata after persistence. The GUI subscribes to the signal, resolves application metadata, and updates its policy state. ChangesNew-app notification flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CardwireAnalyzer
participant SmartPolicyInterface
participant CardwireSmartPolicy
participant AppState
CardwireAnalyzer->>SmartPolicyInterface: emit new_app_added(app metadata)
SmartPolicyInterface-->>CardwireSmartPolicy: deliver D-Bus signal
CardwireSmartPolicy-->>AppState: dispatch NewAppDiscovered
AppState->>AppState: resolve metadata and update smart_state.app_policies
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/cardwire-gui/src/subscription.rs (1)
636-656: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winRegister
new_app_addedbefore fetching the policy snapshot.The zbus binding installs the match rule when
receive_new_app_added()creates the stream. The current order can miss an app persisted afterget_app_policies()reads the database. Create the stream first, send the snapshot, then consume queued signals. Add an integration test for this interval.🤖 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/cardwire-gui/src/subscription.rs` around lines 636 - 656, Reorder the subscription flow so receive_new_app_added() creates and registers new_app_stream before calling proxy.get_app_policies(). Send the fetched snapshot after stream creation, then consume queued new_app_added signals; preserve the existing error reporting and return behavior. Add an integration test covering an app persisted between stream registration and the policy snapshot.
🤖 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.
Outside diff comments:
In `@crates/cardwire-gui/src/subscription.rs`:
- Around line 636-656: Reorder the subscription flow so receive_new_app_added()
creates and registers new_app_stream before calling proxy.get_app_policies().
Send the fetched snapshot after stream creation, then consume queued
new_app_added signals; preserve the existing error reporting and return
behavior. Add an integration test covering an app persisted between stream
registration and the policy snapshot.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 361f6298-3dc3-4c8b-b388-4ef4e3b3e9f6
📒 Files selected for processing (8)
crates/cardwire-daemon/src/analyzer/models.rscrates/cardwire-daemon/src/daemon.rscrates/cardwire-daemon/src/file/sql.rscrates/cardwire-daemon/src/interface/smart.rscrates/cardwire-daemon/src/manager.rscrates/cardwire-gui/src/app.rscrates/cardwire-gui/src/message.rscrates/cardwire-gui/src/subscription.rs
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
Checklist: