You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ashb (via GitHub)" <gi...@apache.org> on 2026/09/28 11:33:29 UTC

[PR] Allow isolated/per-project/per-worktree tests in parallel in Breeze [airflow]

ashb opened a new pull request, #73836:
URL: https://github.com/apache/airflow/pull/73836

   A number of brreze commands supported `--project-name` to be able to run
   multiple breeze commands in parallel (very useful when you are using git
   worktrees), but there were two big gaps to this feature:
   
   - the Postgres volume was "global", so all breeze projects used the same volume
   - the `testing` commands didn't have this flag.
   
   Adding this means can now run `breeze testing core-tests --project-name
   $my_worktree --backend postgres` safely on multiple worktrees without collision
   
    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull request.
   Write a good git commit message following this guide: https://chris.beams.io/posts/git-commit/
   
   Please make sure that your code changes are covered with tests.
   And in case of new features or big changes remember to adjust the documentation.
   
   For user-facing UI changes, please attach before/after screenshots (or a short
   screen recording) so reviewers can assess the visual impact.
   
   Feel free to ping (in general) for the review if you do not see reaction for a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   - [ ] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   ---
   
   * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project/per-worktree tests in parallel in Breeze [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4121893029


##########
dev/breeze/src/airflow_breeze/commands/testing_commands.py:
##########
@@ -323,9 +324,9 @@ def _get_project_names(shell_params: ShellParams) -> tuple[str, str]:
     """Return compose project name and project name."""
     project_name = file_name_from_test_type(shell_params.test_type)
     if shell_params.test_type == ALL_TEST_TYPE:
-        compose_project_name = "breeze-airflow-test"
+        compose_project_name = f"{shell_params.project_name}-airflow-test"
     else:
-        compose_project_name = f"breeze-airflow-test-{project_name}"
+        compose_project_name = f"{shell_params.project_name}-airflow-test-{project_name}"

Review Comment:
   Everything else uses `breeze` as the project name, so `breeze shelll --project-name foobar` would create a container `foobar-airflow-run-111a6cd3b78d`, So I've just kept that convention for now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4125434494


##########
scripts/ci/docker-compose/backend-postgres.yml:
##########


Review Comment:
   Sure, I will open a follow-up.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4126121243


##########
dev/breeze/src/airflow_breeze/commands/developer_commands.py:
##########
@@ -1159,21 +1154,22 @@ def down(
     all_projects: bool,
     project_name: str | None,
 ):
-    perform_environment_checks()
-    brought_down, skipped = bring_all_compose_projects_down(
+    if all_projects and project_name:
+        raise click.UsageError("--all-projects and --project-name cannot be used together.")
+    perform_environment_checks(cleanup_stale_worktrees=False)
+    brought_down = bring_compose_projects_down(

Review Comment:
   How about "all if run from the main checkout, but worktree only if run from the worktree folder"? That might be too much magic though.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4126645805


##########
scripts/ci/docker-compose/backend-postgres.yml:
##########
@@ -44,4 +47,7 @@ services:
     restart: "on-failure"
 volumes:
   postgres-data-volume:
-    name: "postgres${POSTGRES_VERSION}-db-volume"
+    labels:
+      org.apache.airflow.breeze: "true"
+      org.apache.airflow.breeze.worktree: "${BREEZE_WORKTREE_PATH:-}"
+    name: "${COMPOSE_PROJECT_NAME}-postgres${POSTGRES_VERSION}-db-volume"

Review Comment:
   Migration handled in next push. It looks like this when run:
   
   ```
   Stop containers ['f10e3631ddaf'] to migrate legacy Postgres volumes?
   Press y/N/q: y
   f10e3631ddaf
   Migrating postgres14-db-volume to breeze-postgres14-db-volume
   breeze-postgres14-db-volume
   f10e3631ddaf
   postgres14-db-volume
   [+]  2/2t 2/22
    ✔ Container breeze-postgres-1 Started                                                                                                          0.1s
   Container breeze-postgres-1 Waiting
   Container breeze-postgres-1 Healthy
   Container breeze-airflow-run-66d31a62a97f Creating
   Container breeze-airflow-run-66d31a62a97f Created
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4125157520


##########
scripts/ci/docker-compose/backend-postgres.yml:
##########


Review Comment:
   Maybe, but that is separate to this PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4126645805


##########
scripts/ci/docker-compose/backend-postgres.yml:
##########
@@ -44,4 +47,7 @@ services:
     restart: "on-failure"
 volumes:
   postgres-data-volume:
-    name: "postgres${POSTGRES_VERSION}-db-volume"
+    labels:
+      org.apache.airflow.breeze: "true"
+      org.apache.airflow.breeze.worktree: "${BREEZE_WORKTREE_PATH:-}"
+    name: "${COMPOSE_PROJECT_NAME}-postgres${POSTGRES_VERSION}-db-volume"

Review Comment:
   Migration handled in next push. It looks like this when run:
   
   ```
   Stop containers ['f10e3631ddaf'] to migrate legacy Postgres volumes?
   Press y/N/q: y
   f10e3631ddaf
   Migrating postgres14-db-volume to breeze-postgres14-db-volume
   breeze-postgres14-db-volume
   f10e3631ddaf
   postgres14-db-volume
   [+]  2/2t 2/22
    ✔ Volume postgres14-db-volume Created                                                                                                          0.0s
    ✔ Container breeze-postgres-1 Started                                                                                                          0.1s
   Container breeze-postgres-1 Waiting
   Container breeze-postgres-1 Healthy
   Container breeze-airflow-run-66d31a62a97f Creating
   Container breeze-airflow-run-66d31a62a97f Created
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #73836:
URL: https://github.com/apache/airflow/pull/73836#issuecomment-5872588640

   It's alright, I've got it @potiuk.
   
   Also I think we can record the worktree as a label on the docker resources, so don't need to track things via files.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4125155158


##########
dev/breeze/doc/05_test_commands.rst:
##########
@@ -108,6 +108,20 @@ For example this will run API and WWW tests in parallel:
 
     breeze testing core-tests --parallel-test-types "API WWW" --run-in-parallel
 
+When testing separate worktrees concurrently, give each invocation a different
+``--project-name``. This isolates its containers, networks, and database volumes.
+The option also applies to ``breeze testing providers-tests``.
+
+.. code-block:: bash
+
+    breeze testing core-tests --project-name breeze-history --backend postgres
+    breeze testing core-tests --project-name breeze-clearing --backend postgres
+
+If you use this mode you will have to clean up old projects manually: 
+
+.. code-block:: bash
+    breeze down --project-name breeze-history

Review Comment:
   The pod name is different to the project name, so I don't understand your comment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #73836:
URL: https://github.com/apache/airflow/pull/73836#issuecomment-5872538380

   This will be way better - to automatically have a separate breeze per each worktree, there is no particular need to specify ` --project` manually in this case.
   
   If you want I can quickly implement this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project/per-worktree tests in parallel in Breeze [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #73836:
URL: https://github.com/apache/airflow/pull/73836#issuecomment-5869885788

   @potiuk  Isn't that my (as in the user's) choice? Many people don't use work trees, and you only pay this potential cost if you specify `--project-name`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #73836:
URL: https://github.com/apache/airflow/pull/73836#issuecomment-5887463905

   ### Backport failed to create: v3-3-test. View the failure log <a href='https://github.com/apache/airflow/actions/runs/36549214351'> Run details </a>
   
   Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
   the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.
   
   In matter of doubt please ask in [#release-management](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel.
   
   <table>
       <tr>
           <th>Status</th>
           <th>Branch</th>
           <th>Result</th>
       </tr>
       <tr>
           <td>❌</td>
           <td>v3-3-test</td>
           <td><a href="https://github.com/apache/airflow/commit/0768924a0cd97d28ea088ac0f7efe019c6bbce28"><img src='https://img.shields.io/badge/Commit-0768924-red' alt='Commit Link'></a></td>
       </tr>
   </table>
   
   You can attempt to backport this manually by running:
   
   ```bash
   cherry_picker 0768924 v3-3-test
   ```
   
   This should apply the commit to the v3-3-test branch and leave the commit in conflict state marking
   the files that need manual conflict resolution.
   
   After you have resolved the conflicts, you can continue the backport process by running:
   
   ```bash
   cherry_picker --continue
   ```
   
   If you don't have cherry-picker installed, see the [installation guide](https://github.com/apache/airflow/blob/main/dev/README.md#how-to-backport-pr-with-cherry-picker-cli).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4125327138


##########
dev/breeze/doc/05_test_commands.rst:
##########
@@ -108,6 +108,20 @@ For example this will run API and WWW tests in parallel:
 
     breeze testing core-tests --parallel-test-types "API WWW" --run-in-parallel
 
+When testing separate worktrees concurrently, give each invocation a different
+``--project-name``. This isolates its containers, networks, and database volumes.
+The option also applies to ``breeze testing providers-tests``.
+
+.. code-block:: bash
+
+    breeze testing core-tests --project-name breeze-history --backend postgres
+    breeze testing core-tests --project-name breeze-clearing --backend postgres
+
+If you use this mode you will have to clean up old projects manually: 
+
+.. code-block:: bash
+    breeze down --project-name breeze-history

Review Comment:
   Yes I mean the project name literally. 
   `breeze testing` is different from `breeze shell` here: shell passes `--project-name` to compose as-is, but testing builds `<value>-airflow-test-<test-type>` first:
   
   https://github.com/apache/airflow/blob/87c0d38164060743f4d9b98a130868fbd21c37db/dev/breeze/src/airflow_breeze/commands/testing_commands.py#L323-L330
   
   https://github.com/apache/airflow/blob/87c0d38164060743f4d9b98a130868fbd21c37db/dev/breeze/src/airflow_breeze/commands/testing_commands.py#L228-L238



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4127070948


##########
dev/breeze/doc/05_test_commands.rst:
##########
@@ -108,6 +108,20 @@ For example this will run API and WWW tests in parallel:
 
     breeze testing core-tests --parallel-test-types "API WWW" --run-in-parallel
 
+When testing separate worktrees concurrently, give each invocation a different
+``--project-name``. This isolates its containers, networks, and database volumes.
+The option also applies to ``breeze testing providers-tests``.
+
+.. code-block:: bash
+
+    breeze testing core-tests --project-name breeze-history --backend postgres
+    breeze testing core-tests --project-name breeze-clearing --backend postgres
+
+If you use this mode you will have to clean up old projects manually: 
+
+.. code-block:: bash
+    breeze down --project-name breeze-history

Review Comment:
   True. I'm sure there was a reason for it though.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4127080043


##########
dev/breeze/src/airflow_breeze/commands/developer_commands.py:
##########
@@ -1159,21 +1154,22 @@ def down(
     all_projects: bool,
     project_name: str | None,
 ):
-    perform_environment_checks()
-    brought_down, skipped = bring_all_compose_projects_down(
+    if all_projects and project_name:
+        raise click.UsageError("--all-projects and --project-name cannot be used together.")
+    perform_environment_checks(cleanup_stale_worktrees=False)
+    brought_down = bring_compose_projects_down(

Review Comment:
   Reverted it to how it was, and changed `--all-projects` to `--all-worktrees` to remove projects for all worktrees, not just missing ones.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #73836:
URL: https://github.com/apache/airflow/pull/73836#issuecomment-5872475449

   > I don't see anything related to worktree deletion in https://git-scm.com/docs/githooks. The CLI does nothing automatic to detect the current worktree. I could have three projects on the same main checkout, and that's by design.
   
   The use of workflows is that they are often created and deleted on demand - `claude -w` for one will create one, and when you complete working on it it will ask you whether to remove it. This will lead to many un-deleted docker-composes, because during agentic sesion/testing the LLM might simply start breeze to run tests - and used might not even be awary that they should clean-up.
   
   Breeze has been designed to handle just "several - but static set of projects" simply.
   
   We do it in Magpie, but indeed those hooks were Claude hooks.
   
   I think the easiest way is:
   
   1) record (in ~/.breeze) which worktrees (folders) breeze project runs on associate docker project with it
   2) at the start of any breeze command check if the folders still exist - and `docker compose --project PROJECT down --volumes --remove-orphans` for such project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #73836:
URL: https://github.com/apache/airflow/pull/73836#issuecomment-5872508874

   We could also run a reaper process for each worktree or one per all, but we do not need to **delete** the project immediately, it's enough that it is deleted automatically when the worktree is gone.  And when the worktree is gone, there is no way running project will have any use.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4125636631


##########
dev/breeze/src/airflow_breeze/utils/docker_command_utils.py:
##########
@@ -639,6 +638,11 @@ def perform_environment_checks(quiet: bool = False):
     check_uv_version(quiet)
     if not quiet:
         console_print(f"[success]Host python version is {sys.version}[/]")
+    if cleanup_stale_worktrees:

Review Comment:
   This runs from `perform_environment_checks()`, so every Docker-touching command now goes through it: `shell`, `start-airflow`, each `testing` run, and so on. But `_get_compose_resources()` (L989, L997) and the `stop`/`rm` calls in `bring_compose_projects_down()` (L1039, L1046) all use `check=True`.
   
   That turns routine races into failures of unrelated commands. For example, a container from a parallel `run --rm` test run disappears between `ls` and `inspect`, or `volume rm` hits a volume that's still attached. When that happens, a plain `breeze shell` in another checkout exits with `CalledProcessError`.
   
   For the opportunistic sweep, could it be best-effort? Use `check=False`, skip the IDs that failed and print one warning. The strict path can stay for an explicit `breeze down`.
   
   Related, and cheap: the `ls` only filters on `label=com.docker.compose.project`, so each command inspects every compose resource on the host, including non-breeze projects. Filtering on `label=org.apache.airflow.breeze.worktree` would limit the `inspect` to our own resources.
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting



##########
scripts/ci/docker-compose/backend-postgres.yml:
##########
@@ -44,4 +47,7 @@ services:
     restart: "on-failure"
 volumes:
   postgres-data-volume:
-    name: "postgres${POSTGRES_VERSION}-db-volume"
+    labels:
+      org.apache.airflow.breeze: "true"
+      org.apache.airflow.breeze.worktree: "${BREEZE_WORKTREE_PATH:-}"
+    name: "${COMPOSE_PROJECT_NAME}-postgres${POSTGRES_VERSION}-db-volume"

Review Comment:
   This renames the main checkout's volume from `postgres${POSTGRES_VERSION}-db-volume` to `breeze-postgres${POSTGRES_VERSION}-db-volume`. So everyone who upgrades breeze gets an empty Postgres DB in their main checkout without being told. The old volume stays behind. It's only pruned through the legacy `com.docker.compose.project=breeze` filter, and only if the `breeze` project created it.
   
   Could we keep the old name when the project is `breeze`? Or print a one-time notice when the old volume exists, with the command to remove it (or migrate it)? At minimum it deserves a line in `04_troubleshooting.rst`.
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting



##########
dev/breeze/src/airflow_breeze/utils/docker_command_utils.py:
##########
@@ -802,22 +806,61 @@ def pull_images_with_retries(
     return all_pulled
 
 
+def remove_stale_worktree_containers() -> None:
+    result = run_command(
+        [
+            "docker",
+            "ps",
+            "--all",
+            "--filter",
+            "label=org.apache.airflow.breeze=true",
+            "--format",
+            '{{.ID}}\t{{.Label "org.apache.airflow.breeze.worktree"}}',
+        ],
+        capture_output=True,
+        text=True,
+        check=False,
+    )
+    if result.returncode != 0:
+        console_print("[error]Unable to discover containers belonging to deleted worktrees.[/]")
+        return
+    for line in result.stdout.splitlines():
+        container_id, _, worktree = line.partition("\t")
+        if _worktree_is_missing(worktree):
+            console_print(f"Removing container {container_id} for deleted worktree {worktree}")
+            run_command(["docker", "rm", "--force", "--volumes", container_id], check=False)
+
+
+def _worktree_is_missing(worktree: str) -> bool:

Review Comment:
   Staleness is decided by whether the labelled path exists on the machine running breeze. The commit message notes this assumes the daemon is local. It isn't always:
   - `DOCKER_HOST` can point at a remote daemon or a shared VM.
   - Two clones on different hosts can use the same daemon.
   - Breeze can be invoked from inside a container, where host paths don't resolve.
   
   In all of these, a path missing *here* makes us remove someone else's running containers and DB volumes.
   
   Could we also stamp a host identifier (e.g. `org.apache.airflow.breeze.host`, set from the hostname or machine ID) next to `org.apache.airflow.breeze.worktree`? The sweep would then only consider resources whose host label matches the current host. It's one more label in the compose files and one extra condition in the selector.
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting



##########
dev/breeze/src/airflow_breeze/commands/developer_commands.py:
##########
@@ -1159,21 +1154,22 @@ def down(
     all_projects: bool,
     project_name: str | None,
 ):
-    perform_environment_checks()
-    brought_down, skipped = bring_all_compose_projects_down(
+    if all_projects and project_name:
+        raise click.UsageError("--all-projects and --project-name cannot be used together.")
+    perform_environment_checks(cleanup_stale_worktrees=False)
+    brought_down = bring_compose_projects_down(

Review Comment:
   The semantics of `breeze down` change quite a bit here. Before, a plain `breeze down` brought down every `breeze*` project: `breeze-docs`, `breeze-prek`, `breeze-airflow-test-*`, registry, release-management. That was the "one-shot cleanup" intent of `KNOWN_DOCKER_COMPOSE_PROJECT_PREFIXES`. Now it only brings down this checkout's default project plus stale worktrees, and the rest needs `--all-projects`.
   
   CI calls plain `breeze down` in `scripts/ci/testing/run_integration_tests_with_retry.sh` between retries, and in `.github/actions/migration_tests/action.yml`. The testing command downs its own project first, so I don't expect breakage. But it's a user-visible change that the PR description doesn't mention.
   
   Could plain `breeze down` keep bringing down all of *this checkout's* projects? That's everything labelled with the current worktree path (or with no path, in the main checkout), plus stale ones. Then it would still be the one-shot cleanup for "my" checkout.
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4126725624


##########
scripts/ci/docker-compose/backend-postgres.yml:
##########
@@ -44,4 +47,7 @@ services:
     restart: "on-failure"
 volumes:
   postgres-data-volume:
-    name: "postgres${POSTGRES_VERSION}-db-volume"
+    labels:
+      org.apache.airflow.breeze: "true"
+      org.apache.airflow.breeze.worktree: "${BREEZE_WORKTREE_PATH:-}"
+    name: "${COMPOSE_PROJECT_NAME}-postgres${POSTGRES_VERSION}-db-volume"

Review Comment:
   Soooooo, it turns out there is basically no point in migrating, cos the volumes have been empty since November 2025 https://github.com/apache/airflow/commit/9607baef89bc9bf50c2805edb19fff171a1e37e7
   
   I messed up the diff:
   
   ```
         - postgres-data-volume:/var/lib/postgresql/{$POSTGRES_VERSION}/docker
   ```
   Note, that is `{$` so it evaluates to `/var/lib/postgresql/{14}/docker` etc. Which means it creates a directory that nothing writes to.
   
   So since this has been broken for 10 months, I'll make the breeze code easier and just not deal with the empty volumes rather than have to always carry the migration code. (He says, already haven written it, and continually wondering why the migration was copying nothing)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4125327138


##########
dev/breeze/doc/05_test_commands.rst:
##########
@@ -108,6 +108,20 @@ For example this will run API and WWW tests in parallel:
 
     breeze testing core-tests --parallel-test-types "API WWW" --run-in-parallel
 
+When testing separate worktrees concurrently, give each invocation a different
+``--project-name``. This isolates its containers, networks, and database volumes.
+The option also applies to ``breeze testing providers-tests``.
+
+.. code-block:: bash
+
+    breeze testing core-tests --project-name breeze-history --backend postgres
+    breeze testing core-tests --project-name breeze-clearing --backend postgres
+
+If you use this mode you will have to clean up old projects manually: 
+
+.. code-block:: bash
+    breeze down --project-name breeze-history

Review Comment:
   Yes I mean the project name literally. (Docker Compose project name)
   `breeze testing` is different from `breeze shell` here: shell passes `--project-name` to compose as-is, but testing builds `<value>-airflow-test-<test-type>` first:
   
   https://github.com/apache/airflow/blob/87c0d38164060743f4d9b98a130868fbd21c37db/dev/breeze/src/airflow_breeze/commands/testing_commands.py#L323-L330
   
   https://github.com/apache/airflow/blob/87c0d38164060743f4d9b98a130868fbd21c37db/dev/breeze/src/airflow_breeze/commands/testing_commands.py#L228-L238



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4125327138


##########
dev/breeze/doc/05_test_commands.rst:
##########
@@ -108,6 +108,20 @@ For example this will run API and WWW tests in parallel:
 
     breeze testing core-tests --parallel-test-types "API WWW" --run-in-parallel
 
+When testing separate worktrees concurrently, give each invocation a different
+``--project-name``. This isolates its containers, networks, and database volumes.
+The option also applies to ``breeze testing providers-tests``.
+
+.. code-block:: bash
+
+    breeze testing core-tests --project-name breeze-history --backend postgres
+    breeze testing core-tests --project-name breeze-clearing --backend postgres
+
+If you use this mode you will have to clean up old projects manually: 
+
+.. code-block:: bash
+    breeze down --project-name breeze-history

Review Comment:
   Sorry I mean Docker Compose project name.
   `breeze testing` is different from `breeze shell` here: shell passes `--project-name` to compose as-is, but testing builds `<value>-airflow-test-<test-type>` first:
   
   https://github.com/apache/airflow/blob/87c0d38164060743f4d9b98a130868fbd21c37db/dev/breeze/src/airflow_breeze/commands/testing_commands.py#L323-L330
   
   https://github.com/apache/airflow/blob/87c0d38164060743f4d9b98a130868fbd21c37db/dev/breeze/src/airflow_breeze/commands/testing_commands.py#L228-L238



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4125365240


##########
dev/breeze/doc/05_test_commands.rst:
##########
@@ -108,6 +108,20 @@ For example this will run API and WWW tests in parallel:
 
     breeze testing core-tests --parallel-test-types "API WWW" --run-in-parallel
 
+When testing separate worktrees concurrently, give each invocation a different
+``--project-name``. This isolates its containers, networks, and database volumes.
+The option also applies to ``breeze testing providers-tests``.
+
+.. code-block:: bash
+
+    breeze testing core-tests --project-name breeze-history --backend postgres
+    breeze testing core-tests --project-name breeze-clearing --backend postgres
+
+If you use this mode you will have to clean up old projects manually: 
+
+.. code-block:: bash
+    breeze down --project-name breeze-history

Review Comment:
   In this case I start `breeze testing core-tests --project-name breeze-history --backend postgres`
   but I cannot `breeze down --project-name breeze-history` afterwards.
   
   Feels a bit weird to me as a user.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb merged PR #73836:
URL: https://github.com/apache/airflow/pull/73836


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project/per-worktree tests in parallel in Breeze [airflow]

Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4121818752


##########
dev/breeze/src/airflow_breeze/commands/testing_commands.py:
##########
@@ -323,9 +324,9 @@ def _get_project_names(shell_params: ShellParams) -> tuple[str, str]:
     """Return compose project name and project name."""
     project_name = file_name_from_test_type(shell_params.test_type)
     if shell_params.test_type == ALL_TEST_TYPE:
-        compose_project_name = "breeze-airflow-test"
+        compose_project_name = f"{shell_params.project_name}-airflow-test"
     else:
-        compose_project_name = f"breeze-airflow-test-{project_name}"
+        compose_project_name = f"{shell_params.project_name}-airflow-test-{project_name}"

Review Comment:
   ```suggestion
           compose_project_name = f"breeze-{shell_params.project_name}-airflow-test"
   else:
           compose_project_name = f"breeze-{shell_params.project_name}-airflow-test-{project_name}"
   ```
   
   maybe? (to give an indication that it's sourced from a breeze run)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project/per-worktree tests in parallel in Breeze [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4122354100


##########
dev/breeze/doc/05_test_commands.rst:
##########
@@ -108,6 +108,15 @@ For example this will run API and WWW tests in parallel:
 
     breeze testing core-tests --parallel-test-types "API WWW" --run-in-parallel
 
+When testing separate worktrees concurrently, give each invocation a different
+``--project-name``. This isolates its containers, networks, and database volumes.
+The option also applies to ``breeze testing providers-tests``.
+
+.. code-block:: bash
+
+    breeze testing core-tests --project-name breeze-history --backend postgres
+    breeze testing core-tests --project-name breeze-clearing --backend postgres
+

Review Comment:
   ```suggestion
   
   If you use this mode you will have to clean up old projects manually: 
   
   .. code-block:: bash
       breeze down --project-name breeze-history
       breeze down --project-name breeze-clearing
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #73836:
URL: https://github.com/apache/airflow/pull/73836#issuecomment-5870314379

   I'm looking at making `breeze cleanup` work for all projects, not just the current one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4124746963


##########
scripts/ci/docker-compose/backend-postgres.yml:
##########


Review Comment:
   Looks like this path never matched the correct directory... It should be `..../${POSTGRES_VERSION}/docker`, but currently the `$` is in the bracket.
   
   And as I know, Postgres 18 and all versions <= 17 use different PGDATA directories; could we also fix it here?
   
   About Postgres version and PGDATA path:
   https://github.com/docker-library/docs/blob/master/postgres/README.md#pgdata



##########
dev/breeze/doc/05_test_commands.rst:
##########
@@ -108,6 +108,20 @@ For example this will run API and WWW tests in parallel:
 
     breeze testing core-tests --parallel-test-types "API WWW" --run-in-parallel
 
+When testing separate worktrees concurrently, give each invocation a different
+``--project-name``. This isolates its containers, networks, and database volumes.
+The option also applies to ``breeze testing providers-tests``.
+
+.. code-block:: bash
+
+    breeze testing core-tests --project-name breeze-history --backend postgres
+    breeze testing core-tests --project-name breeze-clearing --backend postgres
+
+If you use this mode you will have to clean up old projects manually: 
+
+.. code-block:: bash
+    breeze down --project-name breeze-history

Review Comment:
   It seems like Breeze will add a suffix to the project name. 
   e.g. `breeze testing core-tests --project-name breeze-history --backend postgres` will create a project named `breeze-history-airflow-test-<test-type>`. 
   
   So developers cannot simply type `breeze down` with the project name `breeze-history`, and I found it kinda inconvenient.
   
   I guess developers won't know these project names, and since most of the test volumes are only used "once", what if we make the test runner remove its own volumes when the run finishes?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Allow isolated/per-project tests in parallel in Breeze [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4125365240


##########
dev/breeze/doc/05_test_commands.rst:
##########
@@ -108,6 +108,20 @@ For example this will run API and WWW tests in parallel:
 
     breeze testing core-tests --parallel-test-types "API WWW" --run-in-parallel
 
+When testing separate worktrees concurrently, give each invocation a different
+``--project-name``. This isolates its containers, networks, and database volumes.
+The option also applies to ``breeze testing providers-tests``.
+
+.. code-block:: bash
+
+    breeze testing core-tests --project-name breeze-history --backend postgres
+    breeze testing core-tests --project-name breeze-clearing --backend postgres
+
+If you use this mode you will have to clean up old projects manually: 
+
+.. code-block:: bash
+    breeze down --project-name breeze-history

Review Comment:
   In this case I start `breeze testing core-tests --project-name breeze-history --backend postgres`
   but I cannot `breeze down --project-name breeze-history` afterwards.
   
   Feels a bit weird to me.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Automatically isolate `breeze testing` for each git worktree in a totally isolated project. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #73836:
URL: https://github.com/apache/airflow/pull/73836#discussion_r4126123444


##########
dev/breeze/src/airflow_breeze/utils/docker_command_utils.py:
##########
@@ -802,22 +806,61 @@ def pull_images_with_retries(
     return all_pulled
 
 
+def remove_stale_worktree_containers() -> None:
+    result = run_command(
+        [
+            "docker",
+            "ps",
+            "--all",
+            "--filter",
+            "label=org.apache.airflow.breeze=true",
+            "--format",
+            '{{.ID}}\t{{.Label "org.apache.airflow.breeze.worktree"}}',
+        ],
+        capture_output=True,
+        text=True,
+        check=False,
+    )
+    if result.returncode != 0:
+        console_print("[error]Unable to discover containers belonging to deleted worktrees.[/]")
+        return
+    for line in result.stdout.splitlines():
+        container_id, _, worktree = line.partition("\t")
+        if _worktree_is_missing(worktree):
+            console_print(f"Removing container {container_id} for deleted worktree {worktree}")
+            run_command(["docker", "rm", "--force", "--volumes", container_id], check=False)
+
+
+def _worktree_is_missing(worktree: str) -> bool:

Review Comment:
   We could, but it feels like overkill to me -- just how often is it that two different machines will be pointing at the same docker host. Feels like rarest of edge cases?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org