huskies: merge 731_refactor_migrate_existing_stories_from_slug_based_ids_to_numeric_only
This commit is contained in:
@@ -333,12 +333,15 @@ pub(super) fn extract_item_view(item: &PipelineItemCrdt) -> Option<PipelineItemV
|
||||
/// according to CRDT state.
|
||||
///
|
||||
/// Returns `true` if the dependency is satisfied (item found in a done stage).
|
||||
/// Matches both legacy slug-form IDs (`"664_story_foo"`) and numeric-only IDs
|
||||
/// (`"664"`) so the check remains correct after the slug→numeric migration.
|
||||
/// See `dep_is_archived_crdt` to distinguish archive-satisfied from cleanly-done.
|
||||
pub fn dep_is_done_crdt(dep_number: u32) -> bool {
|
||||
use crate::pipeline_state::{Stage, read_all_typed};
|
||||
let exact = dep_number.to_string();
|
||||
let prefix = format!("{dep_number}_");
|
||||
read_all_typed().into_iter().any(|item| {
|
||||
item.story_id.0.starts_with(&prefix)
|
||||
(item.story_id.0 == exact || item.story_id.0.starts_with(&prefix))
|
||||
&& matches!(item.stage, Stage::Done { .. } | Stage::Archived { .. })
|
||||
})
|
||||
}
|
||||
@@ -348,11 +351,14 @@ pub fn dep_is_done_crdt(dep_number: u32) -> bool {
|
||||
///
|
||||
/// Used to detect when a dependency is satisfied via archive rather than via a clean
|
||||
/// completion through `5_done`. Returns `false` when the CRDT layer is not initialised.
|
||||
/// Matches both legacy slug-form IDs (`"664_story_foo"`) and numeric-only IDs (`"664"`).
|
||||
pub fn dep_is_archived_crdt(dep_number: u32) -> bool {
|
||||
use crate::pipeline_state::{Stage, read_all_typed};
|
||||
let exact = dep_number.to_string();
|
||||
let prefix = format!("{dep_number}_");
|
||||
read_all_typed().into_iter().any(|item| {
|
||||
item.story_id.0.starts_with(&prefix) && matches!(item.stage, Stage::Archived { .. })
|
||||
(item.story_id.0 == exact || item.story_id.0.starts_with(&prefix))
|
||||
&& matches!(item.stage, Stage::Archived { .. })
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user