Make Configuration introspectable#268
Draft
broken-circle wants to merge 1 commit into
Draft
Conversation
eabae88 to
bbd9ecb
Compare
Contributor
|
The capability is nice, but I'm a little concerned about the use of enums in public API -- usually that's discouraged. I'm not sure what other good options there are, though. |
Member
|
Making it a |
Contributor
Author
|
Nice, I was just wondering if something like We could annotate
|
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.
Closes #206.
This PR adds public introspection of
Arguments,Executable, andEnvironmentso callers generating subprocess configurations can unit-test them without spawning a subprocess. The current storage of these types is opaque, leaving callers with only string-based descriptions to parse.Design
Argumentsconforms toRandomAccessCollection<Arguments.Value>, whereValueis a public mirror of the internalStringOrRawBytes. AValueenum was chosen over lossy UTF-8 decoding so callers constructing arguments from[UInt8]on POSIX can verify the exact bytes.Arguments.executablePathOverrideis exposed as a separate public property rather than folded into iteration. Folding would makeargv[0]ambiguous between an override and a regular first argument, and would prevent callers from distinguishing the two cases in tests. The internal stored property is renamed to_executablePathOverrideto free the name for the public accessor.ExecutableandEnvironmentexpose their contents through newRepresentationmirror enums rather than exposing their internal storage types directly, decoupling the public introspection surface from internal storage.Environment.Key.pathis promoted frompackagetopublicso callers can use it as a canonical reference to thePATHkey.Testing
The full test suite passes locally on macOS, and on
windows-latestandubuntu-latestusing GitHub Actions.