fix(group_milestones): send include_descendants, decode project_id

What does this MR do?

ListGroupMilestonesOptions sends IncludeDescendents as include_descendents, but List group milestones reads include_descendants. GitLab ignores the misspelled key, so setting the option changes nothing. On gitlab.com, GET /groups/gitlab-org%2Fapi/milestones?include_descendants=true returns the three milestones of client-go, and the same request with include_descendents=true returns [], as it does with no option at all.

This MR fixes both tag halves and keeps the Go field name, so code that sets it still compiles.

With the option working, the list also returns the milestones of the projects in the group and its subgroups (group_project_params.rb). Those carry project_id and no group_id (entities/milestone.rb), so GroupMilestone gains ProjectID, as Milestone already has.

I found this while maintaining gitlab-mcp-server, which lists group milestones through this library and works around both gaps today. It keeps a record of what it finds in its dependencies in upstream-bugs.md.

Is this a breaking change?

No. No exported name or type changes, and gorelease against v3.40.0 reports no incompatible change; the one addition from this MR is GroupMilestone.ProjectID. A caller that sets IncludeDescendents now gets the descendants it asked for, and code that marshals ListGroupMilestonesOptions to JSON itself now sees the key include_descendants.

How was this tested?

  • TestGroupMilestonesService_ListGroupMilestones_IncludeDescendants asserts that the request is ?include_descendants=true and decodes a group milestone and a project milestone from one answer. On main it does not compile (no ProjectID); with the field added but the old tag it fails on the URL; with ProjectID not decoded it fails on the project milestone.
  • The steps of make reviewable with the .tool-versions pins (Go 1.26.6, gofumpt 0.8.0, golangci-lint 2.15.0, buf 1.55.1) change no file and pass, and go test -race work passes on Go 1.26.6 and 1.27.3.
  • No integration test: the two gitlab.com requests above show the behaviour, and gitlab_test/ has no group milestone tests yet.
The new test without and with the fix

With the field added but the old tag:

expected: "/api/v4/groups/5/milestones?include_descendants=true"
actual  : "/api/v4/groups/5/milestones?include_descendents=true"
--- FAIL: TestGroupMilestonesService_ListGroupMilestones_IncludeDescendants

With the fix:

--- PASS: TestGroupMilestonesService_ListGroupMilestones_IncludeDescendants

Merge request reports

Loading
Loading