Use FilePath for PublishSocket#1594
Open
chrisgeo wants to merge 1 commit into
Open
Conversation
Closes CHAOS-1459. Unblocks CHAOS-1463 (Parser).
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.
Type of Change
Motivation and Context
Migrates
PublishSocket.containerPathandPublishSocket.hostPathfromFoundation.URLtoSystemPackage.FilePath, consistent with the project-wide effort to replaceURL/Stringpaths with strongly-typedFilePath/SystemPathat API boundaries (#1480, #1493, #1518, #1522, #1523, #1570, #1574, #1580).PublishSocketwas the lastURL-typed path inContainerResource.URLis the wrong type for filesystem paths: it implies a navigable resource, permits non-file schemes, and forces consumers through percent-encoding when interoperating with POSIX APIs.FilePathis purpose-built,Sendable, and already used by both callers of this struct after the recent runtime reorg (#1577).Tracking issue: #1593
Wire-format compatibility
PublishSocketis serialized to disk as part of container bundles and over XPC. To keep this migration non-breaking on the wire:URL(filePath: path.string).absoluteString— byte-identical to the priorURL-typedJSONEncoderoutput (e.g."file:///var/run/docker.sock"). Existing bundles and any reader still decoding these fields asURLcontinue to work.file://form, plain absolute paths (forward-compat), and resolves percent-encoding. Empty, relative, malformed, or non-localhost-host inputs throwDecodingError.dataCorruptedso corrupt state fails loudly rather than silently producing an invalid socket path.Source compatibility
Source-breaking for any external consumer constructing
PublishSocketdirectly withURL. Acceptable given the pre-1.0 project status and the consistent direction of prior migrations.Testing
swift test --filter ContainerResourceTests— 50/50 passing)Tests/ContainerResourceTests/PublishSocketTests.swift, 14 cases covering:URLencoding (pinned via a siblingLegacyPublishSocketmirror)file://form, percent-encoded paths, andfile://localhost/...permissions"file:","file://", relative paths, and non-local-host file URLsBuild verified clean:
swift build --target ContainerRuntimeLinuxServer.