huskies: merge 513_story_startup_reconcile_pass_that_detects_drift_between_crdt_pipeline_items_and_filesystem_shadows
This commit is contained in:
@@ -15,6 +15,7 @@ mod llm;
|
||||
pub mod log_buffer;
|
||||
pub mod rebuild;
|
||||
mod state;
|
||||
mod startup_reconcile;
|
||||
mod store;
|
||||
mod workflow;
|
||||
pub(crate) mod pipeline_state;
|
||||
@@ -303,6 +304,20 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
if let Err(e) = crdt_state::init(db_path).await {
|
||||
slog!("[crdt] Failed to initialise CRDT state layer: {e}");
|
||||
}
|
||||
// Run the startup drift-reconcile pass now that both the CRDT and DB are
|
||||
// initialised. The pass is cheap (~100 stories < 1 s) and opt-out via
|
||||
// `reconcile_on_startup = false` in project.toml.
|
||||
let reconcile_enabled = db_path
|
||||
.parent()
|
||||
.and_then(|p| p.parent())
|
||||
.and_then(|root| config::ProjectConfig::load(root).ok())
|
||||
.map(|cfg| cfg.reconcile_on_startup)
|
||||
.unwrap_or(true);
|
||||
if reconcile_enabled
|
||||
&& let Some(project_root) = db_path.parent().and_then(|p| p.parent())
|
||||
{
|
||||
startup_reconcile::reconcile_state(project_root, db_path).await;
|
||||
}
|
||||
}
|
||||
|
||||
// Import any existing .huskies/work/ stories into the DB content store.
|
||||
|
||||
Reference in New Issue
Block a user