Skip to content

fix(create-pull-request): implicitly allow default base branch when no allowed-base-branches configured - #29096

Merged
pelikhan merged 3 commits into
mainfrom
copilot/aw-fix-architecture-diagram-generator
Apr 29, 2026
Merged

pelikhan merged 3 commits into
mainfrom
copilot/aw-fix-architecture-diagram-generator

Conversation

Copilot AI commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

When an agent explicitly specifies the repository's default base branch (e.g. base: "main") in its create_pull_request output, the request was incorrectly rejected with "Base branch override is not allowed" if no allowed-base-branches was configured. This happened because any non-empty explicit base value was treated as an override requiring an allowlist.

Change

Fixed create_pull_request.cjs to implicitly allow the default base branch when no allowed-base-branches is configured. When the agent-specified base branch matches the already-resolved default baseBranch and no allowlist is set, it is treated as a no-op (not a true override) and all allowlist validation is skipped.

When allowed-base-branches IS explicitly configured, the full allowlist check still applies and remains authoritative.

// Before: any explicit base field triggered override validation
if (allowedBaseBranches.size === 0) {
  return { success: false, error: "Base branch override is not allowed..." };
}

// After: default base branch is implicitly allowed when no allowlist is configured
if (requestedBaseBranchRaw === baseBranch && allowedBaseBranches.size === 0) {
  // No-op — agent confirmed the default, not a true override
} else {
  // Full allowlist validation applies
}

A new test case covers the implicit-allow behaviour: "should allow base override when it matches the default base branch and no allowed-base-branches is configured".

Copilot AI linked an issue Apr 29, 2026 that may be closed by this pull request
…e-pull-request

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/aef12799-ee56-4005-a0bd-8fe3a95d8d1f

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix workflow failure in Architecture Diagram Generator fix(daily-architecture-diagram): allow base branch override for create-pull-request Apr 29, 2026
Copilot AI requested a review from pelikhan April 29, 2026 12:23
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot why was it refused? Isn't the default branch always the base branch by default?

Copilot AI commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

@copilot why was it refused? Isn't the default branch always the base branch by default?

The default base branch is used when no base field is provided by the agent. But when the agent explicitly includes a base field in its create_pull_request output (even if it's "main"), it triggers the base branch override validation path in create_pull_request.cjs (line 703: if (typeof pullRequestItem.base === "string" && pullRequestItem.base.trim() !== "")). Any non-empty explicit base value — including the default branch — is treated as an override and rejected unless allowed-base-branches is configured. In this run, the agent specified base: "main" explicitly, which caused the rejection.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot the base branch SHOULD BE implicitely allowed when there are not allowed-base-branches specified

…o allowed-base-branches configured

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/50d1f57f-838b-4b2b-9899-0f3c98d5bcb0

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the base branch SHOULD BE implicitely allowed when there are not allowed-base-branches specified

Fixed in commit 814a6b9. When no allowed-base-branches is configured and the agent explicitly specifies the current default base branch (e.g. base: "main"), it's now treated as a no-op and allowed through without any allowlist check. The daily-architecture-diagram.md workaround has been reverted — the fix is in the create_pull_request handler itself.

When allowed-base-branches IS explicitly configured, the full allowlist check still applies (so it remains the authoritative list for non-default overrides).

Copilot AI changed the title fix(daily-architecture-diagram): allow base branch override for create-pull-request fix(create-pull-request): implicitly allow default base branch when no allowed-base-branches configured Apr 29, 2026
@pelikhan
pelikhan marked this pull request as ready for review April 29, 2026 13:07
Copilot AI review requested due to automatic review settings April 29, 2026 13:07

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

Fixes create_pull_request base-branch override policy so that explicitly specifying the already-resolved default base branch (e.g. base: "main") is treated as a no-op when allowed-base-branches is not configured, rather than being rejected as an override.

Changes:

  • Update base-branch override handling to implicitly allow a requested base branch when it matches the resolved default base branch and no allowlist is configured.
  • Preserve existing allowlist enforcement behavior when allowed-base-branches is configured.
  • Add a unit test covering the implicit-allow (no-op) behavior.
Show a summary per file
File Description
actions/setup/js/create_pull_request.cjs Adjusts base-branch override validation to treat “requested base == resolved base” as a no-op when no allowlist is present.
actions/setup/js/create_pull_request.test.cjs Adds a test ensuring a request with base: "main" succeeds when the resolved base is main and no allowlist is configured.

Copilot's findings

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 70/100

⚠️ Acceptable, with suggestions

Metric Value
New/modified tests analyzed 1
✅ Design tests (behavioral contracts) 1 (100%)
⚠️ Implementation tests (low value) 0 (0%)
Tests with error/edge cases 0 (0%)
Duplicate test clusters 0
Test inflation detected No (ratio 0.29:1)
🚨 Coding-guideline violations None

Test Classification Details

Test File Classification Issues Detected
should allow base override when it matches the default base branch and no allowed-base-branches is configured actions/setup/js/create_pull_request.test.cjs:1454 ✅ Design Happy-path only; no error/edge case assertions

Flagged Tests — Requires Review

⚠️ should allow base override when it matches the default base branch and no allowed-base-branches is configured (create_pull_request.test.cjs:1454)

Classification: Design test (behavioral contract) — but happy-path only
Issue: The test verifies the success case (base branch matches default → allowed), but does not cover edge cases such as: base branch differs from default and no allowed-base-branches is configured (the rejection path for non-default bases). Note: a pre-existing test at line 1443 covers the pure-rejection case; however, a new test for a non-matching base with no config (e.g., base: "feature/other") would strengthen the behavioral contract boundary.
What design invariant does this test enforce? When allowed-base-branches is unconfigured, a base override matching the default branch (GITHUB_BASE_REF) is implicitly permitted and does not produce an error.
What would break if deleted? The regression introduced by this PR (treating default-branch base overrides as forbidden when allowed-base-branches is unset) would go undetected.
Suggested improvement: Add a complementary edge-case assertion — e.g., when base is set to a non-default branch (e.g., "develop") with no allowed-base-branches configured, verify the request is rejected and the appropriate warning is emitted.


Language Support

Tests analyzed:

  • 🟨 JavaScript (*.test.cjs): 1 test (vitest)

Verdict

✅ Check passed. 0% of new tests are implementation tests (threshold: 30%). The single new test covers the behavioral contract for the bug fix. Adding an edge-case test for non-matching base branches with no allowed-base-branches config would improve confidence.


📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct
  • Give false assurance: they pass even when the system is wrong

Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.

References: §25110673998

🧪 Test quality analysis by Test Quality Sentinel · ● 375.7K · ◷

@github-actions github-actions Bot 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.

✅ Test Quality Sentinel: 70/100. Test quality is acceptable — 0% of new tests are implementation tests (threshold: 30%).

@pelikhan
pelikhan merged commit b08e2d8 into main Apr 29, 2026
29 checks passed
@pelikhan
pelikhan deleted the copilot/aw-fix-architecture-diagram-generator branch April 29, 2026 13:21
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] Architecture Diagram Generator failed

3 participants