Skip to content

feat: [CDS-125698]: implement GitOps delete endpoint mappings and par…#614

Open
Him7n wants to merge 1 commit into
harness:mainfrom
Him7n:CDS-125698
Open

feat: [CDS-125698]: implement GitOps delete endpoint mappings and par…#614
Him7n wants to merge 1 commit into
harness:mainfrom
Him7n:CDS-125698

Conversation

@Him7n

@Him7n Him7n commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Add DELETE operations for GitOps resources

Summary

Adds delete operations to six GitOps resource types that previously only supported list and get, and adds 13 tests covering path mapping, query param forwarding, and validation behaviour.


Resources updated

Resource Path
gitops_agent DELETE /gitops/api/v1/agents/{agentIdentifier}
gitops_application DELETE /gitops/api/v1/agents/{agentIdentifier}/applications/{appName}
gitops_applicationset DELETE /gitops/api/v1/applicationset/{identifier}
gitops_cluster DELETE /gitops/api/v1/agents/{agentIdentifier}/clusters/{clusterIdentifier}
gitops_repository DELETE /gitops/api/v1/agents/{agentIdentifier}/repositories/{repoIdentifier}
gitops_repo_credential DELETE /gitops/api/v1/agents/{agentIdentifier}/repocreds/{credentialId}

All operations are risk: "destructive", retryPolicy: "do_not_retry" and go through the standard elicitation flow before execution.


Notable design decisions

gitops_agent — raw identifier, not scope-prefixed

Unlike all other GitOps agent-based APIs where agentIdentifier is scope-prefixed (account.myagent, org.myagent), the agent management API uses the raw identifier in the path. Scope is derived server-side from orgIdentifier / projectIdentifier in the query — the resource_scope param drives that injection. The description and paramsSchema document this distinction explicitly.

gitops_cluster — immutable resource_id vs. mutable query_name

The {clusterIdentifier} path segment is the immutable internal identifier and does not change when a cluster is renamed in the UI. The query.name query param carries the current ArgoCD display name and must match when the cluster has been renamed. Both are documented in the operation description with guidance on how to obtain each from a prior harness_list.

gitops_repositoryforce_delete safety valve

The backend blocks deletion when a repository is still referenced by active GitOps applications. force_delete=true bypasses this check. The param is optional (defaults to false) and its intent is documented in the operation description and paramsSchema.


Files changed

  • src/registry/toolsets/gitops.ts — delete operations added to six resource definitions
  • tests/registry/gitops.test.ts — 13 new tests
image

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

Checklist

  • pnpm test passes
  • pnpm typecheck passes
  • pnpm build passes
  • pnpm standards:check passes (architecture guardrails — see docs/coding-standards.md)
  • pnpm docs:check passes (if registry/tool counts changed)

Coding Standards (registry-driven MCP model)

If this PR adds or changes Harness API coverage:

  • No new server.registerTool() calls — only toolset definitions in src/registry/toolsets/
  • Toolset registered in ALL_TOOLSETS and ToolsetName union
  • operationPolicy on every new/changed endpoint
  • Shared response extractors from src/registry/extractors.ts (no raw passthrough on real endpoints)
  • identifierFields and scope declared on new resources
  • No console.log() in src/ (stdio JSON-RPC safety)

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