Skip to content

Normalize gitlabs opened and open states in issues and milestones#85

Open
vvsagar wants to merge 1 commit into
git-pkgs:mainfrom
vvsagar:bugfix/gitlab-opened
Open

Normalize gitlabs opened and open states in issues and milestones#85
vvsagar wants to merge 1 commit into
git-pkgs:mainfrom
vvsagar:bugfix/gitlab-opened

Conversation

@vvsagar
Copy link
Copy Markdown

@vvsagar vvsagar commented May 14, 2026

just like in prs

Copy link
Copy Markdown
Contributor

@andrew andrew left a comment

Choose a reason for hiding this comment

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

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 openactive.

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.

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