Skip to content

feat: add --escalation-policy-id flag to services update#45

Merged
kwent merged 1 commit into
masterfrom
features/PRF-2820-service-escalation-policy-update
Jul 10, 2026
Merged

feat: add --escalation-policy-id flag to services update#45
kwent merged 1 commit into
masterfrom
features/PRF-2820-service-escalation-policy-update

Conversation

@kwent

@kwent kwent commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds --escalation-policy-id flag to rootly services update so CI/CD pipelines can attach or detach escalation policies on services without raw API calls (PRF-2820)
  • Empty string (--escalation-policy-id="") sends JSON null to detach; non-empty string attaches
  • Displays escalation policy ID in rootly services get detail view
  • Parses escalation_policy_id from API responses across all service methods (List, Get, Create, Update)

Test plan

  • go test ./internal/... — all 483 tests pass
  • go vet ./... — no issues
  • Manual: rootly services update <svc> --escalation-policy-id=<ep-id> then rootly services get <svc>
  • Manual: rootly services update <svc> --escalation-policy-id="" to verify detach

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds --escalation-policy-id to rootly services update, enabling CI/CD pipelines to attach or detach escalation policies on services without raw API calls. The empty-string-to-null detach convention is cleanly handled at the UpdateService layer rather than leaking into the command layer.

  • EscalationPolicyID is added to the Service struct and parsed consistently across all four service API methods (List, Get, Create, Update), so the field is always populated when the API returns it.
  • The cmd.Flags().Changed() guard correctly prevents the field from being sent on unrelated updates, and the UpdateService function converts empty string to JSON null for the detach path.
  • rootly services get conditionally displays the escalation policy ID in the detail view, consistent with how Color and OwnerTeamName are shown.

Confidence Score: 5/5

Safe to merge — the change is well-scoped, follows existing patterns throughout the codebase, and is covered by both API-level and command-level tests.

All four service API methods are updated consistently, the attach/detach logic is straightforward and tested with table-driven cases that assert on both the returned struct and the serialized request body, and no existing behavior is altered.

No files require special attention.

Important Files Changed

Filename Overview
internal/api/client.go Adds EscalationPolicyID to the Service struct and consistently parses it from all four service API methods (List, Get, Create, Update); the UpdateService function correctly converts empty string to JSON null for detach.
internal/cmd/services/update.go Adds --escalation-policy-id flag using cmd.Flags().Changed() to avoid sending the field unless explicitly set; correctly maps kebab-case flag name to snake_case opts key.
internal/cmd/services/get.go Adds EscalationPolicyID to the service detail view only when non-empty, consistent with how Color and OwnerTeamName are conditionally shown.
internal/api/client_mutations_test.go Adds table-driven test covering both attach (non-empty ID) and detach (empty string → null) cases, with assertions on both the returned struct field and the serialized request body.
internal/cmd/services/cmd_test.go Adds command-level tests for attach and detach flag scenarios; verifies error-free execution and non-empty output, consistent with existing cmd-test patterns.
internal/cmd/services/services_test.go Updates TestServiceDetailRows fixture to include EscalationPolicyID and asserts it appears in the detail rows under the "Escalation Policy" label.

Reviews (1): Last reviewed commit: "✨ feat: [PRF-2820] add --escalation-poli..." | Re-trigger Greptile

Allows attaching/detaching escalation policies on services via CLI,
closing a gap that forced CI/CD pipelines to fall back to raw API
calls. Empty string sends JSON null to detach; non-empty attaches.
Also displays escalation policy ID in `services get` detail view.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@kwent kwent force-pushed the features/PRF-2820-service-escalation-policy-update branch from 5f7b77d to 3d8587b Compare July 10, 2026 03:27
@kwent kwent merged commit 826a2f5 into master Jul 10, 2026
6 checks passed
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.

1 participant