Skip to content

Commit 3e00396

Browse files
authored
feat(runway): Add CommitMessageResolver interface for squash and merge commit metadata (#767)
## Why? Squash and merge commits need a message and author, and the source differs by deployment. OSS can use a synthetic message, while other deployments may pull richer metadata from their code review platform. Making it an injected dependency lets the unified merger stay provider- and deployment-agnostic. The merger will start using it in the next PR. ## What? Adds `merger.CommitMessageResolver` and `merger.CommitMessage` to `runway/extension/merger/`, plus a generated mock. The resolver returns the message and authorship for the change a URI names. ## Test Plan - `make check-gazelle`, `make check-tidy` and `make lint` pass. - `bazel build //runway/...` passes. - No behavior change, since nothing consumes the interface yet ## Issue
1 parent d873a7a commit 3e00396

4 files changed

Lines changed: 103 additions & 2 deletions

File tree

‎runway/extension/merger/BUILD.bazel‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ load("@rules_go//go:def.bzl", "go_library")
22

33
go_library(
44
name = "go_default_library",
5-
srcs = ["merger.go"],
5+
srcs = [
6+
"commit_message.go",
7+
"merger.go",
8+
],
69
importpath = "github.com/uber/submitqueue/runway/extension/merger",
710
visibility = ["//visibility:public"],
811
deps = ["//api/runway/messagequeue:go_default_library"],
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) 2026 Uber Technologies, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package merger
16+
17+
//go:generate mockgen -source=commit_message.go -destination=mock/commit_message_mock.go -package=mock
18+
19+
import "context"
20+
21+
// CommitMessage is the message and authorship recorded on a squash or merge
22+
// commit.
23+
type CommitMessage struct {
24+
// Message is the full commit message.
25+
Message string
26+
// AuthorName is the display name of the commit author.
27+
AuthorName string
28+
// AuthorEmail is the email address of the commit author.
29+
AuthorEmail string
30+
}
31+
32+
// CommitMessageResolver resolves the commit message and authorship for the
33+
// change named by a change URI. Implementations must be safe for concurrent
34+
// use.
35+
type CommitMessageResolver interface {
36+
// Resolve returns the commit message for the change identified by uri.
37+
Resolve(ctx context.Context, uri string) (CommitMessage, error)
38+
}

‎runway/extension/merger/mock/BUILD.bazel‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ load("@rules_go//go:def.bzl", "go_library")
22

33
go_library(
44
name = "go_default_library",
5-
srcs = ["merger_mock.go"],
5+
srcs = [
6+
"commit_message_mock.go",
7+
"merger_mock.go",
8+
],
69
importpath = "github.com/uber/submitqueue/runway/extension/merger/mock",
710
visibility = ["//visibility:public"],
811
deps = [

‎runway/extension/merger/mock/commit_message_mock.go‎

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)