hive-sh4re: split approval-queue schema into its own topic module

This commit is contained in:
damocles 2026-08-10 22:27:36 +02:00 committed by mara
commit 02bbff1e34
17 changed files with 153 additions and 139 deletions

View file

@ -6,7 +6,8 @@
use std::sync::Arc;
use anyhow::{Context as _, Result, bail};
use hive_sh4re::{ApprovalKind, ApprovalStatus, HelperEvent};
use hive_sh4re::HelperEvent;
use hive_sh4re::approvals::{ApprovalKind, ApprovalStatus};
use crate::coordinator::Coordinator;
use crate::lifecycle;
@ -142,7 +143,7 @@ fn rollback_ref(approval_id: i64) -> String {
/// `pr` and `reviewed` are fields of the approval row the operator signed off
/// on — so re-reading is both cheap and the authoritative source of truth.
struct DeployCtx {
approval: hive_sh4re::Approval,
approval: hive_sh4re::approvals::Approval,
/// PR number, parsed from `approval.commit_ref`.
pr: u64,
/// The PR head sha the operator reviewed (`approval.fetched_sha`).
@ -410,7 +411,7 @@ const PR_FAIL_LOG_TAIL_BYTES: usize = 4000;
/// only the error text.
async fn post_merge_failure_to_pr(
coord: &Arc<Coordinator>,
approval: &hive_sh4re::Approval,
approval: &hive_sh4re::approvals::Approval,
err: &anyhow::Error,
) {
let Ok(pr) = approval.commit_ref.parse::<u64>() else {
@ -472,7 +473,7 @@ fn tail_bytes(s: &str, max_bytes: usize) -> String {
/// The worker takes over from here — fan-out at fire time.
async fn run_approval_schedule_prompt(
coord: &Coordinator,
approval: hive_sh4re::Approval,
approval: hive_sh4re::approvals::Approval,
) -> Result<()> {
let result: Result<()> = async {
let payload: hive_sh4re::SchedulePromptPayload = serde_json::from_str(&approval.commit_ref)
@ -598,7 +599,7 @@ fn fetch_approval_for_worker(
coord: &Coordinator,
approval_id: i64,
expected_kind: ApprovalKind,
) -> Result<hive_sh4re::Approval> {
) -> Result<hive_sh4re::approvals::Approval> {
let approval = coord
.approvals
.get(approval_id)
@ -641,7 +642,7 @@ async fn forge_after_first_spawn(coord: &Arc<Coordinator>, agent: &str) {
/// work that doesn't justify a queue card.
async fn run_approval_init_config(
coord: &Coordinator,
approval: hive_sh4re::Approval,
approval: hive_sh4re::approvals::Approval,
proposed_dir: std::path::PathBuf,
claude_dir: std::path::PathBuf,
notes_dir: std::path::PathBuf,
@ -681,7 +682,7 @@ async fn run_approval_init_config(
async fn finish_approval(
coord: &Coordinator,
approval: &hive_sh4re::Approval,
approval: &hive_sh4re::approvals::Approval,
result: Result<()>,
terminal_tag: Option<String>,
) -> Result<()> {