LEGLINK-620: raise an audit event when a vendor changes - #1791
Conversation
LEGLINK-63 requires changes to leave an audit trail, and vendor mutations left none: VendorManager had no audit wiring at all, so associating or rotating a signing key was invisible after the fact. Create, update and delete now emit through CreateAuditEventCommand, the same path FacilityManager uses. An update records the transition explicitly, null to a secret id on association and back to null on clearing, which is the trail the story asks for. Recording it in plain text is safe: the value is the secret's name, not the key. The Kafka key is the vendor id and FacilityId is left unset, since a vendor is not facility scoped and the Audit service treats FacilityId as optional. Two departures from FacilityManager. Property changes are compared field by field rather than through CompareLogic, which on a Vendor would walk the VendorVersions navigation and report noise, and which gives no way to tell that nothing changed -- an update altering neither name nor key now emits nothing. And the command is called directly rather than wrapped in Task.Run: it is already async void, so the wrapper adds nondeterminism without concurrency, and calling it directly is what makes the behaviour testable. Tests assert on emitted messages through a recording producer in the fixture, polling briefly because async void leaves nothing to await. Claude-Session: https://claude.ai/code/session_01QoUHyt1ALkruCbuYxHSXiB
ef169a7 to
8a23b56
Compare
|
Warning Review limit reached
Next review available in: 58 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. 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: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ 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 |
🛠️ Description of Changes
Added auditing
🧪 Testing Performed
Tested locally
🧑🔬 Unit Testing
📓 Documentation Updated
Please update any relevant sections in the project documentation that were impacted by the changes in the PR.