Skip to content

Conversation

@DropSnorz
Copy link
Owner

Related to #363

@coderabbitai
Copy link

coderabbitai bot commented Sep 3, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

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.

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

Walkthrough

Preselects compatible platform targets in the Explore UI, switches platform filtering to a PLATFORM_LIST criterion, eagerly fetches bundles and targets in repository queries, updates mappers to derive bundle names from the remote package name (method signature changes), and marks certain bundle name fields/accessors as @deprecated.

Changes

Cohort / File(s) Summary of changes
Explore controller & UI
owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java
Preselects target checkboxes from application defaults, triggers package search on startup, builds TARGET list and creates a single PLATFORM_LIST criterion, renamed refreshView(Iterable<RemotePackage>)displayPackages(...).
Search criteria & enum
.../explore/model/search/ExploreCriteriaAdapter.java, .../explore/model/search/ExploreFilterCriteriaType.java
Added PLATFORM_LIST enum constant; adapter handles PLATFORM_LIST by producing a specification that checks for any of a list of platform tags.
Repository & service
.../explore/repositories/RemotePackageRepository.java, .../explore/services/ExploreService.java
hasPlatformTag now accepts List<String>; added fetchBundlesAndTargets() specification to eagerly fetch bundles and targets; service replaced platform-tag predicate with fetchBundlesAndTargets() in the query chain.
Model mapping — OAS & Registry
.../model/mappers/oas/OASModelAdapter.java, .../model/mappers/registry/RegistryModelAdapter.java
Mapper signatures updated to accept remote package name (mapperToEntity(..., String) / jsonMapperToEntity(..., String)); bundle display names constructed as "<remotePackageName> - <targets>"; bundle fileSize populated in registry adapter.
Deprecations on bundle name fields/accessors
.../explore/model/PackageBundle.java, .../model/mappers/registry/BundleMapper.java
Added @Deprecated to private name fields and their public getName() / setName(...) accessors.
Runtime platform definitions
owlplug-client/src/main/java/com/owlplug/core/components/RuntimePlatformResolver.java
Replaced single mac platform with two entries: mac-x64 and mac-arm64 (arch values adjusted).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as ExploreController
  participant SVC as ExploreService
  participant REPO as RemotePackageRepository
  participant DB as JPA/DB

  rect rgb(247,249,255)
  note over UI: Initialization
  UI->>UI: Read compatible platform tags from defaults
  UI->>UI: Preselect target checkboxes
  UI->>SVC: performPackageSearch(criteria incl. PLATFORM_LIST)
  end

  rect rgb(245,255,245)
  note over SVC,REPO: Search flow
  SVC->>REPO: sourceEnabled() AND fetchBundlesAndTargets()
  REPO->>DB: JPA fetch bundles (inner) and targets (left)
  REPO-->>SVC: Spec with eager fetch
  SVC->>REPO: Apply toSpecification(criteriaList) (includes PLATFORM_LIST)
  REPO->>DB: Query with filters (bundles+targets fetched)
  DB-->>SVC: RemotePackage results
  SVC-->>UI: displayPackages(results)
  end
Loading
sequenceDiagram
  autonumber
  participant REG as RegistryModelAdapter
  participant OAS as OASModelAdapter
  participant RP as RemotePackage (target)

  note over REG: Registry mapping
  REG->>RP: jsonMapperToEntity(bundleMapper, remotePackage.name)
  note right of RP: bundle.name = "<remotePackage.name> - <targets>"

  note over OAS: OAS mapping
  OAS->>RP: mapperToEntity(file, remotePackage.name)
  note right of RP: bundle.name = "<remotePackage.name> - <targets>"
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/system-filter

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@DropSnorz DropSnorz force-pushed the fix/system-filter branch 2 times, most recently from e4be7fe to 0a4444c Compare September 4, 2025 17:46
@DropSnorz DropSnorz self-assigned this Sep 4, 2025
@DropSnorz DropSnorz marked this pull request as ready for review September 4, 2025 17:47
@DropSnorz
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Sep 4, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
owlplug-client/src/main/java/com/owlplug/explore/model/mappers/oas/OASModelAdapter.java (2)

94-107: Null-safety on registry fields.

getSystems(), getArchitectures(), and getContains() may be null; current loops can NPE. Also, file.getType() check below can NPE. Guard them.

-    List<String> targets = new ArrayList<>();
-    for (OASFile.System system : file.getSystems()) {
-      for (String arch : file.getArchitectures()) {
-        targets.add(system.getType() + "-" + arch);
-      }
-    }
+    List<String> targets = new ArrayList<>();
+    List<OASFile.System> systems = file.getSystems() != null ? file.getSystems() : List.of();
+    List<String> archs = file.getArchitectures() != null ? file.getArchitectures() : List.of();
+    for (OASFile.System system : systems) {
+      String sys = system != null && system.getType() != null ? system.getType() : "unknown";
+      for (String arch : archs) {
+        String a = arch != null ? arch : "unknown";
+        targets.add(sys + "-" + a);
+      }
+    }

136-147: Return a modifiable list and normalize case.

stream().toList() returns an unmodifiable list (JDK 16+). Hibernate may need to mutate ElementCollections. Also normalize input case to avoid mismatches.

-  private static List<String> getPluginFormatsFromFileFormats(List<String> fileFormats) {
-    HashSet<String> pluginFormats = new HashSet<>();
-    for (String format : fileFormats) {
+  private static List<String> getPluginFormatsFromFileFormats(List<String> fileFormats) {
+    HashSet<String> pluginFormats = new HashSet<>();
+    if (fileFormats == null) return java.util.Collections.emptyList();
+    for (String fmt : fileFormats) {
+      if (fmt == null) continue;
+      String format = fmt.toLowerCase();
       switch (format) {
         case "component" -> pluginFormats.add("au");
         case "lv2" -> pluginFormats.add("lv2");
         case "vst3" -> pluginFormats.add("vst3");
         case "so", "vst", "dll" -> pluginFormats.add("vst2");
       }
     }
-    return pluginFormats.stream().toList();
+    return new java.util.ArrayList<>(pluginFormats);
   }
🧹 Nitpick comments (7)
owlplug-client/src/main/java/com/owlplug/explore/model/PackageBundle.java (2)

39-41: Deprecating only the field makes intent unclear—document or align accessors.

If "name" is truly legacy, consider deprecating getters/setters too (or add Javadoc explaining transitional use) so call sites surface warnings when you’re ready to migrate.

-  private String name;
+  @Deprecated
+  private String name;
+
+  /**
+   * Deprecated: UI should derive display names from RemotePackage + targets.
+   */
+  @Deprecated
+  public String getName() { return name; }
+
+  /**
+   * Deprecated: UI should derive display names from RemotePackage + targets.
+   */
+  @Deprecated
+  public void setName(String name) { this.name = name; }

44-46: Remove deprecated format field and its accessors from PackageBundle. No external calls to getFormat/setFormat on PackageBundle were found; delete the field (lines 44–46) and its getter/setter methods (lines 131–139).

owlplug-client/src/main/java/com/owlplug/explore/model/mappers/oas/OASModelAdapter.java (1)

112-127: Avoid recomputation; check file type null.

getPluginFormatsFromFileFormats is called twice; compute once. Also guard file.getType() before equals.

-    if (files != null) {
+    if (files != null) {
       for (OASFile file : files) {
-
-        // Skipping. If a file contains only unmappable plugins formats
-        if (getPluginFormatsFromFileFormats(file.getContains()).isEmpty()) {
+        // Skipping. If a file contains only unmappable plugins formats
+        List<String> mappedFormats = getPluginFormatsFromFileFormats(file.getContains());
+        if (mappedFormats.isEmpty()) {
           continue;
         }
 
         // Skipping. OwlPlug only supports archives (installer not supported)
-        if (!file.getType().equals("archive")) {
+        if (file.getType() == null || !"archive".equals(file.getType())) {
           continue;
         }
 
-        PackageBundle bundle = mapperToEntity(file, remotePackage.getName());
+        PackageBundle bundle = mapperToEntity(file, remotePackage.getName());
         bundle.setRemotePackage(remotePackage);
+        // Use the formats we already computed
+        bundle.setFormats(new java.util.ArrayList<>(mappedFormats));
         bundles.add(bundle);
       }
     }
owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/BundleMapper.java (1)

25-26: Surface deprecation at call sites.

Also deprecate accessors so usages get flagged during migration to derived names.

   @Deprecated
   private String name;
+  /**
+   * Deprecated: bundle display name will be derived from RemotePackage + targets.
+   */
+  @Deprecated
+  public String getName() { return name; }
+  /**
+   * Deprecated: bundle display name will be derived from RemotePackage + targets.
+   */
+  @Deprecated
+  public void setName(String name) { this.name = name; }
owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java (1)

240-248: Good: collapse multiple PLATFORM chips into a single PLATFORM_LIST.

This fixes the previous unintended AND. Consider guarding against overlapping async searches (rapid toggles) to avoid stale results replacing newer ones (track a request id/version).

owlplug-client/src/main/java/com/owlplug/explore/services/ExploreService.java (1)

124-127: Switch to fetchBundlesAndTargets: OK; remove dead variable and re-check default filtering.

  • The change to .and(RemotePackageRepository.fetchBundlesAndTargets()) is sensible for eager loading.
  • RuntimePlatform env (Line 122) is now unused—remove it.
  • Since controller filters are now UI-driven, ensure all call sites that bypass performPackageSearch() won’t unintentionally return unfiltered results.
-    RuntimePlatform env = this.getApplicationDefaults().getRuntimePlatform();
+    // removed: unused RuntimePlatform env
owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/RegistryModelAdapter.java (1)

93-97: Update Javadoc to reflect new parameter.

Add @param name to the method’s doc to keep Javadoc accurate.

-   * @param bundleMapper bundle json bundleMapper
+   * @param bundleMapper bundle json bundleMapper
+   * @param name remote package name used as bundle display name prefix
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cb6d75b and 0a4444c.

📒 Files selected for processing (9)
  • owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java (4 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/PackageBundle.java (1 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/mappers/oas/OASModelAdapter.java (3 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/BundleMapper.java (1 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/RegistryModelAdapter.java (2 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/search/ExploreCriteriaAdapter.java (1 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/search/ExploreFilterCriteriaType.java (1 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/repositories/RemotePackageRepository.java (2 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/services/ExploreService.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (7)
owlplug-client/src/main/java/com/owlplug/explore/model/mappers/oas/OASModelAdapter.java (1)

88-104: Old single-arg mapper removed
All calls to mapperToEntity(OASFile) have been updated to the new two-argument signature. The deprecated PackageBundle.name setter remains in use here by design.

owlplug-client/src/main/java/com/owlplug/explore/repositories/RemotePackageRepository.java (1)

117-123: Ignore signature change warning: hasPlatformTag retains both String and List overloads and ExploreCriteriaAdapter invokes each correctly.

Likely an incorrect or invalid review comment.

owlplug-client/src/main/java/com/owlplug/explore/model/search/ExploreFilterCriteriaType.java (1)

22-22: All ExploreFilterCriteriaType branches handled
ExploreCriteriaAdapter and ExploreController cover PLATFORM_LIST and FORMAT_LIST; no switch statements on this enum and no ordinal‐based serialization detected.

owlplug-client/src/main/java/com/owlplug/explore/model/search/ExploreCriteriaAdapter.java (1)

56-58: Confirm OR semantics for multi-platform filtering.

Please confirm RemotePackageRepository.hasPlatformTag(List<String>) matches “any-of” semantics. This PR’s aim (“select multiple target platforms”) suggests OR; an AND here would still over-restrict results.

owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java (2)

47-47: Import looks correct.

Set import is required for preselection logic.


179-181: Verify platform tag alignment between UI keys and runtime tags.

Keys like "mac" and "linux-arm64" must exactly match RuntimePlatform.getCompatiblePlatformsTags(). If registry tags differ (e.g., "osx", "macos", "darwin"), preselection won’t trigger.

owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/RegistryModelAdapter.java (1)

74-76: Call-site update looks correct.

Passing remotePackage.getName() into the bundle mapper aligns naming across sources.

@DropSnorz
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Sep 4, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
owlplug-client/src/main/java/com/owlplug/core/components/RuntimePlatformResolver.java (1)

57-60: Rosetta compatibility: arm64 Macs should accept x64 targets.

To reflect real-world compatibility (Rosetta 2), make mac-arm64 compatible with mac-x64. This aligns with your multi-target selection goal.

     winX64.getCompatiblePlatforms().add(winX86);
     linuxX64.getCompatiblePlatforms().add(linuxX86);
     linuxArm64.getCompatiblePlatforms().add(linuxArm86);
+    macArm64.getCompatiblePlatforms().add(macX64);
♻️ Duplicate comments (1)
owlplug-client/src/main/java/com/owlplug/explore/repositories/RemotePackageRepository.java (1)

125-139: Protect fetch-join spec from count queries; set distinct on select.

Applying fetch joins during count causes runtime errors on many providers. Guard by result type; set distinct(true) for the select.

   @SuppressWarnings("unchecked")
   static Specification<RemotePackage> fetchBundlesAndTargets() {
     return (root, query, cb) -> {
-      Fetch<Object, Object> bundlesFetch = root.fetch("bundles", JoinType.INNER);
-      bundlesFetch.fetch("targets", JoinType.LEFT);
-
-      // Always true predicate for WHERE clause
-      return cb.conjunction();
+      Class<?> rt = query.getResultType();
+      boolean isCount = (rt == Long.class || rt == long.class);
+      if (!isCount) {
+        Fetch<Object, Object> bundlesFetch = root.fetch("bundles", JoinType.INNER);
+        bundlesFetch.fetch("targets", JoinType.LEFT);
+        query.distinct(true);
+      }
+      return cb.conjunction();
     };
   }
🧹 Nitpick comments (12)
owlplug-client/src/main/java/com/owlplug/core/components/RuntimePlatformResolver.java (3)

44-47: Optional: Add common macOS aliases to improve repository matching.

If upstream package metadata uses "darwin"/"macos"/"osx" keys, define aliases like Windows/Linux do.

-    RuntimePlatform macX64 = new RuntimePlatform("mac-x64", OperatingSystem.MAC, "x64");
+    RuntimePlatform macX64 = new RuntimePlatform("mac-x64", OperatingSystem.MAC, "x64",
+        new String[] {"darwin-x64", "macos-x64", "osx-x64", "darwin", "macos", "osx"});
     platforms.add(macX64);
-    RuntimePlatform macArm64 = new RuntimePlatform("mac-arm64", OperatingSystem.MAC, "arm64");
+    RuntimePlatform macArm64 = new RuntimePlatform("mac-arm64", OperatingSystem.MAC, "arm64",
+        new String[] {"darwin-arm64", "macos-arm64", "osx-arm64", "aarch64"});
     platforms.add(macArm64);

52-55: Nit: Rename linuxArm86linuxArm32 for clarity.

It represents 32‑bit ARM; the current name suggests x86.

-    RuntimePlatform linuxArm86 = new RuntimePlatform("linux-arm32", OperatingSystem.LINUX, "arm32");
-    platforms.add(linuxArm86);
+    RuntimePlatform linuxArm32 = new RuntimePlatform("linux-arm32", OperatingSystem.LINUX, "arm32");
+    platforms.add(linuxArm32);
@@
-    linuxArm64.getCompatiblePlatforms().add(linuxArm86);
+    linuxArm64.getCompatiblePlatforms().add(linuxArm32);

Also applies to: 59-59


85-86: Nit: Unify unknown arch casing.

Return "unknown" consistently to avoid mismatches.

-    if (arch == null) {
-      return "Unknown";
+    if (arch == null) {
+      return "unknown";
@@
-    } else {
-      return "unknown";
+    } else {
+      return "unknown";

Also applies to: 99-100

owlplug-client/src/main/java/com/owlplug/explore/model/mappers/oas/OASModelAdapter.java (2)

88-104: Make bundle name and targets deterministic and null-safe.

Guard against null/blank name and empty/duplicate targets; sort targets for stable UI; avoid trailing " - " when no targets.

Apply:

-  public static PackageBundle mapperToEntity(OASFile file, String name) {
+  public static PackageBundle mapperToEntity(OASFile file, String name) {
@@
-    List<String> targets = new ArrayList<>();
-    for (OASFile.System system : file.getSystems()) {
-      for (String arch : file.getArchitectures()) {
-        targets.add(system.getType() + "-" + arch);
-      }
-    }
-    packageBundle.setTargets(targets);
-
-    String bundleName = name + " - " + String.join(" ", targets);
-    packageBundle.setName(bundleName);
+    List<String> targets = new ArrayList<>();
+    if (file.getSystems() != null && file.getArchitectures() != null) {
+      for (OASFile.System system : file.getSystems()) {
+        if (system == null || system.getType() == null) continue;
+        for (String arch : file.getArchitectures()) {
+          if (arch == null || arch.isBlank()) continue;
+          targets.add(system.getType() + "-" + arch);
+        }
+      }
+    }
+    targets = targets.stream().distinct().sorted().toList();
+    packageBundle.setTargets(targets);
+
+    String safeName = (name == null || name.isBlank()) ? "Bundle" : name.trim();
+    String bundleName = targets.isEmpty() ? safeName : safeName + " - " + String.join(", ", targets);
+    packageBundle.setName(bundleName);

105-107: Confirm bit-to-byte conversion and potential rounding.

If upstream size isn’t guaranteed to be a multiple of 8, prefer ceiling to avoid underreporting bytes.

-    packageBundle.setFileSize(file.getSize() / 8);
+    packageBundle.setFileSize((file.getSize() + 7) / 8);
owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/BundleMapper.java (1)

25-26: Clarify deprecations and migration path.

Add since/version and guidance to use remote package name + targets; consider forRemoval when safe; keep JSON compatibility.

-  @Deprecated
+  @Deprecated(since = "1.9.0") // update to actual version
   private String name;
@@
-  @Deprecated
+  @Deprecated(since = "1.9.0")
   public String getName() {
@@
-  @Deprecated
+  @Deprecated(since = "1.9.0")
   public void setName(String name) {
@@
-  @Deprecated
+  @Deprecated(since = "1.9.0")
   public String getFormat() {
@@
-  @Deprecated
+  @Deprecated(since = "1.9.0")
   public void setFormat(String format) {

Optionally, to ease registry compatibility when only a single ‘format’ is provided:

// Add alongside existing setters
@com.fasterxml.jackson.annotation.JsonSetter("format")
public void setLegacyFormat(String legacy) {
  if (legacy == null) return;
  this.formats = (this.formats == null || this.formats.isEmpty())
      ? List.of(legacy)
      : this.formats;
}

Also applies to: 40-44, 53-56, 90-94, 111-114

owlplug-client/src/main/java/com/owlplug/explore/model/search/ExploreCriteriaAdapter.java (1)

56-58: Guard against null/empty lists to avoid invalid IN () predicates.

Short-circuit when the list is null/empty.

-    if (criteria.getFilterType().equals(ExploreFilterCriteriaType.PLATFORM_LIST)) {
-      return RemotePackageRepository.hasPlatformTag((List<String>) criteria.getValue());
-    }
+    if (criteria.getFilterType().equals(ExploreFilterCriteriaType.PLATFORM_LIST)) {
+      @SuppressWarnings("unchecked")
+      List<String> platforms = (List<String>) criteria.getValue();
+      if (platforms == null || platforms.isEmpty()) {
+        return Specification.where(null);
+      }
+      return RemotePackageRepository.hasPlatformTag(platforms);
+    }
owlplug-client/src/main/java/com/owlplug/explore/repositories/RemotePackageRepository.java (1)

117-123: Handle empty platformTagList defensively to avoid provider-specific errors.

path.in(emptyList) can error or always-false depending on JPA provider. Return a tautology when list is empty.

   static Specification<RemotePackage> hasPlatformTag(List<String> platformTagList) {
     return (remotePackage, cq, cb) -> {
+      if (platformTagList == null || platformTagList.isEmpty()) {
+        return cb.conjunction();
+      }
       Join<Object, Object> bundles = (Join<Object, Object>) remotePackage.fetch("bundles", JoinType.INNER);
       return bundles.join("targets").in(platformTagList);
 
     };
   }
owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java (4)

180-182: Avoid recomputing defaults inside the loop.

Store preselected once before iterating.

Example:

final Set<String> preselected = this.getApplicationDefaults().getRuntimePlatform().getCompatiblePlatformsTags();
for (Entry<String, CheckBox> entry : targetFilterCheckBoxes.entrySet()) {
  entry.getValue().setSelected(preselected.contains(entry.getKey()));
  ...
}

241-249: Good consolidation into a single PLATFORM_LIST criterion; add task-cancel to prevent stale UI.

Rapid toggles can race; cancel the previous search before starting a new one.

Additional changes (outside this hunk):

// field
private volatile Task<Iterable<RemotePackage>> currentSearch;

// in performPackageSearch(), before starting the new thread:
if (currentSearch != null) { currentSearch.cancel(); }
currentSearch = task;

278-279: Delegating refreshView() to performPackageSearch() is fine.

Optionally change the sync listener to this::performPackageSearch for clarity; behavior is equivalent.


287-287: synchronized likely unnecessary on JavaFX thread.

displayPackages runs from Task.setOnSucceeded on the FX thread; synchronization can be dropped unless called off-FX elsewhere.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0a4444c and 46720d3.

📒 Files selected for processing (10)
  • owlplug-client/src/main/java/com/owlplug/core/components/RuntimePlatformResolver.java (1 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java (6 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/PackageBundle.java (2 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/mappers/oas/OASModelAdapter.java (3 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/BundleMapper.java (3 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/RegistryModelAdapter.java (2 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/search/ExploreCriteriaAdapter.java (1 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/model/search/ExploreFilterCriteriaType.java (1 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/repositories/RemotePackageRepository.java (2 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/services/ExploreService.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • owlplug-client/src/main/java/com/owlplug/explore/model/PackageBundle.java
  • owlplug-client/src/main/java/com/owlplug/explore/services/ExploreService.java
  • owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/RegistryModelAdapter.java
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-04T19:44:02.376Z
Learnt from: DropSnorz
PR: DropSnorz/OwlPlug#364
File: owlplug-client/src/main/java/com/owlplug/explore/repositories/RemotePackageRepository.java:125-139
Timestamp: 2025-09-04T19:44:02.376Z
Learning: Modern Hibernate versions (≥5.3) automatically handle entity deduplication when using fetch joins in JPA Specifications. The main issue with fetch joins in Specifications is count query compatibility, not duplicate entity creation.

Applied to files:

  • owlplug-client/src/main/java/com/owlplug/explore/repositories/RemotePackageRepository.java
📚 Learning: 2025-09-04T18:09:08.241Z
Learnt from: DropSnorz
PR: DropSnorz/OwlPlug#364
File: owlplug-client/src/main/java/com/owlplug/explore/model/mappers/registry/RegistryModelAdapter.java:98-106
Timestamp: 2025-09-04T18:09:08.241Z
Learning: In OwlPlug's RegistryModelAdapter.jsonMapperToEntity method, bundleMapper.getTargets() is guaranteed to not be null based on the registry data sources used, so defensive null checks are not needed in this context.

Applied to files:

  • owlplug-client/src/main/java/com/owlplug/explore/model/mappers/oas/OASModelAdapter.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (5)
owlplug-client/src/main/java/com/owlplug/core/components/RuntimePlatformResolver.java (1)

44-47: Legacy “mac” platform key usage not found
Ripgrep only reported "mac" in the OperatingSystem enum and OS‐detection (osTag.contains/osName.contains), not in any RuntimePlatform id usage.

owlplug-client/src/main/java/com/owlplug/explore/model/mappers/oas/OASModelAdapter.java (1)

88-104: Good alignment with new naming strategy.

Using the remote package name plus targets makes bundle labels clearer across Explore/Registry mappings.

owlplug-client/src/main/java/com/owlplug/explore/model/search/ExploreFilterCriteriaType.java (1)

22-22: Enum insertion safe: no ordinal-based persistence found
Ran project-wide search for @Enumerated(EnumType.ORDINAL) and found no usages; ExploreFilterCriteriaType isn’t persisted or serialized by ordinal. Adding PLATFORM_LIST mid-enum introduces no breaking change.

owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java (2)

173-175: Mac targets split looks good.

Clearer UX with explicit x64/arm64 options.


268-269: Correct to display packages directly on success.

Prevents redundant re-querying.

@DropSnorz DropSnorz moved this to Todo in OwlPlug 1.30 Sep 4, 2025
@DropSnorz DropSnorz merged commit 531d242 into master Sep 4, 2025
1 of 3 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in OwlPlug 1.30 Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants