From 658812c26352c8989cfcf7d8175f4b60323cae63 Mon Sep 17 00:00:00 2001 From: damocles Date: Tue, 23 Jun 2026 14:20:10 +0200 Subject: [PATCH] feat(#1940): expose pr_number on approvalview for merge_config_pr --- hive-c0re/src/dashboard.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hive-c0re/src/dashboard.rs b/hive-c0re/src/dashboard.rs index a09ece5f..a321b31e 100644 --- a/hive-c0re/src/dashboard.rs +++ b/hive-c0re/src/dashboard.rs @@ -441,6 +441,13 @@ struct ApprovalView { /// Manager-supplied description shown on the approval card. #[serde(skip_serializing_if = "Option::is_none")] description: Option, + /// Forge PR number, for `MergeConfigPr` only. Lets the frontend + /// build a "review PR on forge" link + /// (`{forgeBase}/agent-configs/{agent}/pulls/{pr_number}`) the same + /// way it builds the `apply_commit` "commit on forge" link from the + /// sha. `None` for every other kind. + #[serde(skip_serializing_if = "Option::is_none")] + pr_number: Option, /// Unix seconds the approval was queued. Rendered as a relative /// time on the card so the operator can spot a stale request. requested_at: i64, @@ -901,6 +908,7 @@ async fn build_approval_views(approvals: Vec) -> Vec { sha_short: Some(sha), diff: Some(diff), description: a.description, + pr_number: None, requested_at: a.requested_at, } } @@ -911,6 +919,7 @@ async fn build_approval_views(approvals: Vec) -> Vec { sha_short: None, diff: None, description: a.description, + pr_number: None, requested_at: a.requested_at, }, hive_sh4re::ApprovalKind::InitConfig => ApprovalView { @@ -920,6 +929,7 @@ async fn build_approval_views(approvals: Vec) -> Vec { sha_short: None, diff: None, description: a.description, + pr_number: None, requested_at: a.requested_at, }, hive_sh4re::ApprovalKind::UpdateMetaInputs => ApprovalView { @@ -929,6 +939,7 @@ async fn build_approval_views(approvals: Vec) -> Vec { sha_short: None, diff: None, description: a.description, + pr_number: None, requested_at: a.requested_at, }, hive_sh4re::ApprovalKind::SchedulePrompt => ApprovalView { @@ -938,6 +949,7 @@ async fn build_approval_views(approvals: Vec) -> Vec { sha_short: None, diff: None, description: a.description, + pr_number: None, requested_at: a.requested_at, }, hive_sh4re::ApprovalKind::MergeConfigPr => { @@ -948,6 +960,9 @@ async fn build_approval_views(approvals: Vec) -> Vec { .fetched_sha .as_deref() .map(|s| s[..s.len().min(12)].to_owned()); + // Surface the PR number so the frontend can link to the + // PR on the forge. commit_ref holds the number as text. + let pr_number = a.commit_ref.parse::().ok(); ApprovalView { id: a.id, agent: a.agent, @@ -955,6 +970,7 @@ async fn build_approval_views(approvals: Vec) -> Vec { sha_short: sha, diff: None, description: a.description, + pr_number, requested_at: a.requested_at, } }