fix(#2438): link config approval commit by full sha, not abbreviated

This commit is contained in:
damocles 2026-07-14 20:42:55 +02:00 committed by mara
commit bf657177d3
2 changed files with 16 additions and 2 deletions

View file

@ -354,10 +354,10 @@ export function renderApprovals() {
'↳ view diff');
diffBtn.addEventListener('click', () => openDiffPanel(a));
drill.append(diffBtn);
if (forgeBase && a.sha_short) {
if (forgeBase && a.sha_full) {
drill.append(el('a', {
class: 'panel-trigger', target: '_blank', rel: 'noopener',
href: `${forgeBase}/agent-configs/${a.agent}/commit/${a.sha_short}`,
href: `${forgeBase}/agent-configs/${a.agent}/commit/${a.sha_full}`,
title: 'this proposal commit on the hive forge',
}, '↳ commit on forge ↗'));
}

View file

@ -234,7 +234,15 @@ struct ApprovalView {
agent: String,
kind: &'static str,
/// First 12 chars of the `commit_ref`, for `ApplyCommit` only.
/// Display-only (the short chip on the card).
sha_short: Option<String>,
/// Full commit sha, for `ApplyCommit` only. The frontend builds the
/// "commit on forge" link from this rather than `sha_short`: forgejo
/// 404s an abbreviated sha for the proposal commit (it lives on a
/// `proposal/<id>` tag ref, which forgejo won't disambiguate a short
/// hash against), but resolves the full 40-char sha by direct lookup.
#[serde(skip_serializing_if = "Option::is_none")]
sha_full: Option<String>,
/// Raw unified diff text, for `ApplyCommit` only. The client splits
/// on `\n` and per-line classifies (`+` / `-` / `@@` / `--- ` / `+++ `
/// → diff-add / diff-del / diff-hunk / diff-file). Shipping raw
@ -584,6 +592,7 @@ async fn build_approval_views(approvals: Vec<Approval>) -> Vec<ApprovalView> {
agent: a.agent.clone(),
kind: "apply_commit",
sha_short: Some(sha),
sha_full: Some(displayed.to_owned()),
diff: Some(diff),
description: a.description,
pr_number: None,
@ -596,6 +605,7 @@ async fn build_approval_views(approvals: Vec<Approval>) -> Vec<ApprovalView> {
agent: a.agent,
kind: "spawn",
sha_short: None,
sha_full: None,
diff: None,
description: a.description,
pr_number: None,
@ -607,6 +617,7 @@ async fn build_approval_views(approvals: Vec<Approval>) -> Vec<ApprovalView> {
agent: a.agent,
kind: "init_config",
sha_short: None,
sha_full: None,
diff: None,
description: a.description,
pr_number: None,
@ -618,6 +629,7 @@ async fn build_approval_views(approvals: Vec<Approval>) -> Vec<ApprovalView> {
agent: a.agent,
kind: "update_meta_inputs",
sha_short: None,
sha_full: None,
diff: None,
description: a.description,
pr_number: None,
@ -629,6 +641,7 @@ async fn build_approval_views(approvals: Vec<Approval>) -> Vec<ApprovalView> {
agent: a.agent,
kind: "schedule_prompt",
sha_short: None,
sha_full: None,
diff: None,
description: a.description,
pr_number: None,
@ -651,6 +664,7 @@ async fn build_approval_views(approvals: Vec<Approval>) -> Vec<ApprovalView> {
agent: a.agent,
kind: "merge_config_pr",
sha_short: sha,
sha_full: None,
diff: None,
description: a.description,
pr_number,