[CSM Integration Service] Add new Go service for third-party account/project search - #1202
Conversation
…ID and user-id-token forwarding)
…ojects, contacts)
|
Warning Review limit reached
Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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 Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds a Go CSM Integration Service exposing account and project APIs, forwarding requests to an OAuth2-authenticated entity service with correlation and optional user-token propagation, standardized validation and error handling, middleware, OpenAPI definitions, configuration, documentation, and tests. ChangesCSM Integration Service
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant CSMIntegrationService
participant EntityClient
participant OAuth2TokenEndpoint
participant EntityService
Client->>CSMIntegrationService: Send account or project request
CSMIntegrationService->>EntityClient: Validate and delegate with request context
EntityClient->>OAuth2TokenEndpoint: Request client-credentials token
OAuth2TokenEndpoint-->>EntityClient: Return access token
EntityClient->>EntityService: Forward authenticated request
EntityService-->>EntityClient: Return JSON or upstream error
EntityClient-->>CSMIntegrationService: Return response bytes or mapped error
CSMIntegrationService-->>Client: Return JSON response
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Purpose
Third-party (M2M) consumers need a way to search accounts and projects (and their contacts) without going through the CSM Portal's own end-user-facing backend. This adds a new, standalone service scoped to exactly that.
Goals
x-user-id-token, for consumers that need entity-service's ServiceNow-backed operations (which require a forwarded end-user identity and reject M2M-only requests)Approach
operations/csm-integration-service, modeled onapps/csm-portal/backend's entity-client/handler pattern (internal/entity,internal/handler,internal/middleware), stripped of end-user JWT concerns since this service has a different consumer/trust model[]byteJSON passthrough — no reshaping of upstream responses, matching this backend family's conventionSecurityHeaders → CorrelationID → UserIDToken → Logger. Correlation IDs are tagged with acis-prefix (generated or forwarded) so logs are easy to trace back to this serviceopenapi.yamlscoped to the 6 real endpoints +/health, published as the contract for Choreo's Developer PortalUser stories
As a third-party integrator, I can search accounts and projects (and their contacts) through a dedicated M2M API, without needing any CSM Portal end-user credentials.
Release note
Added a new service, CSM Integration Service, exposing account/project search and contacts to third-party M2M consumers.
Documentation
N/A —
openapi.yamlandCLAUDE.mdin the new service directory are the primary docs; no external doc surface affected yet.Automation tests
internal/entity(86% coverage),internal/handler(93.1%),internal/middleware(79.5%) — OAuth2 client-credentials flow, upstream error mapping/truncation, correlation ID generation/prefixing, optionalx-user-id-tokenpass-through, full request validation (path params, body size, JSON shape)Security checks
gosecinstead, 0 issues; seeREADME.md)Test environment
go vet ./...,go build ./...,go test -race ./...all passing locally (Go 1.26)Summary by CodeRabbit
/health, account, project, and contact-search endpoints.x-user-id-tokenpass-through.