Skip to content

refactor: unify platform access with service implementations#347

Merged
Indemnity83 merged 1 commit into
mc/26.1from
refactor/unify-fabric-separation-common
May 7, 2026
Merged

refactor: unify platform access with service implementations#347
Indemnity83 merged 1 commit into
mc/26.1from
refactor/unify-fabric-separation-common

Conversation

@Indemnity83
Copy link
Copy Markdown
Owner

@Indemnity83 Indemnity83 commented May 6, 2026

Summary
This update introduces a unified access layer for platform-specific functionalities through the implementation of the PlatformService and ResourceReloadRegistrar. This change enhances maintainability by centralizing platform access and reinforces the capabilities for resource management across different loaders.

Changes

  • Unification of Platform Access:

    • Introduced PlatformService interface to standardize access to platform-specific utilities.
    • Implemented FabricPlatformService to provide FabricLoader access for configuration paths.
  • Resource Management Enhancements:

    • Added ResourceReloadRegistrar interface for the loader-agnostic registration of reload listeners.
    • Integrated FabricResourceReloadRegistrar implementation to facilitate resource reloading in a platform-independent way.
  • Code Refactoring:

    • Updated various components to utilize the new platform access methods, simplifying configuration loading and resource registration.
    • Migrated relevant resource registration logic from specific implementations into the new uniform structure.

Notes

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This pull request adds two loader-agnostic interfaces in common: PlatformService (configDir) and ResourceReloadRegistrar (register). LogisticsConfig now uses PlatformService.INSTANCE to locate logistics.json. MaceratorRecipeManager registers its reload listener via ResourceReloadRegistrar.INSTANCE.register(...). Fabric module supplies FabricPlatformService and FabricResourceReloadRegistrar implementations discovered at runtime via ServiceLoader.

Possibly related issues

Possibly related PRs

  • Indemnity83/logistics#348: Touches macerator recipe registration and restructures where the register() call runs; directly related to ResourceReloadRegistrar migration.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: introducing unified platform access through service implementations rather than direct loader-specific imports.
Description check ✅ Passed The description explains the unified access layer, service implementations, and refactoring changes related to the PR objectives, though it uses broad language about 'simplifying' without extensive detail.
Linked Issues check ✅ Passed The PR addresses both issues: #330 removes FabricLoader imports from common via PlatformService interface and FabricPlatformService implementation; #331 abstracts resource reloading via ResourceReloadRegistrar, removing Fabric-specific imports from common while keeping MaceratorRecipeManager's reload logic.
Out of Scope Changes check ✅ Passed All changes directly support the two linked objectives: PlatformService and its implementations, ResourceReloadRegistrar and its implementations, and refactoring existing code to use these new abstractions—no unrelated changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/unify-fabric-separation-common

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

@Indemnity83
Copy link
Copy Markdown
Owner Author

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

✅ 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
Copy Markdown
Contributor

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

🤖 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 `@common/src/main/java/com/logistics/core/lib/platform/PlatformService.java`:
- Around line 24-26: The ServiceLoader lookups in PlatformService and
ResourceReloadRegistrar will fail because the SPI descriptor files are missing;
add two files under fabric/src/main/resources/META-INF/services: one named
com.logistics.core.lib.platform.PlatformService containing the single
implementation class name com.logistics.fabric.FabricPlatformService, and
another named com.logistics.core.lib.platform.ResourceReloadRegistrar containing
com.logistics.fabric.FabricResourceReloadRegistrar so
ServiceLoader.load(PlatformService.class) and
ServiceLoader.load(ResourceReloadRegistrar.class) can discover the
implementations.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 604d85c8-f380-4ca6-8e65-4534ae7c07fe

📥 Commits

Reviewing files that changed from the base of the PR and between b52981e and dbfb281.

📒 Files selected for processing (6)
  • common/src/main/java/com/logistics/core/LogisticsConfig.java
  • common/src/main/java/com/logistics/core/lib/platform/PlatformService.java
  • common/src/main/java/com/logistics/core/lib/platform/ResourceReloadRegistrar.java
  • common/src/main/java/com/logistics/core/macerator/MaceratorRecipeManager.java
  • fabric/src/main/java/com/logistics/fabric/FabricPlatformService.java
  • fabric/src/main/java/com/logistics/fabric/FabricResourceReloadRegistrar.java

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.

Abstract resource reload listener registration (MaceratorRecipeManager) Create Platform service for config directory path

1 participant