compose/pkg
Nicolas De Loof 0a64ff09a8 fix: address copilot-pull-request-reviewer's 3 findings on the hook-runner plan
A GitHub Copilot PR review (docker/compose#14221#pullrequestreview-5300897216)
found three real issues in the reconciliation-plan-based hook runners, all
confirmed by direct reproduction against a live daemon before being fixed:

- **Hook runners excluded from discovery, stale runners persist.**
  collectObservedState's single getContainers call requires ConfigHashLabel
  (getDefaultFilters), which hook runners deliberately never carry -- so they
  never reached the classification loop that populates HookContainers, and
  planPreStartHookRunners never saw a stale runner to purge. Reproduced: a
  failed hook run followed by a second `up` failed with "container name ...
  already in use" instead of recovering. Fixed by listing hook containers
  separately, by project+hook label alone (new getHookContainers), and
  merging them in before classification. Locked in by a new e2e scenario,
  TestPreStartHookRetryAfterFailureSucceeds, that reproduces the exact
  failure-then-retry sequence.

- **Prepared hook runners misclassified as service replicas.** start's
  containers.filter(isService(name), isNotOneOff) has no reason to exclude a
  hook runner: it carries the same project/service labels as a real replica
  and no one-off label either. Added isNotHookContainer to the filter chain
  in startService, so a hook runner is never counted as (or started as) a
  surviving replica.

- **Per-replica hooks create runners before unsupported configuration is
  rejected.** per_replica is not yet supported (#14259): runPreStart
  validates every hook up front and rejects the whole service before
  executing any of them, but planPreStartHookRunners had no equivalent
  check, so create/up would plan (and leave behind) runners for a service
  whose hooks could never run. Mirrored the same up-front, all-or-nothing
  validation in planPreStartHookRunners.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-09-30 12:03:10 +02:00
..
api feat: reconciliation plan creates pre_start hook runners 2026-09-30 12:03:10 +02:00
bridge build(deps): adopt compose-go jobs and the container-spec layering 2026-09-21 16:35:20 +02:00
compose fix: address copilot-pull-request-reviewer's 3 findings on the hook-runner plan 2026-09-30 12:03:10 +02:00
dryrun feat: reconciliation plan creates pre_start hook runners 2026-09-30 12:03:10 +02:00
e2e fix: address copilot-pull-request-reviewer's 3 findings on the hook-runner plan 2026-09-30 12:03:10 +02:00
mocks PRIVATE_PORT optional for docker compose port 2026-09-11 11:35:18 +02:00
remote golangci-lint: enable perfsprint linter 2026-09-10 10:25:34 +02:00
utils fix: make e2e tests pass reliably locally with Docker Desktop 2026-05-18 10:55:41 +02:00
watch golangci-lint: enable perfsprint linter 2026-09-10 10:25:34 +02:00