Fix/better ai - #294
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds RECIPE-aware quantity/unit normalization across AI orchestration and product resolution (with QuantityParser.convertToUnit and Unit.symbol), updates AiService prompt, extends tests, and lowers the global catalog population threshold while changing its scheduled fixedRate. ChangesAI Recipe Quantity Normalization
Catalog Population Threshold Update
Sequence Diagram sequenceDiagram
participant AiService
participant AiOrchestrationService
participant ProductResolutionService
participant QuantityParser
AiService->>AiOrchestrationService: send structured list (listType, items)
AiOrchestrationService->>ProductResolutionService: applyResolvedProduct(item, recipeList)
ProductResolutionService->>QuantityParser: convertToUnit(sourceQty, catalogDefaultQty)
QuantityParser-->>ProductResolutionService: converted quantity string
ProductResolutionService-->>AiOrchestrationService: resolved item with normalized qty/unit
🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers:
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
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/p2ps/catalog/service/GlobalCatalogPopulationJob.java`:
- Line 14: Update the test in GlobalCatalogPopulationJobTest to reflect the
changed default minDistinctUsers from 3 to 1: locate the setUp that calls
ReflectionTestUtils.setField(globalCatalogPopulationJob, "minDistinctUsers", 3)
and change the value to 1 (or remove the ReflectionTestUtils.setField call to
rely on the real default), and update the assertion in
populateGlobalCatalogShouldDelegateToService to verify
globalCatalogPopulationService.populateFromPopularUnknownProducts(1) instead of
3; ensure the test still constructs globalCatalogPopulationJob and calls
populateGlobalCatalog() before the verify.
🪄 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: 1e4e3939-1f8e-45bd-9f6c-6f95de151f83
📒 Files selected for processing (2)
src/main/java/com/p2ps/catalog/service/GlobalCatalogPopulationJob.javasrc/main/resources/application.properties
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/p2ps/ai/service/AiOrchestrationService.java`:
- Line 163: The equality check for recipeList uses response.getListType()
directly, which fails on surrounding whitespace; update the logic in
AiOrchestrationService where recipeList is set (the boolean recipeList =
"RECIPE".equalsIgnoreCase(response.getListType())) to trim the list type first
(e.g., obtain a trimmed value from response.getListType().trim() or call trim()
inline before equalsIgnoreCase) so values like " RECIPE " are normalized and the
RECIPE conversion path is not skipped.
🪄 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: 9a5c0704-af4e-41f3-924d-4f55ae21ae4a
📒 Files selected for processing (8)
src/main/java/com/p2ps/ai/service/AiOrchestrationService.javasrc/main/java/com/p2ps/ai/service/AiService.javasrc/main/java/com/p2ps/catalog/service/GlobalCatalogPopulationJob.javasrc/main/java/com/p2ps/catalog/service/ProductResolutionService.javasrc/main/java/com/p2ps/util/QuantityParser.javasrc/main/resources/application.propertiessrc/test/java/com/p2ps/ai/service/AiOrchestrationServiceTest.javasrc/test/java/com/p2ps/util/QuantityParserTest.java
✅ Files skipped from review due to trivial changes (1)
- src/main/resources/application.properties
|



Summary by CodeRabbit
Chores
New Features / Improvements
Tests