2026-04-09 21:24:11 +00:00
|
|
|
//! Typed pipeline state machine (story 520).
|
|
|
|
|
//!
|
|
|
|
|
//! Replaces the stringly-typed CRDT views with strict Rust enums so that
|
|
|
|
|
//! impossible states (e.g. `Stage::Merge` with zero commits, a "done" story
|
|
|
|
|
//! with no merge metadata) are unrepresentable at compile time.
|
|
|
|
|
//!
|
|
|
|
|
//! The CRDT stays loose at the persistence layer — that's what makes it merge
|
|
|
|
|
//! correctly across nodes. Every consumer above the CRDT operates on these
|
|
|
|
|
//! strict typed enums, bridged by the projection layer (`TryFrom` / `From`).
|
|
|
|
|
//!
|
|
|
|
|
//! This is a foundation module: the types, transitions, projection layer, and
|
|
|
|
|
//! event bus are fully defined and tested here. Consumers will be migrated to
|
|
|
|
|
//! the typed API incrementally in follow-up stories.
|
2026-04-28 20:56:22 +00:00
|
|
|
//!
|
|
|
|
|
//! ## Module layout
|
|
|
|
|
//! - [`types`] — newtypes, `Stage`, `ExecutionState`, `PipelineItem`, errors, label helpers
|
|
|
|
|
//! - [`transition`] — `PipelineEvent`, `ExecutionEvent`, `transition`, `execution_transition`
|
|
|
|
|
//! - [`events`] — `EventBus`, `TransitionFired`, `TransitionSubscriber`
|
|
|
|
|
//! - [`projection`] — CRDT → typed projection layer (`read_typed`, `read_all_typed`)
|
|
|
|
|
//! - [`subscribers`] — concrete subscriber stubs
|
2026-04-09 21:24:11 +00:00
|
|
|
|
2026-04-27 16:35:25 +00:00
|
|
|
// Some items are exercised by tests or used only in non-active code paths;
|
|
|
|
|
// the dead_code lint is suppressed for the module.
|
|
|
|
|
#![allow(dead_code)]
|
2026-04-09 21:24:11 +00:00
|
|
|
|
2026-04-29 17:38:38 +00:00
|
|
|
mod apply;
|
2026-04-28 20:56:22 +00:00
|
|
|
mod events;
|
|
|
|
|
mod projection;
|
|
|
|
|
mod subscribers;
|
|
|
|
|
mod transition;
|
|
|
|
|
mod types;
|
2026-04-09 21:24:11 +00:00
|
|
|
|
2026-04-28 20:56:22 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests;
|
2026-04-09 21:24:11 +00:00
|
|
|
|
2026-04-28 20:56:22 +00:00
|
|
|
// ── Public re-exports ───────────────────────────────────────────────────────
|
2026-04-09 21:24:11 +00:00
|
|
|
|
2026-04-28 20:56:22 +00:00
|
|
|
#[allow(unused_imports)]
|
|
|
|
|
pub use types::{
|
|
|
|
|
AgentName, ArchiveReason, BranchName, ExecutionState, GitSha, NodePubkey, PipelineItem, Stage,
|
|
|
|
|
StoryId, TransitionError, stage_dir_name, stage_label,
|
|
|
|
|
};
|
2026-04-09 21:24:11 +00:00
|
|
|
|
2026-04-28 20:56:22 +00:00
|
|
|
#[allow(unused_imports)]
|
|
|
|
|
pub use transition::{
|
|
|
|
|
ExecutionEvent, PipelineEvent, event_label, execution_transition, transition,
|
|
|
|
|
};
|
2026-04-09 21:24:11 +00:00
|
|
|
|
2026-04-27 16:35:25 +00:00
|
|
|
#[allow(unused_imports)]
|
2026-04-26 21:30:55 +00:00
|
|
|
pub use events::{EventBus, TransitionFired, TransitionSubscriber};
|
2026-04-28 20:56:22 +00:00
|
|
|
|
2026-04-27 16:35:25 +00:00
|
|
|
#[allow(unused_imports)]
|
|
|
|
|
pub use projection::{ProjectionError, project_stage};
|
|
|
|
|
pub use projection::{read_all_typed, read_typed};
|
2026-04-28 20:56:22 +00:00
|
|
|
|
2026-04-29 17:38:38 +00:00
|
|
|
#[allow(unused_imports)]
|
2026-04-29 22:12:23 +00:00
|
|
|
pub use apply::{
|
|
|
|
|
ApplyError, apply_transition, apply_transition_str, transition_to_frozen,
|
|
|
|
|
transition_to_unfrozen,
|
|
|
|
|
};
|
2026-04-29 17:38:38 +00:00
|
|
|
|
2026-04-27 16:35:25 +00:00
|
|
|
#[allow(unused_imports)]
|
2026-04-26 21:30:55 +00:00
|
|
|
pub use subscribers::{
|
|
|
|
|
AutoAssignSubscriber, FileRendererSubscriber, MatrixBotSubscriber, PipelineItemsSubscriber,
|
|
|
|
|
WebUiBroadcastSubscriber,
|
|
|
|
|
};
|