|
| 1 | +# Maintaining `compatibility.json` |
| 2 | + |
| 3 | +This document describes how `docs/compatibility.json` was built and how it |
| 4 | +should be maintained going forward. |
| 5 | + |
| 6 | +## Purpose |
| 7 | + |
| 8 | +`compatibility.json` is a machine-readable compatibility matrix that maps each |
| 9 | +RabbitMQ release version to its supported Erlang/OTP and Elixir version ranges. |
| 10 | +It uses mathematical interval notation familiar to Maven and NuGet users. |
| 11 | + |
| 12 | +See [GitHub Discussion #15438](https://github.com/rabbitmq/rabbitmq-server/discussions/15438) |
| 13 | +for the original proposal. |
| 14 | + |
| 15 | +## File Format |
| 16 | + |
| 17 | +The file is a JSON object keyed by RabbitMQ version string, ordered |
| 18 | +newest-first. Each value contains `erlang` and `elixir` keys with version |
| 19 | +ranges in interval notation: |
| 20 | + |
| 21 | +```json |
| 22 | +{ |
| 23 | + "4.2.4": { |
| 24 | + "erlang": "[26.2,28.0)", |
| 25 | + "elixir": "[1.13.4,1.20.0)" |
| 26 | + } |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +`[` means inclusive, `)` means exclusive. For example, `[26.2,28.0)` means |
| 31 | +`26.2 <= version < 28.0`. |
| 32 | + |
| 33 | +## Scope |
| 34 | + |
| 35 | +The file covers RabbitMQ 3.11.0 onwards. Earlier releases are not included. |
| 36 | + |
| 37 | +Only final releases are included. Betas, release candidates, and alphas are |
| 38 | +excluded. |
| 39 | + |
| 40 | +## Data Sources |
| 41 | + |
| 42 | +### Erlang Version Ranges |
| 43 | + |
| 44 | +The Erlang minimum and maximum version for each RabbitMQ release come from the compatibility |
| 45 | +table in the RabbitMQ website repository at `docs/which-erlang.md`: |
| 46 | + |
| 47 | +https://github.com/rabbitmq/rabbitmq-website/blob/main/docs/which-erlang.md |
| 48 | + |
| 49 | +That file contains two HTML tables (supported and unsupported series) with |
| 50 | +columns for RabbitMQ versions, minimum required Erlang/OTP, and maximum |
| 51 | +supported Erlang/OTP. |
| 52 | + |
| 53 | +To convert the HTML table values to interval notation: |
| 54 | + |
| 55 | +- The minimum becomes the inclusive lower bound |
| 56 | +- The maximum `X.Y.x` becomes the exclusive upper bound `X.(Y+1)` |
| 57 | +- Example: min `26.2`, max `27.x` becomes `[26.2,28.0)` |
| 58 | +- Example: min `25.0`, max `26.2.x` becomes `[25.0,26.3)` |
| 59 | +- Example: min `25.0`, max `25.3.x` becomes `[25.0,25.4)` |
| 60 | + |
| 61 | +Preserve the precision from the HTML table. If the table says `24.3.4.8`, use |
| 62 | +that exact value in the interval. |
| 63 | + |
| 64 | +When a release exists in the git tags but is not explicitly listed in the HTML |
| 65 | +table, assign it the same Erlang range as its siblings in the same release |
| 66 | +series and compatibility group. |
| 67 | + |
| 68 | +### Elixir Version Ranges |
| 69 | + |
| 70 | +The Elixir range for each release comes from the `elixir` field in |
| 71 | +`deps/rabbitmq_cli/mix.exs` at the corresponding git tag. |
| 72 | + |
| 73 | +To extract the Elixir constraint for a release: |
| 74 | + |
| 75 | +```bash |
| 76 | +git show v4.2.4:deps/rabbitmq_cli/mix.exs | grep -oP 'elixir:\s*"\K[^"]+' |
| 77 | +``` |
| 78 | + |
| 79 | +This returns a string like `>= 1.13.4 and < 1.20.0`, which converts to |
| 80 | +interval notation as `[1.13.4,1.20.0)`. |
| 81 | + |
| 82 | +To extract all Elixir constraints at once: |
| 83 | + |
| 84 | +```bash |
| 85 | +for tag in $(git tag -l 'v3.11.*' 'v3.12.*' 'v3.13.*' 'v4.*' \ |
| 86 | + | grep -v -E '(beta|rc|alpha)' | sort -V); do |
| 87 | + elixir=$(git show "$tag:deps/rabbitmq_cli/mix.exs" 2>/dev/null \ |
| 88 | + | grep -oP 'elixir:\s*"\K[^"]+') |
| 89 | + echo "$tag: $elixir" |
| 90 | +done |
| 91 | +``` |
| 92 | + |
| 93 | +## Adding a New Release |
| 94 | + |
| 95 | +When a new RabbitMQ version is released: |
| 96 | + |
| 97 | +1. Determine the Erlang range from `docs/which-erlang.md` in the website |
| 98 | + repository, or from the release notes if the website has not been updated |
| 99 | + yet. If neither source has been updated, use the same Erlang range as the |
| 100 | + previous release in the same series, and update it later when the |
| 101 | + authoritative data is available |
| 102 | +2. Extract the Elixir constraint from `deps/rabbitmq_cli/mix.exs` at the new |
| 103 | + release tag |
| 104 | +3. Add the new entry at the top of the JSON object (newest-first ordering) |
| 105 | +4. Validate the file is well-formed: `jq . docs/compatibility.json > /dev/null` |
| 106 | +5. Verify the entry count matches the number of release tags: |
| 107 | + `jq 'keys | length' docs/compatibility.json` |
| 108 | + |
| 109 | +## Relationship to Other Files |
| 110 | + |
| 111 | +`docs/compatibility.json` is separate from `.github/versions.json`. The |
| 112 | +`versions.json` file lists RabbitMQ and Erlang versions for populating GitHub |
| 113 | +Discussions template dropdowns and is auto-updated by |
| 114 | +`.github/scripts/update-versions.sh`. It serves a different purpose and should |
| 115 | +not be combined with the compatibility matrix. |
0 commit comments