Normalize gitlabs opened and open states in issues and milestones#85
Normalize gitlabs opened and open states in issues and milestones#85vvsagar wants to merge 1 commit into
Conversation
andrew
left a comment
There was a problem hiding this comment.
Thanks for spotting this. The issues change is right but the milestones change needs a different value.
Bug
gitlab/milestones.go maps to the wrong state. GitLab's list-milestones endpoint takes state=active or state=closed, not opened (docs). Sending opened is no better than sending open. The Update method in the same file already knows this, it uses state_event: "activate" to reopen. The List filter needs open → active.
Correct
gitlab/issues.go is right, GitLab issues do use opened/closed and this matches what prs.go already does.
Related (pre-existing, optional)
This fixes the request direction but the response direction is still leaky: convertGitLabIssue returns i.State raw, so callers get "opened" back. PRs normalize this to "open" (prs.go:40); issues should too. Same for convertGitLabMilestone which returns "active" raw. Not introduced here, but it's the same bug class and a 2-line fix while you're in there.
Tests
gitlab/issues_test.go exists; a case asserting the outgoing request has ?state=opened when opts.State == "open" would lock this in. A milestones_test.go checking for ?state=active would have caught the bug above.
just like in prs