Docker compose healthchecks and overriding

According to this document, any similarly named tags should override. It doesn’t specify any limitations.
Merge and override | Docker Documentation

And even states:

Shell commands

When merging Compose files that use the services attributes command, entrypoint and healthcheck: test, the value is overridden by the latest Compose file, and not appended.

So for the following docker-compose:

caddy:
    container_name: caddy
    restart: always
    mem_limit: 75m
    healthcheck:
      # https://stackoverflow.com/a/47722899/5008962
      test: ["CMD", "wget", "--no-verbose", "-T","1", "http://localhost:2019/metrics","-O","-" ]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    logging:
      driver: journald
      options:
        tag: "{{.Name}}/{{.ID}}"
    labels:
      - "autoheal=true"
      - com.centurylinklabs.watchtower.enable=false
    build:
      context: "/hdd/docker-data/network_access/caddy/docker/"
      dockerfile: dockerfile

Looking specifically at the healthcheck, I want to override this with a machine override:
docker-compose-mymachine.yml

caddy:
    healthcheck:
      # I tried adding '&& exit 1',  '|| exit `' it doesn't work.
      test: !reset bash -c "test  -f  /podcasts/hello && exit 0 || exit 1"
      interval: 5m
      timeout: 30s
      retries: 3
      start_period: 40s

I run these with the following command:
docker-compose -f docker-compose.yml -f docker-compose-mymachine.yml up -d

The resulting container though, has the following on the healthcheck:

{
  "Test": [
    "CMD",
    "wget",
    "--no-verbose",
    "-T",
    "1",
    "http://localhost:2019/metrics",
    "-O",
    "-",
    "CMD-SHELL",
    "bash -c \"test  -f  /podcasts/hello && exit 0 || exit 1\""
  ],
  "Interval": 300000000000,
  "Timeout": 30000000000,
  "StartPeriod": 40000000000,
  "Retries": 3
}

So it’s added the 2 tests. IS that beause its added CMD-SHELL to the test? Though given the keyword value is test, I’d have expected the mymachine healthcheck to override the test value entirely.

Docker-Compose is
Docker Compose version v2.4.1
Docker compose file versions 2.3

Ran into the exact same problem with Docker v24.0.2, docker-compose v2.3.3

any clue how to fix it without using evironment variables for the healthcheck scripts?