fix(plugins): avoid exposing compilation result internals - #10363
Open
agisilaos wants to merge 2 commits into
Open
fix(plugins): avoid exposing compilation result internals#10363agisilaos wants to merge 2 commits into
agisilaos wants to merge 2 commits into
Conversation
What changed: - Replace the interpolated PluginCompilationResult with a concise compilation failure message. Why: - Issue swiftlang#8091 exposes internal command lines, paths, and captured compiler output in a user-facing error. - The script runner now prints actionable compiler diagnostics separately. Alternatives considered: - Customizing the result debug description was rejected because structured compilation state should not be part of a user-facing diagnostic.
What changed: - Add focused unit coverage for the plugin compilation failure description. - Extend the existing build-tool regression test to reject leaked internal result fields. Why: - Issue swiftlang#8091 is an output-formatting regression that should not expose internal compilation state. - Reusing upstream coverage keeps native and SwiftBuild behavior covered without duplicate fixtures. Alternatives considered: - Keeping separate fixtures and verbosity scenarios was rejected because upstream PR swiftlang#10346 now covers diagnostic visibility and verbosity.
agisilaos
requested review from
bkhouri,
bripeticca,
cmcgee1024,
daveinglis,
daveyc123,
dschaefer2,
jakepetroules,
owenv,
plemarquand and
rconnell9
as code owners
July 29, 2026 19:28
Contributor
|
@swift-ci test |
Contributor
Author
|
@bripeticca Thanks for triggering CI. I took some time and I reviewed the three failures and they appear unrelated:
Would you mind taking a look or rerunning the external jobs when convenient? |
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.
Fixes #8091
Summary
Avoid exposing the internal
PluginCompilationResultrepresentation when plugin compilation fails.SwiftPM currently interpolates the entire result into the user-facing error. This includes the compiler command line, executable and diagnostics paths, cached state, and captured compiler output.
The plugin runner already surfaces the actionable compiler diagnostic separately, so including the structured result is noisy, exposes implementation details, and can duplicate compiler output.
Changes
plugin compilation failedmessage.PluginCompilationResultand its internal fields are not included.Alternatives considered
Customizing
PluginCompilationResult’s debug representation was considered. However, the result contains structured compilation state that should not be part of a user-facing diagnostic.Routing compiler output through additional build-system delegates was also considered. This is no longer necessary because #10346 centralized compiler-output handling in the plugin script runner and already covers diagnostic visibility and verbosity behavior.
Notes
The
PluginCompilationResultremains attached to the error and available to callers. This change only prevents its debug representation from being rendered directly to users.Successful plugin compilation and compiler-diagnostic visibility are unchanged.
Testing
swift test --filter PluginInvocationTests.testCompilationFailureDescriptionDoesNotIncludeDebugResult --filter buildToolPluginCompilerErrorIsVisible