Description

This check verifies that stale pull request approvals are dismissed when changes are made to the default branch pull request. Dismissing stale approvals ensures that previous approvals are no longer considered valid after new commits or updates are introduced, requiring reviewers to re-evaluate the latest changes before merging. This control helps maintain the integrity of the pull request review process by ensuring approvals always correspond to the current state of the code being merged.

Note: Only repository-level branch restrictions are detected. Restrictions set only at the project level are not returned by Bitbucket’s API and will result in a FAIL. Configure the restriction at the repository level for accurate results.

Rationale

The default branch typically contains stable or production-ready code. If approvals remain valid after significant changes are pushed to a pull request, previously reviewed code may differ from the final version being merged without requiring reviewers to verify the updates. Automatically dismissing stale approvals ensures that reviewers assess the latest changes, reduces the risk of unreviewed code entering the default branch, and strengthens the organization's code review and change management process.

Impact

  • Require reviewers to re-approve pull requests after new changes are introduced.

  • Prevent outdated approvals from being used to merge modified code.

  • Improve confidence that merged changes have been reviewed in their final state.

  • Increase review effort when additional commits are added after approval.

  • Strengthen compliance with secure software development practices.

Default Value

Requires repository configuration. Bitbucket Premium repositories support pull request merge checks and approval controls, including enforcement of review requirements. Repository administrators must configure pull request settings to ensure stale approvals are dismissed when changes are introduced.

Pre-Requisites

  • Repository administrator access

  • An existing Bitbucket repository

Test Plan

  1. Sign in to Bitbucket at https://bitbucket.org.

  2. Navigate to the target repository.

  3. Select Repository settings.

  4. Navigate to Branch restrictions or Merge checks under the repository workflow settings.

  5. Review the pull request approval settings configured for the default branch.

  6. Verify that stale pull request approvals are dismissed when new changes are pushed.

  7. If stale approvals are not dismissed, follow the implementation steps.

Implementation Steps

  1. Sign in to Bitbucket at https://bitbucket.org.

  2. Navigate to the target repository.

  1. Select Repository settings.

  2. Navigate to Branch restrictions under the Workflow section.

  3. Select the branch restriction rule configured for the default branch.

  4. Open Merge settings.

  1. Enable the option to require approvals to be updated when changes are introduced to the pull request.

  2. Configure the required approval settings based on organizational requirements.

  3. Save the changes.

Backout Plan

  1. Sign in to Bitbucket at https://bitbucket.org.

  2. Navigate to the target repository.

  3. Select Repository settings.

  4. Navigate to the pull request or branch restriction merge settings.

  5. Locate the configuration enforcing stale approval dismissal.

  6. Disable the stale approval dismissal requirement.

  7. Save the changes.

  8. Confirm that repository pull request workflows function as expected after the rollback.



Reference