Skip to content

feat: add approval policies and server-task approvals support#426

Merged
octopus-hideaki merged 6 commits into
mainfrom
hideakimurakami/si-260-octopus-approvals
Jul 15, 2026
Merged

feat: add approval policies and server-task approvals support#426
octopus-hideaki merged 6 commits into
mainfrom
hideakimurakami/si-260-octopus-approvals

Conversation

@octopus-hideaki

Copy link
Copy Markdown
Contributor

What & why

Adds Go client support for the Octopus Approvals feature (server-side gated by OctopusApprovalsFeatureToggle), which was built in the server and TypeScript client but never ported here. Precursor for SI-260 / SI-222 (Terraform provider support) and a planned approvals CLI.

Changes

pkg/approvalpolicies/ — the reusable approval-policy configuration resource (Settings > Approvals):

  • ApprovalPolicy resource with Tag/Id scoping (ApprovalPolicyTagScope, ApprovalPolicyIdScope), approving users/teams, MinimumApproversRequired, AllowSelfApproval, IsDisabled.
  • CRUD: GetByID, Get (paginated), GetAll, Add, Update, DeleteByID — modern newclient functional style (no root-document link; routes built from a {spaceId} template).

pkg/approvals/ — the runtime side (for reading approval status and submitting decisions, e.g. from a CLI):

  • ServerTaskApproval + ChangeRequest, the richer by-task ServerTaskApprovalDetail, and Approval (individual Approved/Rejected + notes) with the ApprovalStatus and ChangeRequestApprovalState enums.
  • GetByTaskID (nullable envelope → (nil,nil)), GetByID, Get, GetAll, ListApprovals (bare array), GetApprovalByID, AddApproval, UpdateApproval.

Faithful to the API contract: AllowSelfApproval/IsDisabled are exposed directly (no inversion), and no BFF endpoints are included.

Testing

  • Unit tests for parameter validation and JSON (de)serialization in both packages (go test ./pkg/approvalpolicies/... ./pkg/approvals/...).
  • Validated end-to-end against a live instance with the feature toggle enabled, driven through the Terraform provider (SI-222): approval-policy create/read/update/delete all confirmed. The live run surfaced and fixed a bug where GetAll omitted the server-required skip/take query parameters (HTTP 400).

🤖 Generated with Claude Code

octopus-hideaki and others added 6 commits July 15, 2026 10:02
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The approval policies list endpoint requires the skip and take query
parameters; the generic paginated helper omits them, so GetAll was
rejected with HTTP 400 by the server. Route GetAll through Get with a
max take instead. Verified end-to-end against a live instance.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@mik-ky mik-ky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally. Looks good 👍

@octopus-hideaki
octopus-hideaki merged commit de61ff1 into main Jul 15, 2026
6 checks passed
@octopus-hideaki
octopus-hideaki deleted the hideakimurakami/si-260-octopus-approvals branch July 15, 2026 22:12
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