Skip to content

Add dual-trigger regression tests for applyPullRequestStackFilter - #49447

Closed
pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/aw-failures-fix-unguarded-arithmetic
Closed

pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/aw-failures-fix-unguarded-arithmetic

Conversation

Copilot AI commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

applyPullRequestStackFilter previously emitted stack.position + N > stack.size in job-level if: conditions — arithmetic operators aren't valid in GitHub Actions expressions, causing startup_failure on every non-pull_request event for workflows with dual triggers (on: [push, pull_request]). The fix (switching to == for max-stack: 1, PreStep bash arithmetic for max-stack: N > 1) was already applied, but the dual-trigger blast-radius scenario had no test coverage.

Changes

  • pkg/workflow/filters_stack_test.go — Two new unit tests covering the specific scenario that caused the fleet-wide outage:
    • TestApplyPullRequestStackFilter_DualTriggerListFormat — on: [push, pull_request] list syntax
    • TestApplyPullRequestStackFilter_DualTriggerMapFormat — on: {push: ..., pull_request: ...} map syntax

Both tests assert the generated if: condition:

  1. Leads with github.event_name != 'pull_request' (safe guard for non-PR events)
  2. Contains no + arithmetic operators (which GitHub Actions expressions reject at startup)
  3. Produces no PreSteps (default max-stack: 1 path)

Copilot AI changed the title [WIP] Fix unguarded arithmetic in applyPullRequestStackFilter Add dual-trigger regression tests for applyPullRequestStackFilter Aug 1, 2026
Copilot AI requested a review from pelikhan August 1, 2026 02:13
@pelikhan
pelikhan marked this pull request as ready for review August 1, 2026 02:45
Copilot AI review requested due to automatic review settings August 1, 2026 02: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

Adds regression coverage for dual-trigger workflows affected by invalid stack-filter arithmetic.

Changes:

  • Tests list and map trigger formats.
  • Verifies event guards, arithmetic removal, and absence of pre-steps.
Show a summary per file
File Description
pkg/workflow/filters_stack_test.go Adds dual-trigger stack-filter regression tests.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Suppressed comments (1)

pkg/workflow/filters_stack_test.go:146

  • This assertion verifies presence rather than the required leading position, so it would not catch the guard being reordered after access to the absent pull-request context. Check the prefix here as well so the map-format regression test enforces the intended short-circuit order.
	assert.Contains(t, workflowData.If, "github.event_name != 'pull_request'",
		"condition must start with event_name guard to be safe on non-PR events")
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +116 to +117
assert.Contains(t, workflowData.If, "github.event_name != 'pull_request'",
"condition must start with event_name guard to be safe on non-PR events")
@pelikhan pelikhan closed this Aug 1, 2026
@github-actions
github-actions Bot deleted the copilot/aw-failures-fix-unguarded-arithmetic branch August 8, 2026 02:37
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.

[aw-failures] Fix: unguarded arithmetic on github.event.pull_request.stack in applyPullRequestStackFilter

3 participants