-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add NATS lookup function for v1-v2 mapping queries #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implements lfx.lookup_v1_mapping NATS function for bidirectional v1↔v2 ID mapping lookups as specified in LFXV2-1011. Key features: - Queue-based subscription using natsConn.QueueSubscribe pattern - Bidirectional lookup support (v1→v2 and v2→v1) - Error handling with 'error: ' prefixed responses - Empty string responses for not found/tombstoned mappings - Comprehensive documentation in README.md with lookup patterns table - Support for projects, committees, and committee members The function receives mapping keys as request payload and returns corresponding values from NATS KV store, enabling efficient lookups across the sync helper ecosystem. 🤖 Generated with [GitHub Copilot](https://github.com/features/copilot) (via Zed) Signed-off-by: Eric Searcy <[email protected]>
Signed-off-by: Eric Searcy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a NATS request/reply function (lfx.lookup_v1_mapping) that enables bidirectional lookup of v1↔v2 ID mappings for projects, committees, and committee members. The implementation adds a scalable queue subscription handler that queries the existing v1-mappings NATS KV bucket and returns the mapped value, empty string for not found/deleted cases, or error messages for failures.
Changes:
- Added NATS queue subscription for the
lfx.lookup_v1_mappingsubject with scalable request handling - Implemented lookup handler with proper error handling, tombstone support, and consistent logging
- Documented the API with comprehensive lookup pattern tables and response format specifications
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/lfx-v1-sync-helper/main.go | Added constants for queue and subject names, and registered the QueueSubscribe handler for the lookup function |
| cmd/lfx-v1-sync-helper/lookup_handler.go | New handler implementing bidirectional mapping lookups with error handling and tombstone support |
| README.md | Added comprehensive NATS API documentation including request/reply format, lookup patterns table, and error handling guide |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Eric Searcy <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Eric Searcy <[email protected]>
bramwelt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good. There's two CI issues I see from Megalinter:
- Missing package comment
- stdlib security vulnerability: This appears to be an issue with megalinter, as we have Golang set to 1.25.6 in the go.mod file.
The first is a simple fix - I can approve once that's added. The second is unrelated and can be address in a separate PR (may take some fighting with megalinter).
|
Thanks for the review—PTAL again. (Yeah, I also tried bumping the Megalinter release (this one is pinned) and it still didn't help.) edited to say - I just realized my push hadn't gone through yet when I requested the review, but the commit is there now (366a48c) for the missing package comment |
Adds the standard package comment 'The lfx-v1-sync-helper service.' to maintain consistency with other files in the project. 🤖 Generated with [GitHub Copilot](https://github.com/features/copilot) (via Zed) Signed-off-by: Eric Searcy <[email protected]>
|
and now grype isn't complaining about stdlib, either. 🤷 |
Description
Implements
lfx.lookup_v1_mappingNATS function for bidirectional v1↔v2 ID mapping lookups as specified in LFXV2-1011.Changes
Core Implementation
natsConn.QueueSubscribepattern for scalable request handling"error: {message}"for NATS/service errors, empty string for not foundFiles Changed
cmd/lfx-v1-sync-helper/main.go: Added subscription tolfx.lookup_v1_mappingsubjectcmd/lfx-v1-sync-helper/lookup_handler.go: New handler implementing the lookup logicREADME.md: Comprehensive documentation with lookup patterns table and error handling guideSupported Lookup Patterns
project.sfid.{v1_sfid}↔project.uid.{v2_uuid}committee.sfid.{v1_sfid}↔committee.uid.{v2_uuid}committee_member.sfid.{v1_sfid}↔committee_member.uid.{v2_uuid}Technical Details
The function:
v1-mappingsNATS KV bucketTesting
JIRA
LFXV2-1011: Create NATS lookup function for v1-v2 mapping