refactor(workflow): drop Concluded.run_id and pushed_branch

Both fields were derivable from run_options (run_options.run_id and
run_options.git.as_ref().and_then(|g| g.run_branch.clone())), so they
were a second place to keep in sync with the canonical source.

Drop both from Concluded, populate Finalized's copies from run_options
at the pull_request phase boundary. Add RunOptions::run_branch() helper
so the "reach into optional git opts" pattern reads as a single call.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-04-24 08:57:50 -04:00
parent 35763dc437
commit b01e08a52d
No known key found for this signature in database
4 changed files with 13 additions and 14 deletions

View file

@ -374,10 +374,8 @@ pub async fn finalize(retroed: Retroed, options: &FinalizeOptions) -> Result<Con
}
Ok(Concluded {
run_id: run_options.run_id,
outcome,
conclusion,
pushed_branch: run_options.git.as_ref().and_then(|g| g.run_branch.clone()),
graph,
run_options,
services,

View file

@ -503,10 +503,8 @@ pub async fn maybe_open_pull_request(
/// completes.
pub async fn pull_request(concluded: Concluded, options: &PullRequestOptions) -> Finalized {
let Concluded {
run_id,
outcome,
conclusion,
pushed_branch,
graph,
run_options,
services,
@ -526,7 +524,7 @@ pub async fn pull_request(concluded: Concluded, options: &PullRequestOptions) ->
let diff = load_pull_request_diff(&services.run_store).await;
if let (Some(base_branch), Some(run_branch), Some(creds), Some(origin)) = (
&run_options.base_branch,
pushed_branch.as_deref(),
run_options.run_branch(),
&options.github_app,
&options.origin_url,
) {
@ -584,10 +582,10 @@ pub async fn pull_request(concluded: Concluded, options: &PullRequestOptions) ->
}
Finalized {
run_id,
run_id: run_options.run_id,
outcome,
conclusion,
pushed_branch,
pushed_branch: run_options.run_branch().map(str::to_string),
pr_url,
}
}

View file

@ -297,13 +297,11 @@ pub struct Retroed {
/// Output of the FINALIZE phase.
#[non_exhaustive]
pub struct Concluded {
pub run_id: RunId,
pub outcome: Result<Outcome, Error>,
pub conclusion: Conclusion,
pub pushed_branch: Option<String>,
pub graph: Graph,
pub run_options: RunOptions,
pub services: Arc<RunServices>,
pub outcome: Result<Outcome, Error>,
pub conclusion: Conclusion,
pub graph: Graph,
pub run_options: RunOptions,
pub services: Arc<RunServices>,
}
/// Output of the PULL_REQUEST phase.

View file

@ -57,6 +57,11 @@ impl RunOptions {
pub fn artifact_globs(&self) -> Vec<String> {
self.settings.run.artifacts.include.clone()
}
/// Run branch name from git checkpoint options, if set.
pub fn run_branch(&self) -> Option<&str> {
self.git.as_ref().and_then(|g| g.run_branch.as_deref())
}
}
/// Options for sandbox lifecycle management within the engine.