feat: add billable event api and route token#1340
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds optional routeToken to route types and provider mappings, requests routes.routeToken from Google Maps for advanced directions, adds mobilityBillingUrl to Google config, introduces a MobilityBilling client and exported reportBillableEvent, and exposes the new module in the library. ChangesRoute Token Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 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.
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 `@lib/mobility-core/src/Kernel/External/Maps/Google/MobilityBilling.hs`:
- Around line 76-77: The logs currently emit raw billableEventId in the success
and error branches (the Right _ -> logInfo ... and Left err -> logError ...
calls); change those to log a redacted or hashed identifier instead — e.g.
compute a deterministic pseudonym like sha256(billableEventId) or mask all but
the last N characters and log that derived value (e.g. hashedId or maskedId)
along with the message and, in the error case, include show err; update both
places so no raw billableEventId is written to logs.
🪄 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: 5d58548a-81e7-4ead-a0b2-4834f2ecc950
📒 Files selected for processing (9)
lib/mobility-core/mobility-core.caballib/mobility-core/src/Kernel/External/Maps/Google/MapsClient.hslib/mobility-core/src/Kernel/External/Maps/Google/MapsClient/Types.hslib/mobility-core/src/Kernel/External/Maps/Google/MobilityBilling.hslib/mobility-core/src/Kernel/External/Maps/Interface/Google.hslib/mobility-core/src/Kernel/External/Maps/Interface/MMI.hslib/mobility-core/src/Kernel/External/Maps/Interface/NextBillion.hslib/mobility-core/src/Kernel/External/Maps/Interface/OSRM.hslib/mobility-core/src/Kernel/External/Maps/Interface/Types.hs
| Right _ -> logInfo $ "Reported Google mobility billable event for trip " <> billableEventId | ||
| Left err -> logError $ "Failed to report Google mobility billable event for trip " <> billableEventId <> ": " <> show err |
There was a problem hiding this comment.
Avoid logging raw billableEventId values in info/error logs.
These logs persist trip identifiers verbatim, which can create avoidable privacy/compliance exposure in centralized logging. Prefer redaction or hashing before logging.
Suggested patch
- case result of
- Right _ -> logInfo $ "Reported Google mobility billable event for trip " <> billableEventId
- Left err -> logError $ "Failed to report Google mobility billable event for trip " <> billableEventId <> ": " <> show err
+ let tripRef = "(redacted)"
+ case result of
+ Right _ -> logInfo $ "Reported Google mobility billable event for trip " <> tripRef
+ Left err -> logError $ "Failed to report Google mobility billable event for trip " <> tripRef <> ": " <> show err🤖 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/Maps/Google/MobilityBilling.hs` around
lines 76 - 77, The logs currently emit raw billableEventId in the success and
error branches (the Right _ -> logInfo ... and Left err -> logError ... calls);
change those to log a redacted or hashed identifier instead — e.g. compute a
deterministic pseudonym like sha256(billableEventId) or mask all but the last N
characters and log that derived value (e.g. hashedId or maskedId) along with the
message and, in the error case, include show err; update both places so no raw
billableEventId is written to logs.
a80eb34 to
4dc9c98
Compare
da63efe to
84a7942
Compare
Type of Change
Description
Additional Changes
Motivation and Context
How did you test it?
Checklist
./dev/format-all-files.shSummary by CodeRabbit
New Features
Updates