Skip to content

Make required variable reporting deterministic#13957

Open
ousamabenyounes wants to merge 1 commit into
docker:mainfrom
ousamabenyounes:fix/issue-13712
Open

Make required variable reporting deterministic#13957
ousamabenyounes wants to merge 1 commit into
docker:mainfrom
ousamabenyounes:fix/issue-13712

Conversation

@ousamabenyounes

Copy link
Copy Markdown

What I did

Make Compose required-variable handling deterministic before project interpolation runs.

  • preflight the non-interpolated model for required variables and report the first missing variable in sorted order
  • use a Compose-side variable extractor that walks maps deterministically
  • merge duplicate variable occurrences so a required use is not overwritten by a non-required use

Related issue

Fixes #13712
Fixes #13718

Test verification (RED -> GREEN)

RED for #13712 on origin/main with the issue repro run 20 times:

5: error while interpolating services.traefik.volumes.[].source: required variable TRAEFIK_ACME_PATH is missing a value
11: error while interpolating services.traefik.volumes.[].source: required variable TRAEFIK_ACME_PATH is missing a value
15: error while interpolating services.traefik.volumes.[].source: required variable TRAEFIK_ACME_PATH is missing a value

GREEN for #13712 on this branch with the same repro:

1: required variable TIMEZONE is missing a value
2: required variable TIMEZONE is missing a value
3: required variable TIMEZONE is missing a value
10: required variable TIMEZONE is missing a value

RED for #13718 on origin/main:

{
    "PIHOLE_DOMAIN": {
        "Name": "PIHOLE_DOMAIN",
        "DefaultValue": "",
        "PresenceValue": "",
        "Required": false
    }
}

GREEN for #13718 on this branch:

{
    "PIHOLE_DOMAIN": {
        "Name": "PIHOLE_DOMAIN",
        "DefaultValue": "",
        "PresenceValue": "",
        "Required": true
    }
}

Full local suite:

go test ./pkg/compose -count=1
ok  	github.com/docker/compose/v5/pkg/compose	0.527s

make test
DONE 511 tests, 2 skipped in 10.199s

Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
@ousamabenyounes
ousamabenyounes requested review from a team as code owners July 21, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant