Skip to content

fix(processor): suppress missing @ServiceProvider error when no providers exist - #45

Open
LMLiam wants to merge 3 commits into
mainfrom
bugfix/fix-missing-serviceprovider-when-project-provides-no-implementations
Open

fix(processor): suppress missing @ServiceProvider error when no providers exist#45
LMLiam wants to merge 3 commits into
mainfrom
bugfix/fix-missing-serviceprovider-when-project-provides-no-implementations

Conversation

@LMLiam

@LMLiam LMLiam commented Jun 6, 2026

Copy link
Copy Markdown
Owner

📌 Summary

🔍 Related Issues / Tickets

  • Closes #

🛠 Changes in Detail

🧩 Modules Affected

  • spi-tooling-annotations
  • spi-tooling-processor
  • Other:

📦 Versioning

  • Version bump applied (release PR)
  • Snapshot only (PR build)

🧪 Testing

  • Steps:
    1.
    2.

✅ Checklist

  • Code builds locally without errors
  • All tests pass locally (./gradlew kotest)
  • Added/updated tests for new or changed logic
  • Updated documentation / README if needed
  • No unrelated changes included

📜 Notes for Reviewers


Recreated from #12 — the original PR was auto-closed when main’s history was rewritten to the verb(scope): convention and GitHub blocks reopening a PR whose branch was force-pushed. Same branch, rebased onto the rewritten main.

Summary by CodeRabbit

  • Chores

    • Version bumped to 0.1.23.
  • Bug Fixes

    • Enhanced validation to perform more granular implementation checks and improve error reporting for missing annotations.

@LMLiam LMLiam added type:bug Confirmed or suspected defect area:processor Annotation processor: discovery, validation, META-INF/services generation labels Jun 6, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR refines the SPI processor's implementation validation logic to be more precise about concrete class filtering, then bumps the version to 0.1.23. The processor now skips interfaces, abstract classes, and Kotlin synthetic helpers before validating contract assignability and @ServiceProvider annotations.

Changes

Validation and Release Updates

Layer / File(s) Summary
Version Bump
gradle.properties
Base version incremented from 0.1.21 to 0.1.23.
Granular Implementation Validation
modules/processor/src/main/kotlin/com/github/eventhorizonlab/spi/ServiceSchemeProcessor.kt
validateImplementations now filters to concrete classes only (skipping interfaces, abstract types, and Kotlin synthetic DefaultImpls), then verifies contract assignability and enforces @ServiceProvider presence; error diagnostics emit after these additional concrete-class and synthetic-helper filters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

Poem

🐰 A version hops from twenty-one to twenty-three,
While validation grows more precise and free,
Concrete classes checked, synthetic filtered away,
Providers promised—a cleaner release day! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete with unfilled template sections. Summary, Related Issues, and Changes in Detail sections are empty; Testing steps are placeholders; all Checklist items are unchecked. Fill in the Summary section with the purpose, complete Related Issues/Changes in Detail, describe testing steps, and verify Checklist items are addressed before merge.
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 (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: suppressing a missing @ServiceProvider error in the processor when no providers exist.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@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

🤖 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
`@modules/processor/src/main/kotlin/com/github/eventhorizonlab/spi/ServiceSchemeProcessor.kt`:
- Around line 106-108: The current filter in ServiceSchemeProcessor uses
clazz.simpleName == "DefaultImpls" which incorrectly excludes real user classes
named "DefaultImpls"; update the check to inspect the class binary name and only
skip when the binary name ends with "$DefaultImpls" (e.g., use clazz.name or
binary-name equivalent and test endsWith("$DefaultImpls")) so nested/synthetic
helper classes are filtered but real top-level classes named DefaultImpls are
not; keep the surrounding comment and ensure the condition is applied where
clazz and simple are used (replace the simple == "DefaultImpls" check).
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1c306811-19ad-4fbb-8384-1d950a490fca

📥 Commits

Reviewing files that changed from the base of the PR and between fdc0ff3 and c973137.

📒 Files selected for processing (2)
  • gradle.properties
  • modules/processor/src/main/kotlin/com/github/eventhorizonlab/spi/ServiceSchemeProcessor.kt

Comment on lines +106 to +108
// Skip common Kotlin synthetic helper classes, but DO NOT skip nested user classes
val simple = clazz.simpleName.toString()
if (simple == "DefaultImpls") return@forEach

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Narrow the synthetic-class filter to binary-name pattern, not simple name.

At Line 108, simple == "DefaultImpls" can skip real user classes named DefaultImpls, which suppresses required missing-@ServiceProvider errors. Filter by binary name suffix (e.g., "$DefaultImpls") instead.

Proposed fix
-                val simple = clazz.simpleName.toString()
-                if (simple == "DefaultImpls") return@forEach
+                val binaryName = processingEnv.getStringifiedBinaryName(clazz)
+                if (binaryName.endsWith("\$DefaultImpls")) return@forEach
🤖 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
`@modules/processor/src/main/kotlin/com/github/eventhorizonlab/spi/ServiceSchemeProcessor.kt`
around lines 106 - 108, The current filter in ServiceSchemeProcessor uses
clazz.simpleName == "DefaultImpls" which incorrectly excludes real user classes
named "DefaultImpls"; update the check to inspect the class binary name and only
skip when the binary name ends with "$DefaultImpls" (e.g., use clazz.name or
binary-name equivalent and test endsWith("$DefaultImpls")) so nested/synthetic
helper classes are filtered but real top-level classes named DefaultImpls are
not; keep the surrounding comment and ensure the condition is applied where
clazz and simple are used (replace the simple == "DefaultImpls" check).

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

Labels

area:processor Annotation processor: discovery, validation, META-INF/services generation type:bug Confirmed or suspected defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant