From 7db3f455545060bb4f5fe9304b4c65c3e1e40618 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 14:08:44 +0000 Subject: [PATCH] test: fix vacuous/incorrect indentation tests and remove 3 low-value yaml-only tests in compiler_tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - test_debug_pipeline_probe_step_indentation_standalone: the for-loop never asserted that the displayName line was actually found, so it silently passed even when the probe step was absent. Additionally the search string used escaped double-quotes ("Verify MCP backends") but the compiled YAML emits the value unquoted, and the expected indent constant was 8 but the actual output uses 4 spaces. Rewrote to use find()+expect() with the correct search string and indent. - test_debug_pipeline_probe_step_indentation_1es: same two bugs. Expected indent was 18; actual is 12. Fixed search string and constant. - test_standalone_complete_compiled_output_is_valid_yaml: sole body was assert_valid_yaml — merged into test_standalone_complete_agent_has_ setup_and_teardown_jobs which already compiles the same fixture. - test_pr_filter_tier1_compiled_output_is_valid_yaml: same pattern — merged assert_valid_yaml into test_pr_filter_tier1_has_evaluator_gate. - test_pr_filter_tier2_compiled_output_is_valid_yaml: same pattern — merged assert_valid_yaml into test_pr_filter_tier2_has_extension_gate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/compiler_tests.rs | 74 ++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 46 deletions(-) diff --git a/tests/compiler_tests.rs b/tests/compiler_tests.rs index 1811158f..925507fa 100644 --- a/tests/compiler_tests.rs +++ b/tests/compiler_tests.rs @@ -3851,19 +3851,13 @@ fn test_standalone_minimal_compiled_output_is_valid_yaml() { ); } -/// Test that the complete standalone fixture produces valid YAML -#[test] -fn test_standalone_complete_compiled_output_is_valid_yaml() { - let compiled = compile_fixture("complete-agent.md"); - assert_valid_yaml(&compiled, "complete-agent.md"); -} - /// Test that the complete standalone fixture emits Setup/Teardown jobs and /// that the agentic task waits on Setup. The fixture has `setup:`, /// `teardown:`, and `post-steps:` sections so all three should appear. #[test] fn test_standalone_complete_agent_has_setup_and_teardown_jobs() { let compiled = compile_fixture("complete-agent.md"); + assert_valid_yaml(&compiled, "complete-agent.md"); assert!( compiled.contains("- job: Setup"), "Should generate Setup job: {compiled}" @@ -4061,19 +4055,18 @@ fn test_debug_pipeline_probe_step_indentation_standalone() { let compiled = compile_fixture_with_flags("minimal-agent.md", &["--debug-pipeline"]); // The probe step should be a proper YAML step at the same indent level as - // other steps in the Agent job. Find the "- bash:" line and check indent. - for line in compiled.lines() { - if line.contains("displayName: \"Verify MCP backends\"") { - let indent = line.len() - line.trim_start().len(); - // Standalone jobs use 8 spaces for step properties - assert_eq!( - indent, 8, - "Verify MCP backends displayName should be at 8 spaces indent in standalone, got {}", - indent - ); - break; - } - } + // other steps in the Agent job. Find the displayName line and check indent. + // Standalone jobs use 4 spaces for step properties. + let line = compiled + .lines() + .find(|l| l.contains("displayName: Verify MCP backends")) + .expect("Should find 'Verify MCP backends' displayName in compiled output"); + let indent = line.len() - line.trim_start().len(); + assert_eq!( + indent, 4, + "Verify MCP backends displayName should be at 4 spaces indent in standalone, got {}", + indent + ); } /// Test that debug probe step indentation is correct in 1ES output @@ -4081,33 +4074,27 @@ fn test_debug_pipeline_probe_step_indentation_standalone() { fn test_debug_pipeline_probe_step_indentation_1es() { let compiled = compile_fixture_with_flags("1es-test-agent.md", &["--debug-pipeline"]); - for line in compiled.lines() { - if line.contains("displayName: \"Verify MCP backends\"") { - let indent = line.len() - line.trim_start().len(); - // 1ES uses 18 spaces for step properties inside templateContext - assert_eq!( - indent, 18, - "Verify MCP backends displayName should be at 18 spaces indent in 1ES, got {}", - indent - ); - break; - } - } + // 1ES uses 12 spaces for step properties inside templateContext. + let line = compiled + .lines() + .find(|l| l.contains("displayName: Verify MCP backends")) + .expect("Should find 'Verify MCP backends' displayName in 1ES compiled output"); + let indent = line.len() - line.trim_start().len(); + assert_eq!( + indent, 12, + "Verify MCP backends displayName should be at 12 spaces indent in 1ES, got {}", + indent + ); } // ─── PR Filter Integration Tests ──────────────────────────────────────────── -/// Tier 1 PR filter fixture produces valid YAML with inline gate step. -#[test] -fn test_pr_filter_tier1_compiled_output_is_valid_yaml() { - let compiled = compile_fixture("pr-filter-tier1-agent.md"); - assert_valid_yaml(&compiled, "pr-filter-tier1-agent.md"); -} - /// Tier 1 PR filters use the bundled Node evaluator via extension. +/// Also verifies the compiled output is valid YAML. #[test] fn test_pr_filter_tier1_has_evaluator_gate() { let compiled = compile_fixture("pr-filter-tier1-agent.md"); + assert_valid_yaml(&compiled, "pr-filter-tier1-agent.md"); assert!( compiled.contains("- job: Setup"), @@ -4305,17 +4292,12 @@ fn test_node_runtime_install_orders_after_ado_script_so_user_version_wins() { ); } -/// Tier 2 PR filter fixture produces valid YAML. -#[test] -fn test_pr_filter_tier2_compiled_output_is_valid_yaml() { - let compiled = compile_fixture("pr-filter-tier2-agent.md"); - assert_valid_yaml(&compiled, "pr-filter-tier2-agent.md"); -} - /// Tier 2 PR filters produce a Setup job with extension-based gate step. +/// Also verifies the compiled output is valid YAML. #[test] fn test_pr_filter_tier2_has_extension_gate() { let compiled = compile_fixture("pr-filter-tier2-agent.md"); + assert_valid_yaml(&compiled, "pr-filter-tier2-agent.md"); assert!( compiled.contains("- job: Setup"),