You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[WSLC Compose 1/5] Establish project and resource identity - #42086
This is PR 1 of 5 in the WSLC Compose stack, split from #41526 into individually reviewable and buildable PRs.
Base:feature/compose
This PR establishes consistent project identity, resource naming, and ownership labels as the foundation for request-based Compose operations. It retains the existing synchronous Compose API and CLI command surface.
The review sequence is identity, operation engine, operation client, management, and interactive UX. These PR boundaries are not architectural layers.
PR Checklist
Closes: None.
Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
Tests: Added/updated if needed and all pass
Localization: All end user facing strings can be localized
Dev docs: Added/updated if needed
Documentation updated: If checked, please file a pull request on our docs repo and link it here: No documentation PR is included.
Detailed Description of the Pull Request / Additional comments
Introduce ComposeNormalizer to normalize project names and validate derived resource names before resource creation.
Default project identity to the normalized project-directory name. Generate container names as <project>-<service>-1 and the default network name as <project>_default, while honoring explicit container names.
Add standard com.docker.compose.* identity labels and WSLC managed/metadata-version labels to containers and networks.
Preserve service-name DNS aliases alongside container-name aliases so service discovery does not depend on generated physical names.
Separate YAML content parsing from file reading and introduce the internal document/selection model. File loading remains in the existing synchronous entry point.
Reject unsupported top-level properties and extract shared resource-name validation.
Async service operations, CLI migration, project listing/removal, and terminal progress/Ctrl+C handling are outside this PR and follow in later PRs.
Validation hardening
The following changes are included in published head 134b8809.
Reject empty or whitespace-only service names before mutation because service names are network aliases, including with an explicit container name.
Reject decoded NUL characters in service and resolved container names before crossing null-terminated APIs. Regressions cover leading/embedded NUL aliases and distinct container names sharing one C-string prefix. Encoding detection still receives the original document bytes.
Reject duplicate resolved physical container names before mutation, including generated/explicit and explicit/explicit collisions.
Pass the original document bytes to yaml-cpp so BOM-marked UTF-16 documents retain encoding detection. Regressions cover both byte orders and a non-ASCII environment value.
Reject an unsupported cross-file reuse of a cached normalized project with E_NOTIMPL before resource creation or replacement. Regressions verify same-file reuse, same-directory file switching, normalized-name collisions across directories, and preservation of the existing network ID.
Add localized diagnostics for duplicate names and unsupported file switching.
Add concise comments explaining YAML encoding detection, Windows drive colons in volume syntax, informational version metadata, service-name aliases, and the cache safety boundary.
Scaffolding limits and architectural ownership
This stack is scaffolding, not a claim of complete Docker Compose compatibility.
The synchronous API caches sessions by canonical source-file path and retains each session's captured definition. Reopening the same file returns that cached session without reinterpreting edits. The safety guard explicitly rejects a different source file resolving to an already cached project before it can replace that project's default network.
That guard is an unsupported-operation limit of this synchronous API, not a single-file-per-project identity rule. The normalized project name remains the project identity within the owning WSLC session; a filename is an input to an invocation, not a separate project namespace.
Parsing and normalization own interpretation. Reconciliation owns desired-versus-observed resource decisions. Desired-definition updates, idempotent resource reuse, and configuration-driven recreation/orphan behavior remain future reconciler work; the later operation-plumbing PRs do not by themselves complete those semantics.
Validation Steps Performed
Validation is local, with broader regression coverage left to CI. The identity build and focused tests are repeated for published head 134b8809, including the decoded-NUL regressions.
Expected red runs against the unchanged production code at 914e02d9:
Command
Result
.\bin\x64\Debug\test.bat '/name:*Compose*'
Failed as expected: 5 passed, 9 failed. Whitespace-only service names removed the preexisting network. A duplicate resolved name triggered a service assertion, invalidating subsequent results.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical validation and session-identity gaps can delete or replace existing networks before conflicts are detected, while the new NUL-byte check also rejects valid UTF-16 Compose files.
This rejects valid UTF-16 Compose files: their encoded bytes contain NULs even though the decoded YAML does not. The previous YAML::LoadFile path supported BOM-marked UTF-16, so files written by Windows PowerShell's default Out-File now fail with E_INVALIDARG before parsing. Let the YAML parser perform encoding validation rather than rejecting zero bytes in the encoded document.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Embedded NULs in service and container names bypass preflight validation, allowing name collisions or empty aliases to cause failures after the existing default network has already been replaced.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed to weigh the user-facing impact of untranslated validation details and directory-derived project-name failures that lack an explanatory diagnostic.
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
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 of the Pull Request
This is PR 1 of 5 in the WSLC Compose stack, split from #41526 into individually reviewable and buildable PRs.
Base:
feature/composeThis PR establishes consistent project identity, resource naming, and ownership labels as the foundation for request-based Compose operations. It retains the existing synchronous Compose API and CLI command surface.
The review sequence is identity, operation engine, operation client, management, and interactive UX. These PR boundaries are not architectural layers.
PR Checklist
Detailed Description of the Pull Request / Additional comments
ComposeNormalizerto normalize project names and validate derived resource names before resource creation.<project>-<service>-1and the default network name as<project>_default, while honoring explicit container names.com.docker.compose.*identity labels and WSLC managed/metadata-version labels to containers and networks.Async service operations, CLI migration, project listing/removal, and terminal progress/Ctrl+C handling are outside this PR and follow in later PRs.
Validation hardening
The following changes are included in published head
134b8809.E_NOTIMPLbefore resource creation or replacement. Regressions verify same-file reuse, same-directory file switching, normalized-name collisions across directories, and preservation of the existing network ID.versionmetadata, service-name aliases, and the cache safety boundary.Scaffolding limits and architectural ownership
This stack is scaffolding, not a claim of complete Docker Compose compatibility.
The synchronous API caches sessions by canonical source-file path and retains each session's captured definition. Reopening the same file returns that cached session without reinterpreting edits. The safety guard explicitly rejects a different source file resolving to an already cached project before it can replace that project's default network.
That guard is an unsupported-operation limit of this synchronous API, not a single-file-per-project identity rule. The normalized project name remains the project identity within the owning WSLC session; a filename is an input to an invocation, not a separate project namespace.
Parsing and normalization own interpretation. Reconciliation owns desired-versus-observed resource decisions. Desired-definition updates, idempotent resource reuse, and configuration-driven recreation/orphan behavior remain future reconciler work; the later operation-plumbing PRs do not by themselves complete those semantics.
Validation Steps Performed
Validation is local, with broader regression coverage left to CI. The identity build and focused tests are repeated for published head
134b8809, including the decoded-NUL regressions.Expected red runs against the unchanged production code at
914e02d9:.\bin\x64\Debug\test.bat '/name:*Compose*'.\bin\x64\Debug\test.bat -f '/name:*ComposeUtf16*'E_INVALIDARG, reproducing rejection of valid UTF-16 documents independently of the assertion..\bin\x64\Debug\test.bat -f '/name:*ComposeSession*BeforeMutation*'Local configuration, build, and checks:
cmake ..\FormatSource.ps1cmake --build . -- -m134b8809..\bin\x64\Debug\test.bat '/name:*Compose*'134b8809; 17/17, no skipped or blocked tests. Setup enabled, no-f..\FormatSource.ps1 -Branch -BaseBranch feature/compose -Verify $truepython tools\devops\validate-localization.pypython tools\devops\validate-copyright-headers.py src\windows\wslcsessionpython tools\devops\validate-copyright-headers.py test\windows\wslcgit diff --check