Skip to content

Support for Stale Branch Lifecycle and Automated Cleanup #812

@mefellows

Description

@mefellows

Feature Name: Stale Branches

🧩 Problem

Over time, outdated branches accumulate in the Pact Broker, particularly in organizations with many teams or high CI/CD frequency. These old branches rarely serve a current purpose but continue to consume resources, degrade query performance (e.g., provider verification lookups), and clutter the UI/APIs, making it harder for users to interpret important information. Without tools to clean or filter out inactive branches, users struggle to find relevant signals, and system performance suffers.

💡 Solution

Introduce a "stale branch" lifecycle concept in the Pact Broker. This allows branches with no recent activity to be automatically flagged and removed by a cleaning process. The solution includes configurable conditions for what constitutes staleness (e.g. time since last verification or version publish) and gives users control over cleanup behavior through improved UX in both CLI and UI.

This update streamlines the broker data, improves performance, and helps teams focus on relevant, active contract activity.

Requirements

  • Introduce new concept of “stale” branch
  • By default, a branch that has not had any changes on it for the past 3 months, where changes include:
    • any new consumer versions associated with it (not the contract contents, which is versioned independently)
    • any new provider versions (verifications) associated with it
    • TBC (for review)
  • Ability for systems administrator to set the conditions for what is considered a “stale” branch
    • Ability to specify the duration in which a branch is considered stale
    • Ability to disable stale branches (for the future purposes of prevention of automatic cleaning) - possibly just setting to 0 or false
    • Ability to specify the main branch for an application (already exists, but including here for clarity of overall solution)
    • (optional - for discussion) Ability to specify what are important branches
  • Update the cleanup process to automatically delete stale branches
    • Support a new configuration option ("keep selector") to enable/disable stale branch deletion
    • Ensure any branch keep options are factored into the deletion (i.e. do not delete any stale branches that are specified in the branch keep selector)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIndicates new feature requestssmartbear-supportedSmartBear engineering team will support this issue. See https://docs.pact.io/help/smartbear

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions