Skip to content

Feature: Event view - #3780

Merged
infeo merged 70 commits into
developfrom
feature/event-view
Apr 3, 2025
Merged

infeo merged 70 commits into
developfrom
feature/event-view

Conversation

@infeo

@infeo infeo commented Mar 12, 2025 •

Copy link
Copy Markdown
Member

This PR adds an event view to the application.

The event view informs the user about events inside an unlocked vault. Such events are:

  • conflict resolution (failed and successful)
  • broken filesystem structure (e.g. empty dir.c9r)
  • failed decryption (due to an invalid/tampered file)

The event view can be accessed from the main window by clicking on the bell icon in the left lower corner. The icon has an "update indicator", if new events are available. The update indicator disappears when the event window gets focus.

pr_ready_light pr_read_dark

The events are displayed in a list. Each event has a short description and a subtext mentioning the affected file (mostly encrypted version, see cryptomator/cryptofs#278 why a decrypted path might not be available). Additionally, a counter of how often the event happend and the timestamp of last appearance is displayed. Each event offers some actions, which can be accessed by hovering over the list element and click the right button. The actions are currently "dismiss" and various forms of "reveal file" (encrypted, decrypted, original, etc), depending on the actual event.
pr_ready_eventActions

If a vault is locked, the event is not removed, but obfuscated. Only the affected vault is displayed.
pr_ready_eventView_lockedEvent


Technical details:

  • events are stored inside a map keyed with (vault, some identifying path, class of event) to check if an event just reoccurred
  • to not block the GUI by a damaged vault spamming constantly events, the gui list is updated at fixed intervals (every second the app polls for updates)

* renamed eventRegistry to ...EventAggregator
* removed LRU cache and insert queue from aggregator
* moved data transfer from background to GUI into own class: FxFSEventList
* type of  entrySet of FileSystemEvent map in GUI
* moven key and value records for event map to own class file

@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: 3

🧹 Nitpick comments (12)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (4)

19-26: Consider adding more detailed Javadoc for this class.

While the internal method has documentation, it would be helpful to have class-level documentation explaining the purpose and lifecycle of this event list component.


42-54: Potential thread safety issue with concurrent flush calls.

While you use a CountDownLatch to wait for the UI thread to complete its work, there's no protection against multiple threads calling flush() concurrently, which could lead to race conditions.

Consider adding synchronization or using atomic operations:

-private void flush() {
+private synchronized void flush() {
    var latch = new CountDownLatch(1);
    Platform.runLater(() -> {
        eventAggregator.cloneTo(events);
        unreadEvents.setValue(true);
        latch.countDown();
    });
    try {
        latch.await();
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    }
}

56-58: Add Javadoc for public methods.

Adding proper documentation for public methods will improve API usability and maintainability.

+/**
+ * Returns the observable list of file system events.
+ * This list is updated automatically when new events are detected.
+ *
+ * @return An observable list of file system events
+ */
public ObservableList<Map.Entry<FSEventBucket, FSEventBucketContent>> getObservableList() {
    return events;
}

60-62: Add Javadoc for unreadEventsProperty.

Similar to the previous comment, document this public method.

+/**
+ * Returns the boolean property that indicates whether there are unread events.
+ * This property is set to true when new events are detected and can be
+ * used to update UI elements accordingly.
+ *
+ * @return A boolean property indicating the presence of unread events
+ */
public BooleanProperty unreadEventsProperty() {
    return unreadEvents;
}
src/main/java/org/cryptomator/ui/fxapp/FxApplication.java (2)

32-32: Consider improving the comment grammar.

The comment has a small grammatical error.

-private final FxFSEventList fxFSEventList; //not unused! By injecting it here, the object gets initiated the service starts
+private final FxFSEventList fxFSEventList; //not unused! By injecting it here, the object gets initiated and the service starts

34-46: Consider alternative approaches for service initialization.

Injecting a component solely for the side effect of initializing it indicates a potential design issue. Consider making the service initialization more explicit, perhaps by adding an initialization method to the start() method.

src/main/java/org/cryptomator/ui/eventview/EventViewModule.java (2)

25-41: Consider making the stage height dynamic

The stage is initially set to a fixed height of 498. This might not provide the best experience on smaller or larger displays. A dynamic approach or minimal height constraints could help accommodate different screen resolutions more gracefully.


50-55: Scene allocation

Providing a dedicated scene for the event viewer is straightforward. Consider logging or gracefully handling exceptions if the FXML file is missing or invalid, though it may be guaranteed by your build process.

src/main/java/org/cryptomator/ui/eventview/EventListCellFactory.java (1)

31-39: Catch and log IOException before rethrowing

Currently, the code throws an UncheckedIOException. It may be beneficial to add logging to help troubleshoot any FXML loading issues at runtime.

 try {
   FXMLLoader fxmlLoader = fxmlLoaders.load(FXML_PATH);
   return new Cell(fxmlLoader.getRoot(), fxmlLoader.getController());
 } catch (IOException e) {
+  // e.g., LOG.error("Error loading {}", FXML_PATH, e);
   throw new UncheckedIOException("Failed to load %s.".formatted(FXML_PATH), e);
 }
src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java (2)

70-70: BooleanProperty for unread events is a clear addition.
The introduction of unreadEvents for tracking state is straightforward. Consider adding a quick unit test to ensure the property is correctly set and unset.


270-274: Method showEventViewer properly sets unreadEvents to false.
This aligns with typical UX behavior that opening the event viewer clears "unread" status. Consider adding unit tests to confirm that this state change actually triggers any relevant UI updates.

src/main/java/org/cryptomator/ui/eventview/EventViewController.java (1)

104-107: Clearing all events at once could be surprising to some users.
Consider a prompt or partial clearing mechanism if there's a risk of accidental data loss. Otherwise, this is functional and clear.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f60d9f and 19f971c.

📒 Files selected for processing (13)
  • src/main/java/org/cryptomator/common/vaults/Vault.java (7 hunks)
  • src/main/java/org/cryptomator/event/FSEventBucket.java (1 hunks)
  • src/main/java/org/cryptomator/event/FSEventBucketContent.java (1 hunks)
  • src/main/java/org/cryptomator/event/FileSystemEventAggregator.java (1 hunks)
  • src/main/java/org/cryptomator/ui/eventview/EventListCellController.java (1 hunks)
  • src/main/java/org/cryptomator/ui/eventview/EventListCellFactory.java (1 hunks)
  • src/main/java/org/cryptomator/ui/eventview/EventViewController.java (1 hunks)
  • src/main/java/org/cryptomator/ui/eventview/EventViewModule.java (1 hunks)
  • src/main/java/org/cryptomator/ui/fxapp/FxApplication.java (2 hunks)
  • src/main/java/org/cryptomator/ui/fxapp/FxApplicationModule.java (4 hunks)
  • src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1 hunks)
  • src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java (6 hunks)
  • src/main/resources/fxml/vault_list.fxml (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/main/java/org/cryptomator/event/FSEventBucket.java
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/java/org/cryptomator/common/vaults/Vault.java
  • src/main/java/org/cryptomator/ui/fxapp/FxApplicationModule.java
🧰 Additional context used
🧬 Code Definitions (3)
src/main/java/org/cryptomator/ui/eventview/EventViewController.java (1)
src/main/java/org/cryptomator/ui/eventview/EventListCellFactory.java (1) (1)
  • EventViewScoped (18-66)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)
src/main/java/org/cryptomator/ui/fxapp/FxApplication.java (1) (1)
  • FxApplicationScoped (18-110)
src/main/java/org/cryptomator/ui/eventview/EventListCellFactory.java (1)
src/main/java/org/cryptomator/ui/eventview/EventViewController.java (1) (1)
  • EventViewScoped (24-132)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Compile and Test
🔇 Additional comments (29)
src/main/java/org/cryptomator/event/FSEventBucketContent.java (1)

5-5: Clean and concise record implementation!

This record class effectively encapsulates event data with a count for aggregation purposes.

src/main/resources/fxml/vault_list.fxml (2)

49-61: Bell icon implementation looks good.

This implementation of the event notification bell with update indicator circle aligns well with the PR objective. The update indicator is appropriately set to be visible only when there are unread events.


71-84: Style class update improves consistency.

Changing the menu items from add-vault-menu-item to dropdown-button-context-menu-item likely improves UI style consistency across the application.

src/main/java/org/cryptomator/ui/eventview/EventViewModule.java (3)

35-39: Behavior upon window focus

When the stage is focused, fxFSEventList.unreadEventsProperty() is automatically reset to false. Ensure this behavior aligns with the intended UX: repeated refocusing will clear any unread events, even if the user didn't actually view them.


43-48: FxmlLoaderFactory usage

The approach of returning a straightforward FxmlLoaderFactory is clean and consistent. No apparent issues found here.


58-66: Dagger binding approach

The usage of @Binds, @IntoMap, and @FxControllerKey is a standard Dagger pattern for multi-binding. Implementation looks fine.

src/main/java/org/cryptomator/ui/eventview/EventListCellFactory.java (1)

41-65: Cell update logic

The style class "list-cell" is added or removed based on item emptiness. This is correct for typical JavaFX usage. The approach is clean and ensures a consistent user interface style for populated cells.

src/main/java/org/cryptomator/event/FileSystemEventAggregator.java (1)

37-47: Potential concurrency nuance in 'put'

The usage of ConcurrentHashMap.compute(...) and AtomicBoolean is thread-safe. However, if multiple events occur simultaneously, the final count might skip increments if concurrency is not carefully handled in other calling methods. Ensure that all usage patterns guarantee accurate event counts.

src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java (5)

13-13: No issues with the new import statement.
Looks good and aligns with the subsequent usage of FxFSEventList.


96-97: Constructor injection for FxFSEventList and dialogs is well-structured.
Ensures that event tracking and dialogs are handled at creation time. No further concerns.


301-303: Providing a property accessor for unreadEvents.
unreadEventsPresentProperty() is consistent with JavaFX property patterns.


306-307: Getter method for unreadEvents is consistent.
Extends convenience by returning the property’s value. No further issues.


110-110:

Details

❓ Verification inconclusive

Binding the unreadEvents property to FxFSEventList.
This is an effective way to keep VaultListController in sync. Verify that fxFSEventList.unreadEventsProperty() is never null and properly initialized.


🏁 Script executed:

#!/bin/bash
# Verifies whether fxFSEventList is guaranteed to have a non-null unreadEventsProperty.
rg --context 5 "public.*unreadEventsProperty" 

Length of output: 879


Ensure non-null initialization of the unreadEvents property

The binding in VaultListController (line 110) is correctly delegating to fxFSEventList.unreadEventsProperty(). The search confirms that the method is declared in FxFSEventList.java and returns the unreadEvents field. However, please double-check that the unreadEvents field is initialized (either inline or in the constructor) so that it can never be null. This manual verification is important to guarantee the expected reactivity.

src/main/java/org/cryptomator/ui/eventview/EventViewController.java (7)

1-25: Public class creation and imports appear correct.
Establishes a clear contract for a dedicated event viewer. All imports are relevant to the new functionality.


27-49: Fields and constructor for event filtering and sorting are well-structured.
The FilteredList and SortedList usage is a nice approach to maintain a dynamic, sorted view of events. Ensure that aggregator references remain valid.


51-58: Javadoc clarifies sorting logic.
Well-documented method describing how event buckets are compared. This is helpful for maintainability.


77-94: initialize() method effectively sets up UI components.
Adding null to choiceBoxEntries for “all vaults” is a nice design. Observing vault changes is also handled well.


96-102: applyVaultFilter neatly updates the predicate.
This logic is straightforward and efficient. No immediate issues.


109-130: Nested VaultConverter is well-implemented.
Offers a clean approach to present or revert vault selections. The localized text “All Vaults” is a nice touch.


59-75:

Details

❓ Verification inconclusive

compareBuckets implementation is clear but watch for possible nulls.
The method calls mostRecentEvent() and vault().getId(), which could be null in unexpected scenarios. Consider a safer fallback or a defensive check to avoid potential NullPointerExceptions.


🏁 Script executed:

#!/bin/bash
# Checking references that call `mostRecentEvent()` or `vault()` 
rg "mostRecentEvent|vault()" -A 3

Length of output: 80584


Action: Verify potential null handling in compareBuckets

The current implementation is clear and achieves its sorting goal, but it relies on non-null returns from both the call to mostRecentEvent() (and its subsequent getTimestamp()) as well as from vault().getId(). Automated searches didn’t reveal any defensive checks elsewhere, so please double-check the contracts for these methods. If there’s any possibility that either could be null in unexpected scenarios, consider adding explicit null handling or a fallback strategy to prevent potential NullPointerExceptions.

src/main/java/org/cryptomator/ui/eventview/EventListCellController.java (9)

1-16: Class definition and imports.
The approach is coherent with the event-driven UI pattern. No immediate issues here.


102-116: initialize() logic for actions button visibility is well-defined.
Binding the button’s visibility to the vault-unlocked property plus user hover is a neat solution.


130-141: adjustToBrokenFileNodeEvent sets up correct icons and actions.
Logic for revealing or copying the ciphertext/cleartext path is consistent with the other event types.


167-176: DecryptionFailedEvent handling properly sets an icon and copying logic.
Clear feedback for the user in a failing scenario. All good.


189-194: addAction method is straightforward.
Building dynamic menu items from localization keys helps maintain i18n. This is well-designed.


237-249: Use robust path resolution.
This code slices strings from URIs and paths, which can be fragile across operating systems. This concern matches previous suggestions for safer path handling.


251-257: Graceful fallback for reveal errors.
Logging the exception is a solid approach. Confirms best-effort reveal while avoiding silent failures.


265-328: Property accessors are consistent with JavaFX patterns.
They neatly expose state to the UI. No issues noted.


50-100:

Details

✅ Verification successful

Constructor sets up properties and default message/description bindings.
The usage of ObservableUtil.mapWithDefault(...) is a convenient approach. Make sure the aggregator or optional revealService is never unexpectedly null.


🏁 Script executed:

#!/bin/bash
# Checking references to revealService and aggregator outside the constructor
rg -A 5 "revealService|fileSystemEventAggregator"

Length of output: 9820


Verified: The null-safety for both fileSystemEventAggregator and revealService is ensured.

  • The aggregator is injected and used without null checks, which is acceptable since dependency injection guarantees a non-null instance.
  • The optional revealService is properly handled via null-checks (if (revealService != null)) before any usage.

@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: 0

🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)

42-54: Consider the performance impact of blocking in flush().

Currently, flush() blocks the scheduled thread while waiting for the JavaFX thread to complete the UI update. If the JavaFX thread is delayed, this can bottleneck the scheduler. You might consider decoupling the aggregator operation from the scheduled thread if strict ordering is not required.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19f971c and a93ceb5.

📒 Files selected for processing (2)
  • src/main/java/org/cryptomator/event/FileSystemEventAggregator.java (1 hunks)
  • src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)
Learnt from: infeo
PR: cryptomator/cryptomator#3780
File: src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java:27-37
Timestamp: 2025-03-21T15:33:41.461Z
Learning: In the Cryptomator application, tasks scheduled with an injected ScheduledExecutorService don't require explicit cancellation in a separate shutdown method, as they will be automatically canceled when the executorService shuts down.
🧬 Code Definitions (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)
src/main/java/org/cryptomator/ui/fxapp/FxApplication.java (1) (1)
  • FxApplicationScoped (18-110)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Compile and Test
🔇 Additional comments (6)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (3)

19-20: Good use of application scope.

Applying @FxApplicationScoped ensures only one instance is created for the application lifecycle. No concurrency concerns detected at this level.


27-37: No explicit shutdown logic necessary.

As per your learnings, tasks scheduled with the injected ScheduledExecutorService will be automatically canceled upon shutdown, so there's no need for separate cancellation logic here.


56-62: Clarify handling of unreadEvents.

The unreadEvents property is set to true but never reset within this class. If it's meant to be reset externally, consider documenting that practice or providing a helper method to mark events as read.

src/main/java/org/cryptomator/event/FileSystemEventAggregator.java (3)

22-29: No size limitation on concurrent map.

You've removed the size restriction on the event map, which can lead to unbounded growth. Given your tests, this may be acceptable. Consider adding logs or metrics if you want to monitor memory usage in production.


37-47: Concurrency usage in put().

Using map.compute(...) with a ConcurrentHashMap is a thread-safe way to handle updates. Setting hasUpdates to true afterward is consistent with your eventual consistency approach.


78-82: Ensure mid-clone updates are acceptable.

Resetting hasUpdates to false before copying the map may allow an event arriving during cloneTo() to be skipped until the next iteration. This is typically fine for eventual consistency. Verify that no stricter consistency guarantees are needed.

@infeo

infeo commented Mar 21, 2025

Copy link
Copy Markdown
Member Author

@overheadhunter Ready for review. I updated the PR description to reflect the changes and also added some short java doc strings to the "model" classes.

@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: 0

🧹 Nitpick comments (2)
src/main/java/org/cryptomator/event/FileSystemEventAggregator.java (2)

28-29: Consider memory growth with unbounded event storage.
Storing an unlimited number of events can cause the map to grow large in memory if the application runs for extended periods with high event volume. Since you successfully tested with 45,000+ events, it might be acceptable for now. However, consider reintroducing an eviction strategy or LRU if further tests reveal significant growth issues in production.


98-104: Ensure coverage of all future event types.
This switch expression covers known filesystem event subclasses. If you introduce a new event type later, the code may require an additional case. Consider adding a default or verifying that no future event subtypes can appear unexpectedly.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a93ceb5 and 4b513ca.

📒 Files selected for processing (3)
  • src/main/java/org/cryptomator/event/FileSystemEventAggregator.java (1 hunks)
  • src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1 hunks)
  • src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java
  • src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Compile and Test
🔇 Additional comments (2)
src/main/java/org/cryptomator/event/FileSystemEventAggregator.java (2)

43-53: Confirm if eventual consistency is sufficient.
Your concurrency approach (using ConcurrentHashMap and updating hasUpdates) provides eventual consistency. If scenarios demand strict consistency for UI updates or other consumers, consider synchronizing read/write operations or version-tracking. Otherwise, this best-effort model looks adequate.


84-88: Concurrency fix for hasUpdates looks good.
The logic now ensures that concurrent map modifications correctly set hasUpdates to true, minimizing the chance of missed updates after cloneTo(). This aligns with the earlier fix. Good job.

@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: 0

🧹 Nitpick comments (4)
src/main/resources/css/dark_theme.css (4)

305-307: New Header Misc Styling Added
The new .list-cell .header-misc rule sets the font size to 1.0em for miscellaneous header text in list cells. This appears consistent with the overall typography and design.

