fix(compile): remove empty env block from executor step when no write permissions#407
Conversation
… permissions Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/e4d2855e-c0f7-4fc9-8214-5b9942c995dd Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
|
/rust-review |
|
✅ Rust PR Reviewer completed successfully! |
🔍 Rust PR ReviewSummary: Looks good — correct fix, well-tested, one misleading test comment worth noting. Findings
|
|
@copilot tests/compiler_tests.rs:3493 — The comment "serde_yaml rejects env: with no children in strict mode and the assert_valid_yaml call above already exercises this" is incorrect. env: null (bare env: key with no children) is valid YAML and serde_yaml will parse it without error. The assert_valid_yaml call does not catch this case. The structural assertion that follows (!executor_step_text.contains("env:")) is what actually validates the fix. The comment should be removed or corrected to avoid misleading future contributors. |
…validity Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/42b1fb99-3470-483e-acc3-99d1f8299528 Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Fixed in 69ab847. The comment now correctly states that a bare |
Summary
When
permissions.writeis absent, the "Execute safe outputs (Stage 3)" bash step emitted a bareenv:key with no children — invalid ADO pipeline YAML.Root cause:
generate_executor_ado_envreturned an empty string, but the templates unconditionally wrapped it in anenv:key, producing:Fix:
generate_executor_ado_env— returns the fullenv:block when a write service connection is set, empty string otherwise.replace_with_indenthandles base-indentation alignment automatically:base.yml/1es-base.yml— removed the bareenv:line;{{ executor_ado_env }}is now the sole marker on that line.docs/template-markers.md— updated to document that{{ executor_ado_env }}now emits the entire block or nothing.Test plan
generate_executor_ado_envto assert theenv:key is included in the non-empty output.compiler_tests.rs:test_executor_step_no_empty_env_block_without_write_permissions— compilesminimal-agent.md(no write perms), asserts noenv:key is present on the executor step. Note: a bareenv:with no children is valid YAML (parsed as null), soassert_valid_yamlalone does not catch this regression — the structural!executor_step_text.contains("env:")assertion is what guards against it.test_executor_step_has_env_block_with_write_permissions— compilescomplete-agent.md(with write perms), assertsSYSTEM_ACCESSTOKEN: $(SC_WRITE_TOKEN)appears under the executor step.