huskies: merge 997
This commit is contained in:
@@ -348,7 +348,7 @@ pub(super) fn extract_item_view(item: &PipelineItemCrdt) -> Option<PipelineItemV
|
||||
JsonValue::String(s) if !s.is_empty() => s.parse::<crate::config::AgentName>().ok(),
|
||||
_ => None,
|
||||
};
|
||||
let retry_count = match item.retry_count.view() {
|
||||
let retry_count_register = match item.retry_count.view() {
|
||||
JsonValue::Number(n) if n >= 0.0 => n as u32,
|
||||
_ => 0u32,
|
||||
};
|
||||
@@ -411,6 +411,7 @@ pub(super) fn extract_item_view(item: &PipelineItemCrdt) -> Option<PipelineItemV
|
||||
claim_agent.as_deref(),
|
||||
claim_ts_secs,
|
||||
plan_state_str.as_deref(),
|
||||
retry_count_register,
|
||||
)?;
|
||||
|
||||
Some(PipelineItemView {
|
||||
@@ -418,7 +419,6 @@ pub(super) fn extract_item_view(item: &PipelineItemCrdt) -> Option<PipelineItemV
|
||||
stage,
|
||||
name,
|
||||
agent,
|
||||
retry_count,
|
||||
depends_on,
|
||||
qa_mode,
|
||||
item_type,
|
||||
@@ -439,6 +439,7 @@ pub(super) fn extract_item_view(item: &PipelineItemCrdt) -> Option<PipelineItemV
|
||||
/// before the typed projection. This keeps remote ops from older nodes (and
|
||||
/// raw-CRDT test inserts that bypass `migrate_legacy_stage_strings`) from
|
||||
/// silently disappearing from the typed read path.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn project_stage_for_view(
|
||||
stage_str: &str,
|
||||
story_id: &str,
|
||||
@@ -447,6 +448,7 @@ fn project_stage_for_view(
|
||||
claim_agent: Option<&str>,
|
||||
claim_ts_secs: Option<u64>,
|
||||
plan_state_str: Option<&str>,
|
||||
retries: u32,
|
||||
) -> Option<crate::pipeline_state::Stage> {
|
||||
use crate::pipeline_state::{
|
||||
AgentClaim, AgentName, ArchiveReason, BranchName, GitSha, PlanState, Stage,
|
||||
@@ -482,6 +484,7 @@ fn project_stage_for_view(
|
||||
.unwrap_or(Stage::Coding {
|
||||
claim: None,
|
||||
plan: PlanState::Missing,
|
||||
retries: 0,
|
||||
}),
|
||||
)
|
||||
};
|
||||
@@ -504,6 +507,7 @@ fn project_stage_for_view(
|
||||
"coding" => Some(Stage::Coding {
|
||||
claim,
|
||||
plan: PlanState::from_str(plan_state_str.unwrap_or("")),
|
||||
retries,
|
||||
}),
|
||||
"qa" => Some(Stage::Qa),
|
||||
"blocked" => Some(Stage::Blocked {
|
||||
@@ -513,6 +517,7 @@ fn project_stage_for_view(
|
||||
feature_branch: BranchName(format!("feature/story-{story_id}")),
|
||||
commits_ahead: NonZeroU32::new(1).expect("1 is non-zero"),
|
||||
claim,
|
||||
retries,
|
||||
}),
|
||||
"merge_failure" => {
|
||||
// Story 986: read the typed kind directly from ContentKey::MergeFailureKind
|
||||
@@ -675,7 +680,7 @@ mod tests {
|
||||
|
||||
let item_json: JsonValue = json!({
|
||||
"story_id": "40_story_view",
|
||||
"stage": "qa",
|
||||
"stage": "2_current",
|
||||
"name": "View Test",
|
||||
"agent": "coder-1",
|
||||
"retry_count": 2.0,
|
||||
@@ -691,10 +696,13 @@ mod tests {
|
||||
|
||||
let view = extract_item_view(&crdt.doc.items[0]).unwrap();
|
||||
assert_eq!(view.story_id, "40_story_view");
|
||||
assert!(matches!(view.stage, crate::pipeline_state::Stage::Qa));
|
||||
assert!(matches!(
|
||||
view.stage,
|
||||
crate::pipeline_state::Stage::Coding { .. }
|
||||
));
|
||||
assert_eq!(view.name, "View Test");
|
||||
assert_eq!(view.agent.map(|a| a.as_str()), Some("coder-1"));
|
||||
assert_eq!(view.retry_count, 2u32);
|
||||
assert_eq!(view.retry_count(), 2u32);
|
||||
assert_eq!(view.depends_on, vec![10u32, 20u32]);
|
||||
}
|
||||
|
||||
@@ -749,7 +757,6 @@ mod tests {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
|
||||
// The story is live on this node.
|
||||
@@ -817,7 +824,6 @@ mod tests {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
assert!(
|
||||
read_item(story_id).is_none(),
|
||||
|
||||
Reference in New Issue
Block a user