Skip to content

Add OnCall types and Service.GetOnCalls for incident routing#619

Merged
saditya370 merged 1 commit into
mainfrom
feat/service-on-call
May 12, 2026
Merged

Add OnCall types and Service.GetOnCalls for incident routing#619
saditya370 merged 1 commit into
mainfrom
feat/service-on-call

Conversation

@saditya370
Copy link
Copy Markdown
Contributor

Summary

Surfaces the currently on-call person(s) for a service via the Go SDK. Required so the OpsLevel MCP server can answer incident-response questions like "who's on-call for the payments service right now?". Pairs with the backend PR that exposed Service.onCalls publicly on the GraphQL schema (linked below).

Part 2 of OpsLevel GitLab issue 14711 (gap 1 — users tool tags/teams — was #614).

Changes

on_call.go (new)

  • OnCall{ExternalEmail, Id, Name, User *UserId}. Matches the deployed GraphQL OnCall type.
  • OnCallConnection — standard connection with Edges, Nodes, PageInfo, TotalCount.
  • OnCallEdge{Cursor, Node *OnCall}.

service.go

  • New field on Service: OnCalls *OnCallConnection with graphql:"-" — intentionally excluded from auto-fetch in ListServices to avoid N+1 (the backend has an open follow-up on the user resolver inside OnCallType, flagged during the schema PR review).
  • New method Service.GetOnCalls(client, variables) (*OnCallConnection, error). Standard per-service fetcher with pagination follow-through, mirroring Service.GetTags style.

service_test.go

  • TestGetServiceOnCalls — mock query + response with two on-call nodes (one mapping to an OpsLevel user, one with only externalEmail), asserts field population and nil-handling for User.
  • TestGetServiceOnCallsInvalidServiceId — asserts the empty-id guard error.

Design decisions

@saditya370 saditya370 self-assigned this May 11, 2026
@saditya370 saditya370 requested a review from andrewstillv15 May 11, 2026 17:41
@saditya370 saditya370 merged commit a69f1ce into main May 12, 2026
4 checks passed
@saditya370 saditya370 deleted the feat/service-on-call branch May 12, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants