Skip to content

fix(reset): substitute alias target under merge key#878

Merged
glours merged 1 commit into
compose-spec:mainfrom
glours:fix/merge-alias-to-sequence
Jun 22, 2026
Merged

fix(reset): substitute alias target under merge key#878
glours merged 1 commit into
compose-spec:mainfrom
glours:fix/merge-alias-to-sequence

Conversation

@glours

@glours glours commented May 27, 2026

Copy link
Copy Markdown
Collaborator

The reset processor stopped dereferencing aliases during its tree walk in 468e314, leaving AliasNodes intact in the resulting Content. The YAML library's merge handler only accepts an AliasNode under << when its target is a MappingNode; alias-to-SequenceNode is rejected even though the spec-defined "sequence of mappings" form works inline. Compose files using <<: *anchor against a list-shaped anchor consequently failed to load.

Substitute the resolved target only for the << key. Other keys continue to preserve their AliasNode so downstream traversal is unaffected.

Fixes docker/compose#13812.

@glours glours requested a review from ndeloof as a code owner May 27, 2026 08:56
@glours glours self-assigned this May 27, 2026
The reset processor stopped dereferencing aliases during its tree walk
in 468e314, leaving AliasNodes intact in the resulting Content. The
YAML library's merge handler only accepts an AliasNode under `<<` when
its target is a MappingNode; alias-to-SequenceNode is rejected even
though the spec-defined "sequence of mappings" form works inline.
Compose files using `<<: *anchor` against a list-shaped anchor
consequently failed to load.

Substitute the resolved target only for the `<<` key. Other keys
continue to preserve their AliasNode so downstream traversal is
unaffected.

Fixes docker/compose#13812.

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
@glours glours force-pushed the fix/merge-alias-to-sequence branch from 05ffe4b to af99727 Compare June 22, 2026 17:12
@glours glours enabled auto-merge (rebase) June 22, 2026 17:12
@glours glours merged commit 7c70f41 into compose-spec:main Jun 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] v5.1.4 error -> yaml: map merge requires map or sequence of maps as the value

2 participants