---
title: "Test both versions during an upgrade · Agent Wranglers"
url: https://agentwranglers.se/playbook/codebase-takeover/major-upgrades/test-both-versions
id: TKO-23
level: Optional
updated: 2026-10-22
tokens: 613
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Test both versions during an upgrade

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Major upgrades](https://agentwranglers.se/playbook/codebase-takeover/major-upgrades.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: TKO-23
- Level: Optional
- Chapter: [Major upgrades](https://agentwranglers.se/playbook/codebase-takeover/major-upgrades.md)
- Rule: While an upgrade is under way, run the test suite on the current and the next major version in CI. Make the next version the default only when it passes.
- Check: The CI settings run the suite on both versions during the upgrade. After the upgrade merges, only the new version remains in the matrix.
- How: A matrix build shows which tests break on the new version, while the main branch stays deployable on the old one. Mark the new version's job as allowed to fail until it passes. Then swap the default and remove the old version from the matrix. Libraries keep a longer matrix, as [Publish a support matrix](https://agentwranglers.se/playbook/engineering/libraries-and-sdks/support-matrix.md) says.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### YAML example

```yaml
jobs:
  test:
    strategy:
      matrix:
        node: [22, 24]
    continue-on-error: ${{ matrix.node == 24 }}
    steps:
      - uses: actions/setup-node@v4
        with: { node-version: "${{ matrix.node }}" }
      - run: npm ci && npm test
```

## Related rules

- ENG-53 [Publish a support matrix](https://agentwranglers.se/playbook/engineering/libraries-and-sdks/support-matrix.md) in Engineering

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/codebase-takeover/major-upgrades/test-both-versions">Agent Wranglers codebase takeover playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Run codemods in their own commit](https://agentwranglers.se/playbook/codebase-takeover/major-upgrades/codemods-first.md)
- [Major upgrades](https://agentwranglers.se/playbook/codebase-takeover/major-upgrades.md)