🧰 Tools
🪛 Biome (1.9.4)

[error] 306-306: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


343-349: Event Window Button-Bar Styling Added
A new styling block for .event-window .button-bar has been introduced with properties such as -fx-min-height, -fx-max-height, and -fx-background-color. These JavaFX-specific CSS properties are valid in this context.
Note: Several static analysis tools may flag these properties as unknown; ensure that the tool is configured for JavaFX CSS or include a comment to clarify their intended use.

🧰 Tools
🪛 Biome (1.9.4)

[error] 344-344: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 345-345: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 346-346: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 347-347: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 348-348: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


351-359: Styling for Button-Bar’s Right Button Added
The new rule for .event-window .button-bar .button-right sets border, background, and sizing properties using JavaFX CSS attributes. The implementation is consistent with similar button bar styling elsewhere in the file.
Note: Static analysis warnings for properties on lines 352–357 can be safely ignored or documented as JavaFX-specific.

🧰 Tools
🪛 Biome (1.9.4)

[error] 352-352: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 353-353: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 354-354: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 355-355: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 356-356: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 357-357: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


360-362: Pseudo-Class Styling for :armed State Added
The rule for .event-window .button-bar .button-right:armed applies a background color change for the armed state. The syntax and properties (e.g., -fx-background-color: CONTROL_BORDER_NORMAL, CONTROL_BG_ARMED;) are appropriate for JavaFX CSS.
Reminder: If static analysis flags the :armed pseudo-class, note that this is specific to JavaFX.

🧰 Tools
🪛 Biome (1.9.4)

[error] 361-361: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b513ca and 3707138.

📒 Files selected for processing (1)
  • src/main/resources/css/dark_theme.css (3 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/main/resources/css/dark_theme.css

[error] 306-306: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 344-344: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 345-345: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 346-346: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 347-347: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 348-348: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 352-352: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 353-353: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 354-354: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 355-355: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 356-356: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 357-357: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 361-361: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 365-365: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 369-369: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 370-370: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 649-649: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)

🔇 Additional comments (5)
src/main/resources/css/dark_theme.css (5)

337-342: Section Header for Event List Introduced
A clear comment block for the "Event List" section has been added. This improves code organization and readability by clearly delineating event-related styles.


364-367: Hover State Styling for Event List Cells Added
The new rule for .event-window .list-view .list-cell:hover changes the background color when items are hovered, enhancing interactivity. The property usage is correct; just verify that CONTROL_BG_SELECTED is the desired color reference.

🧰 Tools
🪛 Biome (1.9.4)

[error] 365-365: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


368-372: Selected State Styling for Event List Cells Added
The .event-window .list-view .list-cell:selected rule applies a composite background using two color layers (PRIMARY, CONTROL_BG_SELECTED) and adds insets for visual emphasis. This layered approach is common in JavaFX CSS.
Suggestion: Confirm that the intended visual stacking of these backgrounds is achieved in the UI.

🧰 Tools
🪛 Biome (1.9.4)

[error] 369-369: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 370-370: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


642-646: Section Header for Update Indicator Added
A new comment block titled "Update indicator" clarifies the beginning of the update indicator styling section. This enhances the maintainability of the CSS by clearly grouping styles.


648-651: Update Indicator Icon Styling Introduced
The new .icon-update-indicator rule sets the fill color to RED_5, aligning with the intended alerting or update visual cue design.
Note: If static analysis reports an unknown property for -fx-fill on line 649, it is a known false positive because these properties are JavaFX specific.

🧰 Tools
🪛 Biome (1.9.4)

[error] 649-649: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)

@overheadhunter overheadhunter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

core impl is fine, but UI thread handling needs a little change

* use ScheduledService
* start the service by method call (not by object init)

@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: 0

🧹 Nitpick comments (2)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (2)

33-47: Consider moving aggregator logic off the FX thread if it grows expensive.
By setting pollService.setExecutor(Platform::runLater), the aggregator calls occur on the JavaFX application thread. Should these operations become more resource-intensive, it may degrade UI responsiveness. As a future enhancement, consider running the aggregator tasks on a background executor and pushing only the final UI updates via Platform.runLater().


53-66: Add error handling for potential aggregator exceptions.
If eventAggregator.hasMaybeUpdates() or eventAggregator.cloneTo(events) throws an unexpected exception, the ScheduledService could fail permanently, stopping further updates. Consider wrapping these calls in a try/catch block or configuring an onFailed handler to properly handle or log such errors.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3707138 and bb48551.

📒 Files selected for processing (2)
  • src/main/java/org/cryptomator/ui/fxapp/FxApplication.java (3 hunks)
  • src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/cryptomator/ui/fxapp/FxApplication.java
🧰 Additional context used
🧠 Learnings (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)
Learnt from: infeo
PR: cryptomator/cryptomator#3780
File: src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java:27-37
Timestamp: 2025-03-31T07:00:16.632Z
Learning: In the Cryptomator application, tasks scheduled with an injected ScheduledExecutorService don't require explicit cancellation in a separate shutdown method, as they will be automatically canceled when the executorService shuts down.
🧬 Code Definitions (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)
src/main/java/org/cryptomator/ui/fxapp/FxApplication.java (1)
  • FxApplicationScoped (18-111)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Compile and Test
🔇 Additional comments (4)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (4)

20-24: Good documentation.
This doc block clearly conveys how the event polling logic updates the UI list with minimal friction.


28-32: Well-structured field definitions.
Using final for these fields promotes immutability and reduces concurrency risks.


49-51: No custom shutdown logic needed.
A previous review suggested canceling the scheduled service explicitly, but the injected ScheduledExecutorService in Cryptomator automatically cancels tasks on shutdown. No further changes are required here.


72-74:

Details

✅ Verification successful

Verify where unreadEvents is reset to false.
Currently, it’s only set to true in this class. If no external code sets it back to false, the property might stay true indefinitely.

Below is a script that searches for any assignments setting unreadEvents to false in the repository:


🏁 Script executed:

#!/bin/bash
rg "unreadEvents.*false"

Length of output: 262


Verification Confirmed: unreadEvents is Properly Reset
Our search shows that:

  • unreadEvents is initialized to false in the constructor of FxFSEventList.java.
  • Additionally, in src/main/java/org/cryptomator/ui/eventview/EventViewModule.java, there is an explicit reset via fxFSEventList.unreadEventsProperty().setValue(false).

