Skip to content

Commit 0ec49cc

Browse files
feat(api/base): add PROMOTE merge strategy
## Summary ### Why? Stovepipe promotes an already-verified commit onto a verified branch (e.g. `verified/main`) as-is. The existing `REBASE`/`SQUASH_REBASE`/`MERGE` strategies cannot express this — they all transform the change and produce new revisions. We need a shared, VCS-neutral way for a client to ask Runway to advance a branch to an already-existing commit. ### What? Adds `PROMOTE` (= 4) to the shared `Strategy` enum in `api/base/mergestrategy` and the matching `MergeStrategyPromote` Go entity constant in `platform/base/mergestrategy`. `PROMOTE` means "integrate the exact revision as-is, with no content transform": each backend realizes it natively (git fast-forward, Mercurial bookmark advance, Subversion/Perforce copy), so a step's output revision is the same commit the request named rather than a freshly created one. The Runway merge-queue contract README gains a "Merge strategy" section documenting the semantics. This is contract + docs only — no producer or consumer wiring is added yet. ## Test Plan ✅ `make proto` (regenerated `api/base/mergestrategy/protopb`) ✅ `bazel build //api/base/mergestrategy/protopb //platform/base/mergestrategy` Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 3227a7a commit 0ec49cc

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

api/base/mergestrategy/proto/mergestrategy.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,8 @@ enum Strategy {
3636
SQUASH_REBASE = 2;
3737
// Merge commits into the target branch by creating a separate merge commit, preserving commit history along with hashes.
3838
MERGE = 3;
39+
// Integrate the exact revision as-is, with no content transform — advance the target branch to an already-existing
40+
// commit rather than producing new revisions. The implementer maps it to its backend: git fast-forward, Mercurial
41+
// bookmark advance, Subversion/Perforce copy. Used to promote an already-landed/verified commit onto another branch.
42+
PROMOTE = 4;
3943
}

api/base/mergestrategy/protopb/mergestrategy.pb.go

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

api/runway/messagequeue/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Payloads are defined as proto3 messages in [`proto/merge.proto`](proto/merge.pro
66

77
The shared field types `Change` and `MergeStrategy` come from `api/base/change` and `api/base/mergestrategy`, imported by the contract.
88

9+
## Merge strategy
10+
11+
Each `MergeStep` carries a `Strategy` (from `api/base/mergestrategy`) naming how that step is integrated into the target branch. `REBASE`, `SQUASH_REBASE`, and `MERGE` *transform* the change onto the branch tip and produce new revisions. `PROMOTE` is different: it integrates the exact revision **as-is**, advancing the target branch to an already-existing commit with no content transform and no new revision. Each backend realizes `PROMOTE` natively — git fast-forward, Mercurial bookmark advance, Subversion/Perforce copy — so for `PROMOTE` a step's `StepOutput.id` is the same revision the request named rather than a freshly created one. It is the strategy a post-merge verifier (e.g. Stovepipe) uses to advance a verified branch like `verified/main` to an already-landed, already-verified commit. `DEFAULT` lets the server pick per queue configuration.
12+
913
## Topic keys
1014

1115
The binding between a topic key and its payload lives in each message's `topic_keys` option (defined in `api/base/messagequeue`); `TopicKeys` reads it back by reflection. A topic key is a stable logical name, not a concrete wire topic — each implementer maps the key to whatever topic name its broker/queue requires. Our Go wiring maps it via `consumer.TopicRegistry`.

platform/base/mergestrategy/mergestrategy.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
// Package mergestrategy holds the shared source-control integration strategy
1616
// used across SubmitQueue, runway, and other repo-local domains. It names how a
17-
// change is integrated into the target branch (rebase, squash-rebase, merge).
17+
// change is integrated into the target branch (rebase, squash-rebase, merge,
18+
// promote).
1819
package mergestrategy
1920

2021
// MergeStrategy defines the possible source control integration methods.
@@ -29,4 +30,6 @@ const (
2930
MergeStrategySquashRebase MergeStrategy = "squash_rebase"
3031
// MergeStrategyMerge merges commits into the target branch by creating a separate merge commit, preserving the commit history along with hashes.
3132
MergeStrategyMerge MergeStrategy = "merge"
33+
// MergeStrategyPromote integrates the exact revision as-is, with no content transform — it advances the target branch to an already-existing commit rather than producing new revisions. The implementer maps it to its backend (git fast-forward, Mercurial bookmark advance, Subversion/Perforce copy). Used to promote an already-landed/verified commit onto another branch.
34+
MergeStrategyPromote MergeStrategy = "promote"
3235
)

0 commit comments

Comments
 (0)