@@ -1692,14 +1692,22 @@ mod tests {
16921692 "/tmp/ado-aw-scripts/ado-script/gate.js" ,
16931693 )
16941694 . unwrap ( ) ;
1695- // Check export lines only (evaluator script always contains these strings)
1695+ // Verify tier-1 (pipeline-var only) checks do not export API-related env vars
1696+ // Look for the env: block exports (YAML format with leading spaces)
1697+ let lines: Vec < & str > = result. lines ( ) . collect ( ) ;
1698+ let has_repo_id_export = lines. iter ( ) . any ( |line| {
1699+ line. trim_start ( ) . starts_with ( "ADO_REPO_ID:" )
1700+ } ) ;
1701+ let has_pr_id_export = lines. iter ( ) . any ( |line| {
1702+ line. trim_start ( ) . starts_with ( "ADO_PR_ID:" )
1703+ } ) ;
16961704 assert ! (
1697- !result . contains ( "ADO_REPO_ID:" ) ,
1698- "should not export repo ID for title-only"
1705+ !has_repo_id_export ,
1706+ "should not export ADO_REPO_ID for title-only (tier-1) check "
16991707 ) ;
17001708 assert ! (
1701- !result . contains ( "ADO_PR_ID:" ) ,
1702- "should not export PR ID for title-only"
1709+ !has_pr_id_export ,
1710+ "should not export ADO_PR_ID for title-only (tier-1) check "
17031711 ) ;
17041712 }
17051713
@@ -1779,24 +1787,20 @@ mod tests {
17791787 let diags = validate_pr_filters ( & filters) ;
17801788 assert ! ( diags. iter( ) . all( |d| d. severity != Severity :: Error ) ) ;
17811789
1782- let step = compile_gate_step_external (
1790+ let _step = compile_gate_step_external (
17831791 GateContext :: PullRequest ,
17841792 & checks,
17851793 "/tmp/ado-aw-scripts/ado-script/gate.js" ,
17861794 )
17871795 . unwrap ( ) ;
1788- // Step structure
1789- assert ! ( step. contains( "ADO_PR_TITLE" ) ) ;
1790- assert ! ( step. contains( "ADO_REPO_ID" ) ) ; // for API-derived facts
1791- assert ! ( step. contains( "node" ) ) ;
1792- assert ! ( step. contains( "prGate" ) ) ;
17931796
1794- // Spec content
1797+ // Verify the spec captures all three filters with correct fact dependencies
17951798 let spec = build_gate_spec ( GateContext :: PullRequest , & checks) . unwrap ( ) ;
1796- assert_eq ! ( spec. checks. len( ) , 3 ) ;
1797- assert ! ( spec. facts. iter( ) . any( |f| f. kind == "pr_title" ) ) ;
1798- assert ! ( spec. facts. iter( ) . any( |f| f. kind == "pr_is_draft" ) ) ;
1799- assert ! ( spec. facts. iter( ) . any( |f| f. kind == "pr_labels" ) ) ;
1799+ assert_eq ! ( spec. checks. len( ) , 3 , "should produce 3 checks from 3 filters" ) ;
1800+ assert ! ( spec. facts. iter( ) . any( |f| f. kind == "pr_title" ) , "title filter requires pr_title fact" ) ;
1801+ assert ! ( spec. facts. iter( ) . any( |f| f. kind == "pr_is_draft" ) , "draft filter requires pr_is_draft fact" ) ;
1802+ assert ! ( spec. facts. iter( ) . any( |f| f. kind == "pr_labels" ) , "labels filter requires pr_labels fact" ) ;
1803+ assert ! ( spec. facts. iter( ) . any( |f| f. kind == "pr_metadata" ) , "API-derived facts should pull in pr_metadata dependency" ) ;
18001804 }
18011805
18021806 // ─── Schema tests ──────────────────────────────────────────────────
0 commit comments