Skip to content

Fail docs checks without a conclusive outcome - #19155

Merged
David Pine (IEvangelist) merged 9 commits into
dapine/fix-gh-aw-target-checkoutfrom
dapine/fail-closed-docs-outcome
Aug 11, 2026
Merged

Fail docs checks without a conclusive outcome#19155
David Pine (IEvangelist) merged 9 commits into
dapine/fix-gh-aw-target-checkoutfrom
dapine/fail-closed-docs-outcome

Conversation

@IEvangelist

@IEvangelist David Pine (IEvangelist) commented Aug 7, 2026

Copy link
Copy Markdown
Member

Description

PR Documentation Check could finish green when the agent reported draft_failed and 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:

Part of #19054

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/pr-docs-check.md Outdated
Copilot AI review requested due to automatic review settings August 7, 2026 21:38
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19155

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19155"

@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 earlier else if (result === 'drafted') runs (even when draftUrl is present) and falsely says the PR could not be confirmed; draft_failed similarly selects its specific branch. Gate those result-specific failure branches on notifications.length === 1 so duplicate outcomes reach this internally-inconsistent warning.
              } else {

Copilot AI review requested due to automatic review settings August 7, 2026 21:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_failed notification can still claim that no docs PR was drafted when created_pr_url is 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') {

Comment thread .github/workflows/pr-docs-check/validate_outcome.py
@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings August 7, 2026 21:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_number values 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. Since expectedNumber is 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_failed is 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."
        )

Copilot AI review requested due to automatic review settings August 7, 2026 22:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@github-actions

This comment has been minimized.

Comment thread .github/workflows/pr-docs-check.md Outdated
Comment thread .github/workflows/pr-docs-check/validate_outcome.py
Comment thread .github/workflows/pr-docs-check/validate_outcome.py
Comment thread .github/workflows/pr-docs-check/test_validate_outcome.py

@adamint Adam Ratzman (adamint) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI review requested due to automatic review settings August 8, 2026 12:25
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings August 11, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 11, 2026 13:17
@IEvangelist
David Pine (IEvangelist) force-pushed the dapine/fail-closed-docs-outcome branch from 8df1aaa to 9636990 Compare August 11, 2026 13:17
David Pine and others added 9 commits August 11, 2026 08:18
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
@IEvangelist
David Pine (IEvangelist) force-pushed the dapine/fail-closed-docs-outcome branch from 9636990 to becf4d6 Compare August 11, 2026 13:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 11, 2026 13:24
@github-actions

Copy link
Copy Markdown
Contributor

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)

Infrastructure.Tests

Selected jobs (0)

none


How these were chosen — grouped by what changed

📄 .github/workflows/pr-docs-check.lock.yml (changed)
1 directly: Infrastructure.Tests

📄 .github/workflows/pr-docs-check.md (changed)
1 directly: Infrastructure.Tests

📄 .github/workflows/pr-docs-check/test_validate_outcome.py (changed)
1 directly: Infrastructure.Tests

📄 .github/workflows/pr-docs-check/validate_outcome.py (changed)
1 directly: Infrastructure.Tests

🧪 tests/Infrastructure.Tests/WorkflowScripts/PrDocsCheckWorkflowTests.cs (changed test)
1 directly: Infrastructure.Tests

Job reasons

none


Selection computed for commit becf4d6.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-request still has fallback-as-issue: true in pr-docs-check.md, so gh-aw can return a fallback issue URL through created_pr_url when PR creation fails. Accepting any nonempty value here would validate result: drafted and 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 a microsoft/aspire.dev/pull/<number> before accepting drafted.
    if result == "drafted" and created_pr_url:
        return f"Confirmed drafted documentation PR: {created_pr_url}"

@IEvangelist
David Pine (IEvangelist) merged commit 15521ac into main Aug 11, 2026
342 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the dapine/fail-closed-docs-outcome branch August 11, 2026 15:07
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Step 5 branch taken: docs_optional -> build_or_ci_only

Triggered signals: no signals triggered (signal_count = 0; recommendation = docs_optional).

Allowlist justification: all 5 changed files match the build_or_ci_only category - they are entirely within .github/workflows/ (the pr-docs-check GitHub Actions workflow: pr-docs-check.lock.yml, pr-docs-check.md, pr-docs-check/test_validate_outcome.py, pr-docs-check/validate_outcome.py) and tests/Infrastructure.Tests/WorkflowScripts/PrDocsCheckWorkflowTests.cs. This PR hardens the docs-check automation itself (adds a fail-closed validator job so the workflow no longer reports green when no documentation PR was actually created) and does not change any Aspire product surface, CLI, hosting API, dashboard, or integration behavior that ships to microsoft/aspire.dev users.

No docs PR is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants