Skip to content

Commit d4e0b5c

Browse files
test: improve assertions in summary.rs and agentic_pipeline.rs (#1075)
- from_pipeline_round_trips_jobs_and_graph: add env_refs[0].name, condition_refs[0].step, condition_refs[0].name, and prod_step.outputs[0].name assertions (previously only counts / auto_is_output flag were checked, leaving regressions on which step/output is referenced invisible) - serializes_to_json_without_panicking: rename to serialized_json_contains_schema_version_and_shape so the name reflects that it validates specific JSON fields, not merely that serialization doesn't panic - fold_agent_conditions_preserves_clause_order: add diagnostic message - parse_env_block_bails_on_malformed_yaml: correct comment — the invalid input has the stray ':' in the value, not in the key - split_yaml_step_sequence_multiple_steps_without_blank_line_separator: add starts_with("- bash:") format checks for both chunks, matching the single-step sibling test Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 29d2a2e commit d4e0b5c

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/compile/agentic_pipeline.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,7 +2222,7 @@ mod tests {
22222222
];
22232223
let cond = fold_agent_conditions(&clauses).unwrap();
22242224
let Condition::And(parts) = cond else {
2225-
panic!()
2225+
panic!("expected And, got {cond:?}")
22262226
};
22272227
assert_eq!(parts.len(), 4);
22282228
assert!(matches!(parts[0], Condition::Succeeded));
@@ -2255,9 +2255,10 @@ mod tests {
22552255

22562256
#[test]
22572257
fn parse_env_block_bails_on_malformed_yaml() {
2258-
// Stray `:` inside a bare key would make this fail to parse as
2259-
// a mapping. The previous silent `return Vec::new()` swallowed
2260-
// this — the typed Result surface should bail loudly.
2258+
// `KEY: : value` is ambiguous/invalid YAML: the bare value
2259+
// starts with `: `, which the YAML parser cannot interpret as
2260+
// a plain scalar. Callers should never produce such a block,
2261+
// so the typed Result surface should bail loudly.
22612262
let err = parse_env_block("env:\n KEY: : value\n").unwrap_err();
22622263
let msg = format!("{err:#}");
22632264
assert!(
@@ -2303,6 +2304,8 @@ mod tests {
23032304
let yaml = "- bash: echo first\n displayName: First\n- bash: echo second\n displayName: Second\n";
23042305
let chunks = split_yaml_step_sequence(yaml).unwrap();
23052306
assert_eq!(chunks.len(), 2, "got chunks: {chunks:?}");
2307+
assert!(chunks[0].starts_with("- bash:"), "chunk[0]: {}", chunks[0]);
2308+
assert!(chunks[1].starts_with("- bash:"), "chunk[1]: {}", chunks[1]);
23062309
assert!(chunks[0].contains("First"));
23072310
assert!(chunks[1].contains("Second"));
23082311
}

src/compile/ir/summary.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,10 @@ mod tests {
705705
let step = &agent.steps[0];
706706
assert_eq!(step.env_refs.len(), 1);
707707
assert_eq!(step.env_refs[0].step, "synthPr");
708+
assert_eq!(step.env_refs[0].name, "AW_SYNTHETIC_PR_ID");
708709
assert_eq!(step.condition_refs.len(), 1);
710+
assert_eq!(step.condition_refs[0].step, "synthPr");
711+
assert_eq!(step.condition_refs[0].name, "AW_SYNTHETIC_PR_ID");
709712
// Graph derived a job edge Agent -> Setup
710713
assert!(
711714
s.graph
@@ -715,14 +718,15 @@ mod tests {
715718
"expected derived edge Agent -> Setup, got {:?}",
716719
s.graph.job_edges
717720
);
718-
// Producer output is marked auto_is_output
721+
// Producer output is marked auto_is_output — verify it's the right output
719722
let setup = jobs.iter().find(|j| j.id == "Setup").unwrap();
720723
let prod_step = &setup.steps[0];
724+
assert_eq!(prod_step.outputs[0].name, "AW_SYNTHETIC_PR_ID");
721725
assert!(prod_step.outputs[0].auto_is_output);
722726
}
723727

724728
#[test]
725-
fn serializes_to_json_without_panicking() {
729+
fn serialized_json_contains_schema_version_and_shape() {
726730
let p = fixture_pipeline();
727731
let s = PipelineSummary::from_pipeline(&p).unwrap();
728732
let json = serde_json::to_string(&s).unwrap();

0 commit comments

Comments
 (0)