backend/fix: Making detected imageType optional#1301
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 (2)
WalkthroughThis change makes image type detection optional: ChangesOptional image type detection
🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
🧹 Nitpick comments (1)
lib/mobility-core/src/Kernel/External/Verification/Interface/Idfy.hs (1)
293-301: 💤 Low valueConsider logging unknown doc types instead of silently dropping.
The new
Nothingfallback is correct and a clear improvement over silently misclassifying asVehicleRegistrationCertificate. However, since the upstream Idfy API may introduce newdetected_doc_typecodes over time, silently mapping them toNothingmakes it hard to detect coverage gaps. Consider emitting a warning log (or metric) inmkValidateImageRespwhengetImageTypereturnsNothingfor a non-emptydetected_doc_typeso unsupported types surface in observability.🤖 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 `@lib/mobility-core/src/Kernel/External/Verification/Interface/Idfy.hs` around lines 293 - 301, The fallback in getImageType currently returns Nothing for unknown detected_doc_type values; update mkValidateImageResp to emit a warning (or metric) whenever getImageType returns Nothing but the original detected_doc_type string is non-empty so unsupported upstream types are observable; locate where mkValidateImageResp calls getImageType, check the source field (e.g., detected_doc_type) and add a processLogger/warn/metrics call including the raw detected_doc_type and any relevant context (request id/user id) so operators can detect coverage gaps.
🤖 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.
Nitpick comments:
In `@lib/mobility-core/src/Kernel/External/Verification/Interface/Idfy.hs`:
- Around line 293-301: The fallback in getImageType currently returns Nothing
for unknown detected_doc_type values; update mkValidateImageResp to emit a
warning (or metric) whenever getImageType returns Nothing but the original
detected_doc_type string is non-empty so unsupported upstream types are
observable; locate where mkValidateImageResp calls getImageType, check the
source field (e.g., detected_doc_type) and add a processLogger/warn/metrics call
including the raw detected_doc_type and any relevant context (request id/user
id) so operators can detect coverage gaps.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 35193c9d-91de-4923-80f2-112a30efb16a
📒 Files selected for processing (2)
lib/mobility-core/src/Kernel/External/Verification/Interface/Idfy.hslib/mobility-core/src/Kernel/External/Verification/Interface/Types.hs
963556e to
091bba7
Compare
Type of Change
Description
Additional Changes
Motivation and Context
How did you test it?
Checklist
./dev/format-all-files.shSummary by CodeRabbit