fix: prefer canonical Javadoc type pages - #113
Conversation
Warning Review limit reached
Next review available in:27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughJavaDoc type-page matching now accepts candidate package metadata, validates canonical package names, and matches package-aware URL suffixes. Citation ranking and retrieval tests now supply and verify package metadata alongside Java API page URLs. ChangesJavaDoc citation matching
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR tightens Java API Javadoc citation selection/ranking so canonical type pages (e.g., java/util/List.html) are prioritized over auxiliary pages (e.g., class-use/List.html or root redirects), by requiring trustworthy package metadata for unqualified selectors while keeping fully-qualified selectors path-driven.
Changes:
- Update
JavaApiMethodSelectormatching so unqualified selectors only match when the candidate provides a canonical Java package name; qualified selectors continue to match by URL path. - Update citation ranking to pass Qdrant package metadata into selector matching.
- Expand/adjust test fixtures and add new tests covering canonical-vs-auxiliary ordering and metadata-absent/incorrect scenarios.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/williamcallahan/javachat/service/RetrievalServiceTest.java | Updates citation fixture builder to include canonical Qdrant package metadata and URL construction inputs. |
| src/test/java/com/williamcallahan/javachat/service/CitationCandidateRankerTest.java | Adds tests for canonical type-page prioritization and qualified-selector behavior when package metadata is missing/wrong; updates helper builders to include package metadata. |
| src/test/java/com/williamcallahan/javachat/application/search/JavaApiMethodSelectorTest.java | Adjusts selector matching tests to the new matchesJavadocPath(path, candidatePackage) signature and adds coverage for canonical-package requirement. |
| src/main/java/com/williamcallahan/javachat/service/CitationCandidateRanker.java | Threads candidate package metadata into type-page matching to support the new selector behavior. |
| src/main/java/com/williamcallahan/javachat/application/search/JavaApiMethodSelector.java | Implements the new matching rules: qualified selectors ignore candidate metadata; unqualified selectors require canonical package metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
`@src/main/java/com/williamcallahan/javachat/application/search/JavaApiMethodSelector.java`:
- Around line 133-159: Replace the manual validation loop in
isCanonicalJavaPackageName with SourceVersion.isName using the appropriate
latest supported source version, while preserving the existing null, blank, and
surrounding-whitespace checks. Ensure reserved words and literals such as class,
true, false, and null are rejected as package names.
🪄 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: CHILL
Plan: Pro
Run ID: 4d1b2232-34c2-425e-9343-0e4f6fd6e75b
📒 Files selected for processing (5)
src/main/java/com/williamcallahan/javachat/application/search/JavaApiMethodSelector.javasrc/main/java/com/williamcallahan/javachat/service/CitationCandidateRanker.javasrc/test/java/com/williamcallahan/javachat/application/search/JavaApiMethodSelectorTest.javasrc/test/java/com/williamcallahan/javachat/service/CitationCandidateRankerTest.javasrc/test/java/com/williamcallahan/javachat/service/RetrievalServiceTest.java
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
class-useand root redirect pages behind canonical type pagesRoot cause
Unqualified selectors originally matched only the final filename, so auxiliary
class-use/List.htmland root redirects could receive the canonical type-page tier. The first package-aware correction trusted persisted Qdrant package metadata, but live dev data still contained an older module-prefixed form such asjava.base.java.util. That prevented canonical pages from being promoted and could also produce incorrect same-package member anchors.The final implementation uses the canonical Java API URL as the single runtime package source.
JavaPackageNameowns Java 25 package validation;JavaPackageExtractorowns manifest URL-to-package projection; ranking and anchor generation no longer read the persisted package field.Verification