Fail docs checks without a conclusive outcome - #19155
Conversation
There was a problem hiding this comment.
Pull request overview
Adds fail-closed validation for documentation workflow outcomes.
Changes:
- Validates agent results against the triggering PR and created docs PR.
- Adds unit and CLI exit-code tests.
- Improves invalid-outcome comments and regenerates the workflow.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.github/workflows/pr-docs-check/validate_outcome.py |
Implements outcome validation. |
.github/workflows/pr-docs-check/test_validate_outcome.py |
Tests validation and exit codes. |
.github/workflows/pr-docs-check.md |
Adds validation job and comment handling. |
.github/workflows/pr-docs-check.lock.yml |
Regenerates the compiled workflow. |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19155Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19155" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
.github/workflows/pr-docs-check.md:408
- The generic invalid-outcome warning is still bypassed for some duplicate notifications. If the first duplicate reports
drafted, the earlierelse if (result === 'drafted')runs (even whendraftUrlis present) and falsely says the PR could not be confirmed;draft_failedsimilarly selects its specific branch. Gate those result-specific failure branches onnotifications.length === 1so duplicate outcomes reach this internally-inconsistent warning.
} else {
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
.github/workflows/pr-docs-check.md:385
- A
draft_failednotification can still claim that no docs PR was drafted whencreated_pr_urlis nonempty. That combination is internally inconsistent, so this branch should also require!draftUrl; otherwise the source PR receives the specific “could not be drafted” message instead of the generic invalid-outcome warning. Regenerate the lock workflow after updating the source.
} else if (notifications.length === 1 && result === 'draft_failed') {
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
.github/workflows/pr-docs-check.md:339
- Invalid or mismatched
source_pr_numbervalues return before the comment body is built, so the source PR receives no warning even though the PR description says invalid outcomes render warning text. SinceexpectedNumberis trusted and is already used as the destination, carry a notification-validity flag into the result branches and let these cases fall through to the warning body instead of returning.
if (notifications.length === 1) {
const agentNumber = item.source_pr_number;
if (!Number.isInteger(agentNumber) || agentNumber <= 0 || agentNumber > 10_000_000) {
core.warning(`Invalid source_pr_number from agent: ${item.source_pr_number}; skipping comment.`);
return;
.github/workflows/pr-docs-check/validate_outcome.py:74
- When
draft_failedis paired with a nonempty trusted PR URL, this reports that no PR was created even though the validator is rejecting an internally inconsistent outcome. Distinguish that case so the failure annotation identifies the actual contradiction.
if result == "draft_failed":
raise OutcomeValidationError(
"Documentation was required, but no docs PR was created."
)
This comment has been minimized.
This comment has been minimized.
Adam Ratzman (adamint)
left a comment
There was a problem hiding this comment.
I think the privileged reviewer path and contradictory-result validation above should be fixed before merge. The validator otherwise behaved correctly across the exercised success and failure matrix.
This comment has been minimized.
This comment has been minimized.
7e3c522 to
51576f5
Compare
This comment has been minimized.
This comment has been minimized.
8df1aaa to
9636990
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 32c349b4-907d-42e9-aad8-2f0edc267779
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 32c349b4-907d-42e9-aad8-2f0edc267779
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 32c349b4-907d-42e9-aad8-2f0edc267779
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 32c349b4-907d-42e9-aad8-2f0edc267779
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 32c349b4-907d-42e9-aad8-2f0edc267779
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 32c349b4-907d-42e9-aad8-2f0edc267779
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1a3dedb6-e5b9-43fc-bdb8-6f2eed08cd0c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1a3dedb6-e5b9-43fc-bdb8-6f2eed08cd0c
9636990 to
becf4d6
Compare
Tests selector (audit mode)The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement. 1 / 100 test projects · 0 jobs, from 5 changed files. Selected test projects (1 / 100)
Selected jobs (0)none How these were chosen — grouped by what changed📄 📄 📄 📄 🧪 Job reasonsnone Selection computed for commit |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
.github/workflows/pr-docs-check/validate_outcome.py:88
create-pull-requeststill hasfallback-as-issue: trueinpr-docs-check.md, so gh-aw can return a fallback issue URL throughcreated_pr_urlwhen PR creation fails. Accepting any nonempty value here would validateresult: draftedand render the “Documentation has been drafted” comment even when the URL is/issues/...and no docs PR exists. Disable that fallback and recompile the workflow, or require the trusted URL to identify amicrosoft/aspire.dev/pull/<number>before acceptingdrafted.
if result == "drafted" and created_pr_url:
return f"Confirmed drafted documentation PR: {created_pr_url}"
|
✅ No documentation update needed. Step 5 branch taken: Triggered signals: no signals triggered (signal_count = 0; recommendation = Allowlist justification: all 5 changed files match the No docs PR is needed. |
Description
PR Documentation Checkcould finish green when the agent reporteddraft_failedand safe outputs created no documentation PR. This adds one authoritative, fail-closed validator job that cross-checks the agent notification against the triggering source PR and the trusted safe-output PR URL.The validator accepts only a confirmed drafted docs PR or an explicit no-docs-needed result. Missing, malformed, duplicate, mismatched, unsupported, and internally inconsistent outcomes now fail the workflow. The source-comment safe-output job remains responsible only for posting comments and requesting reviewers: it renders warning text for structurally valid but inconsistent outcomes, while malformed or mismatched source identities are logged and intentionally skip posting because their PR association cannot be trusted.
Security considerations
The workflow treats the triggering event's source PR number and the safe-output-created PR URL as trusted boundaries. Agent-provided source identities must match the event before comments are posted, and untrusted validator error data is workflow-command encoded before GitHub Actions annotations are emitted.
This PR is stacked on #19118.
Validation:
main(), subprocess exit-code coverage, and a CLI regression proving%, CR, and LF cannot inject a second workflow command or annotation.pr-docs-checkcompiled in strict validation mode with the required gh-aw v0.85.4 compiler and recompilation was byte-for-byte idempotent.draft_failed.Part of #19054
Checklist
<remarks />and<code />elements on your triple slash comments?