{"owner":"rabbitmq","repo":"rabbitmq-server","hasSkills":true,"totalSkillsCount":3,"totalTokensCount":14445,"categories":["root-instruction","gemini-rule","claude-rule"],"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md","GEMINI.md","CLAUDE.md"],"skills":{"AGENTS.md":"# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n","GEMINI.md":"# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n","CLAUDE.md":"# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n"},"files":{"AGENTS.md":"# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n","GEMINI.md":"# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n","CLAUDE.md":"# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","rawUrl":"https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/HEAD/AGENTS.md","title":"AI Agent Protocol & Instructions","category":"root-instruction","format":"markdown","content":"# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n","isInternal":false,"tokens":4815,"sizeBytes":19795},{"name":"CLAUDE.md","path":"CLAUDE.md","rawUrl":"https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/HEAD/CLAUDE.md","title":"Claude Agent Guidelines & System Prompt","category":"claude-rule","format":"markdown","content":"# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n","isInternal":false,"tokens":4815,"sizeBytes":19795},{"name":"GEMINI.md","path":"GEMINI.md","rawUrl":"https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/HEAD/GEMINI.md","title":"Gemini Agent & Antigravity Instructions","category":"gemini-rule","format":"markdown","content":"# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n","isInternal":false,"tokens":4815,"sizeBytes":19795}],"systemPromptSnippet":"<yakaai_skills repo=\"rabbitmq/rabbitmq-server\">\n<!-- File: AGENTS.md (Tokens: ~4815 | Category: root-instruction) -->\n# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n\n<!-- File: CLAUDE.md (Tokens: ~4815 | Category: claude-rule) -->\n# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n\n<!-- File: GEMINI.md (Tokens: ~4815 | Category: gemini-rule) -->\n# Instructions for AI Agents\n\n## Overview\n\nThis repository contains open source [RabbitMQ](https://www.rabbitmq.com/), a multi-protocol\nmessaging and streaming broker that supports AMQP 1.0, AMQP 0-9-1, MQTTv5, the [RabbitMQ Stream Protocol](https://www.rabbitmq.com/docs/streams), STOMP 1.2,\nMQTT-over-WebSockets, and STOMP-over-WebSockets.\n\n\n## Website and GitHub Repositories\n\nTo learn more about RabbitMQ and its features, visit [rabbitmq.com](https://www.rabbitmq.com/).\n\nThe mainline repository on GitHub is [`rabbitmq/rabbitmq-server`](https://github.com/rabbitmq/rabbitmq-server/),\nthe website repository is [`rabbitmq/rabbitmq-website`](https://github.com/rabbitmq/rabbitmq-website/).\n\n\n## Building and Testing\n\nThe GNU Make 4-based build system is described in `CONTRIBUTING.md`.\n\nConsult `CONTRIBUTING.md` before running any tests, in particular to learn how to run\na specific suite, group of cases or a single test case.\n\nWhen looking for GNU Make 4, consult `gmake` as well as `make`.\n\n### Dialyzer and xref\n\nUse `gmake dialyze` and `gmake xref` to run static code analysis tools\nfrom individual `deps/` component directories (see below).\n\n\n## Repository Structure\n\n * `deps/rabbit`: the core RabbitMQ server, the most important part of the codebase\n * `deps/rabbit_common`: internal library for common modules\n * `deps/rabbitmq_amqp_client`: Erlang AMQP 1.0 client with RabbitMQ-specific management operations\n * `deps/rabbitmq_auth_backend_http`: external HTTP server-based authentication (authN), authorization (authZ) backend\n * `deps/rabbitmq_auth_backend_internal_loopback`: a `localhost`-only version of the internal authN, authZ backend\n * `deps/rabbitmq_auth_backend_ldap`: LDAP authN, authZ plugin\n * `deps/rabbitmq_auth_backend_oauth2`: OAuth 2.0 authN, authZ backend\n * `deps/rabbitmq_auth_backend_cache`: a caching layer for other authN, authZ backends\n * `deps/rabbitmq_auth_mechanism_ssl`: X.509 certificate-based authentication support\n * `deps/rabbitmq_aws`: AWS API client library\n * `deps/rabbitmq_cli`: standard CLI tools (`rabbitmqctl`, `rabbitmq-plugins`, `rabbitmq-diagnostics`, etc.); note that [`rabbitmqadmin` v2](https://www.rabbitmq.com/docs/management-cli) lives in a separate repository, [`rabbitmq/rabbitmqadmin-ng`](https://github.com/rabbitmq/rabbitmqadmin-ng)\n * `deps/rabbitmq_codegen`: generates AMQP 0-9-1 serialization modules from machine-readable specification documents\n * `deps/rabbitmq_consistent_hash_exchange`: consistent hashing exchange (`x-consistent-hash`)\n * `deps/rabbitmq_ct_client_helpers`: Common Test helpers for managing connections, channels\n * `deps/rabbitmq_ct_helpers`: Common Test helpers used by RabbitMQ test suites\n * `deps/rabbitmq_event_exchange`: exposes internal events to AMQP 0-9-1 clients\n * `deps/rabbitmq_exchange_federation`: exchange federation\n * `deps/rabbitmq_queue_federation`: queue federation\n * `deps/rabbitmq_federation`: a no-op plugin that depends on `rabbitmq_queue_federation` and `rabbitmq_exchange_federation`\n * `deps/rabbitmq_federation_common`: a common library used by federation plugins\n * `deps/rabbitmq_federation_management`: management UI extension for federation\n * `deps/rabbitmq_federation_prometheus`: Prometheus metrics for federation\n * `deps/rabbitmq_jms_topic_exchange`: JMS topic exchange (`x-jms-topic`) with SQL selection rules\n * `deps/rabbitmq_management`: management plugin, including the HTTP API and management UI code\n * `deps/rabbitmq_management/priv/www`: management UI code\n * `deps/rabbitmq_management_agent`: collects node-wide metrics reported by the management plugin\n * `deps/rabbitmq_mqtt`: MQTT protocol support\n * `deps/rabbitmq_peer_discovery_aws`: AWS EC2-based peer discovery\n * `deps/rabbitmq_peer_discovery_common`: common library for peer discovery backends\n * `deps/rabbitmq_peer_discovery_consul`: Consul-based peer discovery\n * `deps/rabbitmq_peer_discovery_etcd`: etcd-based peer discovery (v3 API)\n * `deps/rabbitmq_peer_discovery_k8s`: Kubernetes peer discovery\n * `deps/rabbitmq_prelaunch`: internal component used very early on node boot\n * `deps/rabbitmq_prometheus`: Prometheus plugin\n * `deps/rabbitmq_random_exchange`: random exchange (`x-random`)\n * `deps/rabbitmq_recent_history_exchange`: recent history exchange (`x-recent-history`)\n * `deps/rabbitmq_sharding`: an opinionated exchange plugin that's lost relevance in the age of [super streams](https://www.rabbitmq.com/docs/streams)\n * `deps/rabbitmq_shovel`: the shovel plugin\n * `deps/rabbitmq_shovel_management`: management UI extension for shovel\n * `deps/rabbitmq_shovel_prometheus`: Prometheus metrics for shovel\n * `deps/rabbitmq_stomp`: STOMP protocol support\n * `deps/rabbitmq_stream`: the streaming subsystem and a RabbitMQ Stream Protocol implementation\n * `deps/rabbitmq_stream_common`: common library for streams\n * `deps/rabbitmq_stream_management`: management UI extension for streams\n * `deps/rabbitmq_top`: `top`-like Erlang runtime process viewer\n * `deps/rabbitmq_tracing`: a plugin that traces messages\n * `deps/rabbitmq_trust_store`: an opinionated alternative to traditional TLS peer verification\n * `deps/rabbitmq_web_dispatch`: a shared foundation for all HTTP- and WebSocket-based plugins\n * `deps/rabbitmq_web_mqtt`: MQTT-over-WebSockets\n * `deps/rabbitmq_web_mqtt_examples`: MQTT-over-WebSockets examples (with a Web UI part)\n * `deps/rabbitmq_web_stomp`: STOMP-over-WebSockets\n * `deps/rabbitmq_web_stomp_examples`: STOMP-over-WebSockets examples (with a Web UI part)\n * `docs/compatibility.json`: machine-readable Erlang/Elixir compatibility matrix for all releases from 3.11.0 onwards. See `docs/COMPATIBILITY.md` for maintenance instructions\n * `scripts` contains shell scripts that drive the server and CLI tools\n * `packaging` contains *some* packaging-related code; release artifacts source can be found in [`rabbitmq/rabbitmq-packaging`](https://github.com/rabbitmq/rabbitmq-packaging)\n * `selenium` contains Selenium tests for the management UI and the OAuth 2 plugin\n * `release-notes` contains release notes all the way back to 1.0.0 previews\n\n\n## Key Dependencies\n\nDependency sources, repositories, and versions are defined in `rabbitmq-components.mk`.\n\nThese dependencies are cloned by `gmake` during the build process:\n\n * `deps/ranch` is [Ranch](https://github.com/ninenines/ranch), a socket acceptor library used by all protocol implementations\n * `deps/ra` is [Ra](https://github.com/rabbitmq/ra), our [Raft](https://raft.github.io/) implementation\n * `deps/aten` is [`aten`](https://github.com/rabbitmq/aten), an implementation of [adaptive accrual failure detector](https://dl.acm.org/doi/10.1145/1244002.1244129) for Ra\n * `deps/osiris` is [`osiris`](https://github.com/rabbitmq/osiris), a library that underpins the streaming subsystem\n * `deps/khepri` is [`khepri`](https://github.com/rabbitmq/khepri), an embedded distributed Ra-based [schema data store](https://www.rabbitmq.com/docs/metadata-store)\n * `deps/cuttlefish` is [`cuttlefish`](https://github.com/Kyorai/cuttlefish/), a `rabbitmq.conf` parser and translation library\n * `deps/cowboy` is the HTTP server and API framework used by the RabbitMQ HTTP API and other HTTP and WebSockets-based plugins\n * `deps/seshat` is [`seshat`](https://github.com/rabbitmq/seshat), a counters (metrics) library\n\n\n## Build System Files, Build Artifacts, Test Run Logs\n\n * `erlang.mk` is the heart of the Make-based build system\n * `rabbitmq-components.mk` lists all dependencies, their sources (e.g. a Git repo or `hex.pm`) and target version\n * `mk`, `./*.mk`, `deps/rabbit_common/mk` are various Make files included into `Makefile`\n * `ebin`, `sbin`, `escript`, `plugins` directories contain build artifacts\n * `logs` contains Common Test run logs. Inspect it when troubleshooting test failures\n * `rebar.config`: Rebar configuration; Rebar is used sparingly throughout the codebase; Make is the primary build tool\n\n\n## Target Erlang and Elixir Versions\n\nRabbitMQ [targets Erlang `27.x`](https://www.rabbitmq.com/docs/which-erlang) and a reasonably [recent Elixir](https://github.com/elixir-lang/elixir/releases) (e.g. `1.18.x`, `1.19.x`).\n\nPer-release Erlang and Elixir compatibility ranges in machine-readable format\ncan be found in `docs/compatibility.json`.\n\n\n## GitHub Actions\n\nThis repository uses GitHub Actions for CI and releases. Find them at their usual place in `.github/workflows`\nand [on the Web](https://github.com/rabbitmq/rabbitmq-server/actions/).\n\nJobs and run results can be inspected via `gh` on the command line.\n\n### Release Infrastructure\n\n * [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages) contains workflows for producing open source RabbitMQ releases\n * [`rabbitmq/build-env-images`](https://github.com/rabbitmq/build-env-images) contains OCI build environment images\n\n \n## Comments\n\nThe default number of new comments in a change is zero.\n\nMaintainers routinely spend follow-up commits shortening or deleting comments that\ncame with a contribution. A comment that has to be edited or removed later costs more\nthan the missing comment would have.\n\n### When to Comment\n\nAdd a comment only when a reader who knows Erlang and the module would get something\nwrong without it. In practice, that leaves a short list:\n\n * A non-obvious reason: backwards compatibility with persisted data or older nodes, a\n   workaround for a specific Erlang/OTP version, a known deviation from a protocol spec\n * A property that is easy to break by accident: atom table exhaustion, a timing side\n   channel, a value that clients control and therefore cannot be trusted\n * A reference that the code cannot carry: an issue number, a commit, an RFC section\n\nEverything else goes without a comment. In particular:\n\n * Anything the code, the function name, or the test case name already says\n * Narration of the change: \"now\", \"previously\", \"used to\", \"with the fix\", \"the\n   headline scenario\". This belongs in the commit message\n * The steps of a test: \"Baseline\", \"Set up\", \"Clean up the queue\", \"Give it a chance\n   to happen\"\n * Erlang, OTP or Common Test basics\n * A rule that a guard, a pattern, a type spec or a function boundary can enforce.\n   Enforce it in code instead\n * Justification for the comment itself, or reassurance about what callers \"must\n   never\" do\n\nWhen in doubt, leave it out: a reviewer can always ask for a missing comment.\n\n### Form\n\n * One line is the norm, two or three is the ceiling. Longer is reserved for truly\n   complex invariants, and then split into short paragraphs with a blank `%%` line\n * Present tense, neutral tone. State the why, not the what\n * No intensifiers (\"huge\", \"massive\", \"extremely\"). Name the actual condition or limit instead\n * Use the terms the module and the protocol spec already use. Do not coin new ones\n   (\"ledger\", \"budget\", \"poisoned\", \"hijack\") or introduce new abbreviations\n * Wrap identifiers in backticks. A function reference always includes its arity:\n   `supervisor:which_children/1`, or `handle_info/2` for a function in the same module.\n   Never a bare `which_children` or `which_children()`\n * A comment goes on its own line above the code it refers to, never at the end of a line\n   (not `1 + 1. %% equals 2`)\n * Use proper English grammar: articles, punctuation, and full stops at the end of sentences\n * Do not add comments to code the change does not otherwise touch\n\n### Examples\n\nA comment that earns its place. It explains a constraint that the code cannot show:\n\n```erlang\n%% Do not change this value in place. The iteration count is not stored\n%% with the hash, so every existing PBKDF2 user would be locked out.\n%% Introduce a new module with the new value instead.\n-define(ITERATIONS, 210_000).\n```\n\nThe pairs below are taken from commits that edited contributed comments.\n\nBefore:\n\n```erlang\n%% parse_deferred_tokens/1 only caps each individual FLOW\n%% frame's own batch; since FLOW frames aren't subject to\n%% session incoming-window flow control, a client can\n%% pipeline many of them while a credit request is in\n%% flight and grow the stash unboundedly if the combined\n%% length isn't capped here too.\n```\n\nAfter:\n\n```erlang\n%% Also cap the combined token count across stashed `FLOW` frames.\n```\n\nBefore:\n\n```erlang\n%% rabbitmqctl set_permissions/clear_permissions don't notify live\n%% sessions, so expire the cache on a timer instead.\n```\n\nAfter:\n\n```erlang\n%% A permission change does not reach a running shovel, so the cache\n%% expires on a timer.\n```\n\nBefore:\n\n```erlang\n%% Marking the node as being drained is the single load-bearing step:\n%% it is what makes the rest of the cluster stop routing new work here.\n%% It must succeed for the drain to be meaningful, so a failure here\n%% is intentionally propagated. Every step that follows is\n%% housekeeping around cleaning up in-flight state; a failure in one\n%% of them (e.g. a stuck federation link, a plugin drain callback\n%% that crashes, a channel that refuses to shut down within the\n%% termination timeout) must not abort the drain and must not\n%% surface as a non-zero CLI exit code, or automation like\n%% Kubernetes preStop hooks becomes unreliable. See GH #3369.\n```\n\nAfter:\n\n```erlang\n%% Marking the node as drained stops the cluster routing work here, so\n%% a failure is propagated. The rest is best-effort cleanup that must\n%% not abort the drain nor fail the CLI command, or automation such as\n%% Kubernetes preStop hooks breaks. rabbitmq/rabbitmq-server#3369.\n```\n\nBefore:\n\n```erlang\n  %% Get the link up and running before poking at it.\n```\n\nAfter:\n\n```erlang\n  %% Wait for the link to come up first.\n```\n\nBefore:\n\n```erlang\n    %% Check that the content type is json\n    %% ...\n    %% Decode the JSON body\n    %% ...\n    %% Check that the settings are present\n```\n\nAfter: all three comments are removed.\n\n\n## Voice\n\nWrite like a senior engineer who values clarity and simplicity. This applies\nto all prose: comments, commit messages, pull request descriptions, design docs and notes.\n\n * Plain and factual: state the why in one line, never narrate the what\n * Literal mechanism over metaphor: name the actual thing, not an image of it\n * Prefer the plainest word. No coined verbs, no jargon, no sophisticated synonym use for its own sake\n * No flourish, no editorializing, no imagery. Use real domain terms\n * Claim only what has been verified: \"an attempt to fix a flake\" until the fix is confirmed\n * Undersell rather than oversell: \"a minor correctness fix\", \"one more test\", never\n   \"comprehensive\" or \"significantly improved\"\n * Write sentences a person would say out loud, contractions included. If a sentence reads\n   like a log line or a status enum, rewrite it\n\n### Writing Style, Markdown Style\n\n * Never add full stops to Markdown list items\n * Use \"X and Y\" in prose, not \"X / Y\" slash-shorthand. Exceptions: unit\n   fractions (`bytes/edge`), single-concept abbreviations (`I/O`), and paths\n   or code (`tests/unit/`, `m:f/a`, `queue.declare`)\n * Wrap code identifiers — types, functions, modules, file names, paths — and version numbers (`4.3.5`, `27.x`) in backticks in prose\n * Both British and American spelling are in use. Match the spelling the file already uses\n * Avoid robotic labels such as `**Thing / other:**`; write a plain sentence or a simple label\n * Match the existing conventions of the file and subdirectory you are\n   editing — bullet character, heading depth, ID schemes, and table shape\n   vary by project, and the local choice wins\n * Spell the causation out with a plain connective: \"this means that the\n   decisions can be tested without a cluster\", not the compressed \"keeps\n   the decisions testable\"\n * One idea per paragraph: in multi-line doc strings, separate distinct\n   thoughts with a blank line rather than cramming them into one block\n * A short orienting connective is fine where it helps the reader (\"as the\n   name suggests\", \"note that\"): this is clarity, not flourish\n * Grammar counts, including the passive where it is the correct voice: \"a\n   command has been committed\", not \"a command has committed\"\n\n\n## Git and GitHub (sans Actions) Instructions\n\n### General\n\n * Never add yourself to the list of commit co-authors\n * Never mention yourself in commit messages in any way (no \"Generated by\", no AI tool links, etc)\n\n### Commit Messages and Pull Request Descriptions\n\n * Terse, factual, neutral and simple. No jargon. A body is fine when it explains something the diff cannot\n * No full stop at the end of the subject line\n * Imperative mood, a noun phrase, or a plain declarative sentence; never past tense:\n   `Fix a flaky test`, `Stream SAC: update another test`, `` `hash_password/1` is now `hash_password/2` ``\n * Lead with a subsystem or module label and a colon when it helps: `LDAP: handle more Active Directory username edge cases`\n * State the how with a verb phrase: `fix a flake by allowing for more time`, not \"timeout adjustment for flake mitigation\"\n * Reference issues and PRs bare, without parentheses: `References #17255`, `Fixes #11526`\n * A body explains why in a few short paragraphs. It does not list every changed file or function\n * The same applies to pull request descriptions: what the problem was, how it is fixed, how it was tested.\n   No headings for a small change, no summary tables, no checklists of self-evident items\n\n### Branches\n\nThe currently developed community-supported branches are:\n\n * `main` (becomes 5.0.0)\n * `v4.4.x`\n * `v4.3.x`\n\n### Backporting\n\nWhen backporting commits to older branches,\nalways use `git cherry-pick -x` to include a reference to the original commit.\n\n### Fetching GitHub PRs\n\nWhen fetching a GitHub pull request details or diffs, prefer the Web option over the `gh` CLI tool.\n`gh` can require an explicit operation approval.\n\n\n## Security\n\n`.github/SECURITY.md` describes the security policy.\n\nFor GitHub Security Advisories, make sure to:\n\n * Provide a complete CVSS 4.0 vector string\n * Enter the \"Ecosystem\" and \"Package name\" correctly\n   * For vulnerabilities in packages published on [Hex.pm](https://hex.pm/users/rabbitmq) (e.g. `amqp10_client`, `amqp10_common`, `amqp_client`, `rabbit_common`, `credentials_obfuscation`):\n     * Set \"Ecosystem\" to \"Erlang\"\n     * Set \"Package name\" to the Hex.pm package name\n     * This ensures they are properly picked up by OSV.dev and Hex.pm\n   * For vulnerabilities not present in a Hex.pm package (e.g. in `deps/rabbit`):\n     * Set \"Ecosystem\" to \"Other: RabbitMQ\"\n     * Set \"Package name\" to \"rabbitmq-server\"\n     * This helps the GitHub team differentiate them from Hex.pm packages\n * Enter the \"Affected Versions\" and \"Patch Versions\" correctly\n   * Define \"Affected Versions\" explicitly per minor release line using version ranges (e.g. `>= 4.2.0`, `< 4.2.10`)\n   * For the Patch version, provide the exact release containing the fix (e.g. `4.2.6`)\n   * If a fix is included in the first release of a new minor line (e.g. `4.3.0`), omit that release line entirely as no vulnerable `4.3.x` releases exist\n\n### Use CVSSv4 Scores\n\nWhen computing a CVSS score, use the CVSSv4 calculator: it can express certain important nuaces better.\n\nWhen a potential vulnerability is found in a plugin or a feature not enabled by default,\nset the `Attack Requirements` (`AT`) metric to `Present` (`P`): `AT:P`, to reflect the fact\nthat only a subset of deployments are affected.\n\n\n## After Completing a Task\n\n### Iterative Reviews\n\nAfter completing a task, perform up to twenty iterative reviews of your changes.\nIn every iteration, look for meaningful improvements that were missed, for gaps in test coverage, and for deviations from the instructions in this file,\nincluding new comments that can be shortened or dropped.\n\nIf no meaningful improvements are found for three iterations in a row, report it and stop iterating.\n</yakaai_skills>"}