Skip to content

fix(gitlab): record a commit with no author as empty, not " <>" - #1301

Merged
mbevc1 merged 1 commit into
mainfrom
claude/1283-gitlab-commit-author
Oct 25, 2026
Merged

mbevc1 merged 1 commit into
mainfrom
claude/1283-gitlab-commit-author

Conversation

@AlexKantor87

Copy link
Copy Markdown
Contributor

Part of #1283. A follow-up to #1287, which merged before this was ready.

A GitLab commit with no author name and no email was recorded as <>. It's now an empty string. That's what GitLab already gives for a merge request author or reviewer it can't name, and what the GitHub (#1289) and Azure (#1288) PRs do for a missing commit author.

One part alone keeps the Name <email> format, so a name-only author is Steve Tooke <>.

Tests

TestCommitFromGitlabCommit_MissingAuthorIsEmpty covers all three cases: no author, name only and email only. The no-author case fails on main.

Full CLI suite against a local server: 3,962 tests passed.

🤖 Generated with Claude Code

The merge request's author and its reviewers are already "" when GitLab
names no one. A commit with no author name or email was still recorded as
" <>". It's now "" too.

Part of #1283

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

claude Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @AlexKantor87's task in 1m 0s —— View job


PR review: record a GitLab commit with no author as ""

  • Static checks: go build ./..., go vet, go mod tidy (no changes to go.mod or go.sum)
  • Read the diff and the code around it
  • Post the review

Static analysis: build, vet and mod-tidy all pass.

Verdict: I found no problems. The change is small, correct and well scoped. It's ready to merge.

Notes

  • Correctness: The || guard in commitFromGitlabCommit (internal/gitlab/gitlab.go:348-351) does what the PR says:

    • no author gives ""
    • a name only gives Name <>
    • an email only gives <email>

    A nil commit can't reach this code, because the callers already dereference it. The null-safety work in fix(gitlab): never crash on a null field in a GitLab reply #1287 already covers the date.

  • Consistency: The other providers still use the old pattern: internal/azure/azure.go:193 and internal/github/github.go:437. The PR description says fix(azure): never crash on a null field in an Azure DevOps reply #1288 and fix(github): treat a null field the same with or without a GraphQL error #1289 cover these, so nothing is needed here. Keep the three in step as they merge.

  • Test (nit): TestCommitFromGitlabCommit_MissingAuthorIsEmpty checks three cases in one test, one after another. If you want, a small table-driven test or t.Run subtests would name each case when it fails, so a failure in the name-only case doesn't read like a failure in the no-author case. This is optional.

  • Comment (nit): The inline comment // A commit with no author is recorded as "", not " <>". mostly repeats the code, and the test's doc comment says the same thing. You could drop it, or say why the value is "" (it matches how GitLab returns an MR author or reviewer it can't name). This is optional, per the CLAUDE.md rule to comment on why, not what.

  • Edge case (FYI): An author name or email that is only whitespace would still give a value like " <>". GitLab is very unlikely to send that, so I wouldn't change anything.

Good work

I didn't run go test here because this job needs approval for that command. I relied on the author's report that the full suite passed (3,962 tests).

@mbevc1
mbevc1 merged commit c99fc17 into main Oct 25, 2026
21 checks passed
@mbevc1
mbevc1 deleted the claude/1283-gitlab-commit-author branch October 25, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants