feat: accept compose x- extension fields#4
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compose2pod rejected any top-level key it did not explicitly support, so a compose document carrying a Compose extension field — e.g.
x-application-defaultsholding a YAML anchor for reuse — failed withunsupported top-level keys: ['x-application-defaults']. The Compose spec reserves thex-prefix for arbitrary user data that tools must ignore.This teaches
validate()to skip anyx--prefixed key silently at every mapping level it inspects: top level, service, and healthcheck. PyYAML'ssafe_loadalready resolves&anchorsand<<:merge keys at load time, so no code is needed for those — the only blocker was the leftover top-levelx-key.Changes
compose2pod/parsing.py:x-skip in the three key-validation loops; the top-level unknown-key check becomes a comprehension that also dropsx-keys._validate_servicewas split into_validate_service_healthcheck/_validate_service_volumeshelpers (behavior-preserving) to stay under ruff's McCabe limit once the extra branches were added.warnings == []guard for the silent decision) plus an end-to-end YAML-anchor test through_read_compose -> validate -> emit_script.architecture/supported-subset.mdcapability file (the accept/ignore/reject matrix, incl. the note thatbuildis accepted but never built —image_forsubstitutes--image); README subset section updated to point at it.Planning
Full-lane change bundle:
planning/changes/2026-07-04.01-extension-fields/(design + plan).Verification
just test-ci: 82 passed, 100% line coverage.just lint-ci: clean (ruffselect=ALL --no-fix, format, ty, eof-fixer, planning).