No further action is needed.

@infeo
infeo requested a review from overheadhunter March 31, 2025 11:20

@overheadhunter overheadhunter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably my last request for changes 😉

@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: 0

🧹 Nitpick comments (2)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (2)

40-42: Consider using a recurring schedule for readability.

Currently, startPolling() schedules a one-time task, which re-invokes startPolling() later. While functional, a single recurring task might simplify the logic. For instance, you could use a scheduleAtFixedRate approach for a more direct recurring pattern.


44-59: Ensure error handling for background polling.

If an exception occurs within checkForEventUpdates(), the re-scheduling call might be skipped, halting future updates. Consider adding a try-catch around aggregator calls or scheduling to ensure the next poll is always triggered.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb48551 and 5b4245c.

📒 Files selected for processing (1)
  • src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)
Learnt from: infeo
PR: cryptomator/cryptomator#3780
File: src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java:27-37
Timestamp: 2025-04-02T15:14:56.155Z
Learning: In the Cryptomator application, tasks scheduled with an injected ScheduledExecutorService don't require explicit cancellation in a separate shutdown method, as they will be automatically canceled when the executorService shuts down.
🧬 Code Definitions (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)
src/main/java/org/cryptomator/ui/fxapp/FxApplication.java (1)
  • FxApplicationScoped (18-111)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Compile and Test
🔇 Additional comments (2)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (2)

27-38: Good use of dependency injection and initialization.

Injecting FileSystemEventAggregator and ScheduledExecutorService enables easy testing and better separation of concerns. The constructor correctly initializes the observable list and the boolean property.


61-67: Unit test coverage for properties exposure.

Methods getObservableList() and unreadEventsProperty() are central to the UI. Ensure that unit tests verify the correct updates occur when events are added or removed, and when the unreadEvents property flips.

@infeo
infeo requested a review from overheadhunter April 3, 2025 12:24

@overheadhunter overheadhunter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good from a technical point of view. Just a small naming suggestion

@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: 1

🧹 Nitpick comments (3)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (3)

17-22: Consider providing usage examples or a sample snippet in the class Javadoc
By showing how consumers typically bind and react to this list and the unreadEvents property, future maintainers can more easily understand the intended usage.


39-41: Consider using a repeated scheduling method
By using scheduleAtFixedRate or scheduleWithFixedDelay, you could streamline repetition and minimize the chance of drift if checkForEventUpdates() ever takes longer than expected.

-public void schedulePollForUpdates() {
-    scheduler.schedule(this::checkForEventUpdates, 1000, TimeUnit.MILLISECONDS);
+public void schedulePollForUpdates() {
+    scheduler.scheduleAtFixedRate(this::checkForEventUpdates, 1, 1, TimeUnit.SECONDS);
}

64-66: Consider providing a reset mechanism for unreadEvents
Currently, once set to true, there's no visible path to reset it to false in this class. If you intend to mark events as read (e.g., after the user has viewed them), exposing a method to toggle or clear unreadEvents would improve clarity and usage.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b4245c and 5cabf71.

📒 Files selected for processing (2)
  • src/main/java/org/cryptomator/ui/fxapp/FxApplication.java (3 hunks)
  • src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/cryptomator/ui/fxapp/FxApplication.java
🧰 Additional context used
🧠 Learnings (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)
Learnt from: infeo
PR: cryptomator/cryptomator#3780
File: src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java:27-37
Timestamp: 2025-04-03T12:51:05.984Z
Learning: In the Cryptomator application, tasks scheduled with an injected ScheduledExecutorService don't require explicit cancellation in a separate shutdown method, as they will be automatically canceled when the executorService shuts down.
🧬 Code Definitions (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)
src/main/java/org/cryptomator/ui/fxapp/FxApplication.java (1)
  • FxApplicationScoped (18-111)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Compile and Test
🔇 Additional comments (1)
src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java (1)

31-37: Constructor logic looks solid
The constructor properly initializes key fields, and it is consistent with the known behavior that any scheduled tasks will be handled by the injected scheduler without requiring manual cancellation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Information Area/Indicator/Log Console for a vault if it is corrupted/ has problems.

2 participants