Files
huskies/server/src/pipeline_state/mod.rs
T
2026-05-13 04:34:06 +00:00

70 lines
2.7 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! 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.
//!
//! ## 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
// Scaffolding types (AgentName, NodePubkey, ExecutionState, ExecutionEvent,
// execution_transition, apply_transition_str, to_crdt_fields, is_upcoming,
// MissingField/InvalidField) exist for stages 25 of story 934 and the
// per-node execution-state work; they are only exercised by tests today.
// Revisit and drop the allow once those stages land.
#![allow(dead_code)]
mod apply;
mod events;
mod projection;
mod subscribers;
mod transition;
mod types;
#[cfg(test)]
mod tests;
// ── Public re-exports ───────────────────────────────────────────────────────
#[allow(unused_imports)]
pub use types::{
AgentName, ArchiveReason, BranchName, ExecutionState, GitSha, NodePubkey, PipelineItem, Stage,
StoryId, TransitionError, stage_dir_name, stage_label,
};
#[allow(unused_imports)]
pub use transition::{
ExecutionEvent, PipelineEvent, event_label, execution_transition, transition,
};
#[allow(unused_imports)]
pub use events::{EventBus, TransitionFired, TransitionSubscriber};
#[allow(unused_imports)]
pub use projection::ProjectionError;
pub use projection::{read_all_typed, read_typed};
#[allow(unused_imports)]
pub use apply::{
ApplyError, apply_transition, apply_transition_str, transition_to_frozen,
transition_to_unfrozen,
};
#[allow(unused_imports)]
pub use subscribers::{
AutoAssignSubscriber, FileRendererSubscriber, MatrixBotSubscriber, PipelineItemsSubscriber,
WebUiBroadcastSubscriber,
};