[Customer Entity] feat(cases): map domain enums to SN numeric IDs for cases/search filters - #868
Conversation
… cases/search filters The ServiceNow integration service expects stateKeys, severityKeys, and issueTypeKeys as integer arrays. Previously these filters were not forwarded at all; the SN payload only carried projectIds, deploymentIds, and caseTypes. Added lookup maps keyed on domain enums and three converter helpers so SearchCases now translates the incoming stateKeys, priorityKeys, and issueTypeKeys into the correct numeric IDs before calling the SN endpoint. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 53 minutes and 34 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesServiceNow Case Search Filter Extension
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 `@entity-service/internal/service/sn_case_service.go`:
- Around line 127-132: The snSeverityIDMap is missing an entry for
domain.CasePriorityCatastrophic, causing it to be silently skipped during
severity mapping. This results in empty severityKeys at line 297 and due to
omitempty the filter is completely omitted, broadening results. Add the missing
domain.CasePriorityCatastrophic entry to snSeverityIDMap at lines 127-132 with
the appropriate ServiceNow severity ID, or alternatively modify
domainPrioritiesToSNIDs at lines 154-162 to fail fast (return an error) when
encountering an unmapped priority value instead of skipping it silently, so
callers receive explicit feedback if an unsupported priority is requested rather
than getting unfiltered results.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6124c10a-c591-4f61-9f59-a0a5a15d4ed9
📒 Files selected for processing (1)
entity-service/internal/service/sn_case_service.go
…has no SN severity equivalent Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
stateKeys,severityKeys, andissueTypeKeysas integer arrays in thePOST /cases/searchpayloadprojectIds,deploymentIds, andcaseTypeswere forwarded to SNsnStateIDMap,snSeverityIDMap,snIssueTypeIDMap) keyed on domain enums with IDs sourced from the SN metadata responsedomainStatesToSNIDs,domainPrioritiesToSNIDs,domainIssueTypesToSNIDs) that translate incoming domain enum slices to[]int, skipping any unmapped valuesSearchCasesnow populatesstateKeys,severityKeys, andissueTypeKeysin the SN payloadTest plan
POST /cases/searchwithstateKeys: ["open", "work_in_progress"]— verify only matching state IDs (1, 10) appear in the SN requestpriorityKeys: ["critical", "high"]— verify SN receivesseverityKeys: [10, 11]issueTypeKeys: ["error", "total_outage"]— verify SN receivesissueTypeKeys: [6, 1]stateKeys/severityKeys/issueTypeKeysare omitted from the SN payload (omitempty)projectIds,deploymentIds,searchQuery) still work as before🤖 Generated with Claude Code
Summary by CodeRabbit