Commit 7fe562f
fix(compile): graceful-degradation bug + cleanup per PR review
Address two findings from the Rust PR Reviewer bot on PR #873.
1. CRITICAL — AW_AZ_MOUNTS undefined when az is missing:
The runtime-detection step in AzureCliExtension only set the
AW_AZ_MOUNTS pipeline variable in the detected branch. In the
missing-az branch the variable was left undefined. ADO leaves an
undefined $(VAR) as the LITERAL STRING "$(VAR)" in subsequent bash
steps (it does NOT expand to empty). Bash sees $(AW_AZ_MOUNTS),
interprets it as a $(...) command substitution, tries to execute
a program named AW_AZ_MOUNTS, gets exit 127, and the AWF
invocation step dies under `set -e` — the exact 1ES failure mode
the refactor set out to prevent.
Fix: always emit `##vso[task.setvariable variable=AW_AZ_MOUNTS]`,
with an empty value in the missing branch. ADO then expands
$(AW_AZ_MOUNTS) to nothing and the trailing `\` line becomes a
harmless continuation no-op.
Regression guards (both lock this in):
- azure_cli.rs::test_azure_cli_prepare_steps_defines_aw_az_mounts_in_else_branch
counts `setvariable` occurrences (must be 2) and asserts the
else block contains an empty-value setvariable line.
- compiler_tests.rs::test_default_pipeline_mounts_az_and_allows_azure_hosts
asserts the same 2× count on the compiled lock.yml.
2. Cleanup — delete WRITE_REQUIRING_SAFE_OUTPUTS:
The const was retained with #[allow(dead_code)] after the
removal of `validate_write_permissions`, but its only consumers
left were the two tests that exercised the const itself. Each
`*Result` type already carries `REQUIRES_WRITE: bool` for any
caller (compiler, audit, runtime) that needs the same info.
Deleting the const removes a dead-code annotation and one
otherwise-purposeless list to maintain when adding new tools.
Test cleanup: removed `test_write_requiring_subset_of_all_known`
(purely exercised the deleted const) and rewrote
`test_all_known_completeness` to use a HashSet-based duplicate
check on ALL_KNOWN_SAFE_OUTPUTS plus the ALWAYS_ON/NON_MCP
disjointness check (preserves the meaningful invariants).
Validation:
- cargo build: clean
- cargo test: 1748 unit + 119 compiler + all integration pass
- cargo clippy --all-targets --all-features -- -D warnings: clean
- tests/safe-outputs/azure-cli.lock.yml regenerated (+1 line)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 74206d8 commit 7fe562f
4 files changed
Lines changed: 97 additions & 70 deletions
File tree
- src
- compile/extensions
- safeoutputs
- tests
- safe-outputs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
32 | 39 | | |
33 | 40 | | |
34 | 41 | | |
| |||
107 | 114 | | |
108 | 115 | | |
109 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
110 | 126 | | |
111 | 127 | | |
112 | 128 | | |
| |||
116 | 132 | | |
117 | 133 | | |
118 | 134 | | |
| 135 | + | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
| |||
240 | 257 | | |
241 | 258 | | |
242 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
243 | 305 | | |
244 | 306 | | |
245 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | 29 | | |
65 | 30 | | |
66 | 31 | | |
| |||
810 | 775 | | |
811 | 776 | | |
812 | 777 | | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | 778 | | |
825 | 779 | | |
826 | 780 | | |
| |||
876 | 830 | | |
877 | 831 | | |
878 | 832 | | |
879 | | - | |
880 | | - | |
| 833 | + | |
| 834 | + | |
881 | 835 | | |
882 | 836 | | |
883 | | - | |
884 | | - | |
885 | | - | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
886 | 842 | | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
893 | | - | |
| 843 | + | |
| 844 | + | |
894 | 845 | | |
895 | 846 | | |
896 | 847 | | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
897 | 852 | | |
898 | 853 | | |
899 | 854 | | |
900 | 855 | | |
901 | 856 | | |
902 | 857 | | |
903 | 858 | | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | 859 | | |
914 | 860 | | |
915 | 861 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4577 | 4577 | | |
4578 | 4578 | | |
4579 | 4579 | | |
| 4580 | + | |
| 4581 | + | |
| 4582 | + | |
| 4583 | + | |
| 4584 | + | |
| 4585 | + | |
| 4586 | + | |
| 4587 | + | |
| 4588 | + | |
| 4589 | + | |
| 4590 | + | |
| 4591 | + | |
| 4592 | + | |
| 4593 | + | |
| 4594 | + | |
| 4595 | + | |
| 4596 | + | |
| 4597 | + | |
4580 | 4598 | | |
4581 | 4599 | | |
4582 | 4600 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments