huskies: merge 520_story_typed_pipeline_state_machine_in_rust_foundation_replaces_stringly_typed_crdt_views_with_strict_enums_subsumes_436
This commit is contained in:
@@ -33,15 +33,17 @@ fn move_item<'a>(
|
||||
fields_to_clear: &[&str],
|
||||
) -> Result<Option<&'a str>, String> {
|
||||
// Check if the item is already in the target stage or a done stage.
|
||||
if let Some(item) = crate::crdt_state::read_item(story_id) {
|
||||
if item.stage == target_dir
|
||||
|| extra_done_dirs.iter().any(|d| item.stage == *d)
|
||||
// Use the typed projection for compile-safe stage comparison.
|
||||
if let Ok(Some(typed_item)) = crate::pipeline_state::read_typed(story_id) {
|
||||
let current_dir = typed_item.stage.dir_name();
|
||||
if current_dir == target_dir
|
||||
|| extra_done_dirs.contains(¤t_dir)
|
||||
{
|
||||
return Ok(None); // Idempotent: already there.
|
||||
}
|
||||
|
||||
// Verify it's in one of the expected source stages.
|
||||
let src_dir = sources.iter().find(|&&s| item.stage == s).copied();
|
||||
let src_dir = sources.iter().find(|&&s| current_dir == s).copied();
|
||||
if src_dir.is_none() && !missing_ok {
|
||||
let locs = sources
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user