2026-04-26 21:30:55 +00:00
|
|
|
//! Concrete subscriber stubs for the event bus.
|
|
|
|
|
|
|
|
|
|
use super::Stage;
|
|
|
|
|
use super::events::{TransitionFired, TransitionSubscriber};
|
2026-04-27 16:35:25 +00:00
|
|
|
#[allow(unused_imports)]
|
2026-04-26 21:30:55 +00:00
|
|
|
use super::{event_label, stage_dir_name, stage_label};
|
|
|
|
|
|
|
|
|
|
// ── Subscriber stubs (real dispatch uses these as the interface) ─────────────
|
|
|
|
|
//
|
|
|
|
|
// These are ready to wire into the event bus but not yet connected to the
|
|
|
|
|
// actual subsystems. Suppress dead_code until consumers are migrated.
|
|
|
|
|
|
2026-04-29 10:41:32 +00:00
|
|
|
/// Subscriber that logs pipeline transitions to the Matrix bot channel.
|
2026-04-26 21:30:55 +00:00
|
|
|
#[allow(dead_code)]
|
|
|
|
|
pub struct MatrixBotSubscriber;
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
impl TransitionSubscriber for MatrixBotSubscriber {
|
|
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"matrix-bot"
|
|
|
|
|
}
|
|
|
|
|
fn on_transition(&self, f: &TransitionFired) {
|
|
|
|
|
crate::slog!(
|
|
|
|
|
"[pipeline/matrix-bot] #{}: {} → {}",
|
|
|
|
|
f.story_id,
|
|
|
|
|
stage_label(&f.before),
|
|
|
|
|
stage_label(&f.after)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 10:41:32 +00:00
|
|
|
/// Subscriber that re-renders the filesystem `work/` directory on stage transitions.
|
2026-04-26 21:30:55 +00:00
|
|
|
#[allow(dead_code)]
|
|
|
|
|
pub struct FileRendererSubscriber;
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
impl TransitionSubscriber for FileRendererSubscriber {
|
|
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"filesystem"
|
|
|
|
|
}
|
|
|
|
|
fn on_transition(&self, f: &TransitionFired) {
|
|
|
|
|
crate::slog!(
|
|
|
|
|
"[pipeline/filesystem] re-rendering work/{}/{}",
|
|
|
|
|
stage_dir_name(&f.after),
|
|
|
|
|
f.story_id
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 10:41:32 +00:00
|
|
|
/// Subscriber that writes stage updates to the pipeline-items data store.
|
2026-04-26 21:30:55 +00:00
|
|
|
#[allow(dead_code)]
|
|
|
|
|
pub struct PipelineItemsSubscriber;
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
impl TransitionSubscriber for PipelineItemsSubscriber {
|
|
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"pipeline-items"
|
|
|
|
|
}
|
|
|
|
|
fn on_transition(&self, f: &TransitionFired) {
|
|
|
|
|
crate::slog!(
|
|
|
|
|
"[pipeline/items] UPDATE stage = '{}' WHERE id = '{}'",
|
|
|
|
|
stage_dir_name(&f.after),
|
|
|
|
|
f.story_id
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 10:41:32 +00:00
|
|
|
/// Subscriber that promotes eligible backlog items when a story completes or is archived.
|
2026-04-26 21:30:55 +00:00
|
|
|
#[allow(dead_code)]
|
|
|
|
|
pub struct AutoAssignSubscriber;
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
impl TransitionSubscriber for AutoAssignSubscriber {
|
|
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"auto-assign"
|
|
|
|
|
}
|
|
|
|
|
fn on_transition(&self, f: &TransitionFired) {
|
2026-05-13 16:43:19 +00:00
|
|
|
if matches!(
|
|
|
|
|
f.after,
|
|
|
|
|
Stage::Done { .. }
|
|
|
|
|
| Stage::Archived { .. }
|
|
|
|
|
| Stage::Abandoned { .. }
|
|
|
|
|
| Stage::Superseded { .. }
|
|
|
|
|
| Stage::Rejected { .. }
|
|
|
|
|
) {
|
2026-04-26 21:30:55 +00:00
|
|
|
crate::slog!(
|
|
|
|
|
"[pipeline/auto-assign] story {} reached {}; checking for promotable backlog items",
|
|
|
|
|
f.story_id,
|
|
|
|
|
stage_label(&f.after)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 10:41:32 +00:00
|
|
|
/// Subscriber that broadcasts stage transitions to all connected WebSocket clients.
|
2026-04-26 21:30:55 +00:00
|
|
|
#[allow(dead_code)]
|
|
|
|
|
pub struct WebUiBroadcastSubscriber;
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
impl TransitionSubscriber for WebUiBroadcastSubscriber {
|
|
|
|
|
fn name(&self) -> &'static str {
|
|
|
|
|
"web-ui-broadcast"
|
|
|
|
|
}
|
|
|
|
|
fn on_transition(&self, f: &TransitionFired) {
|
|
|
|
|
crate::slog!(
|
|
|
|
|
"[pipeline/web-ui] broadcasting #{} transition to connected clients",
|
|
|
|
|
f.story_id
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|