Skip to content

Add payload-local WSMan provider source scaffold - #41

Closed
Marc-André Moreau (mamoreau-devolutions) wants to merge 1 commit into
downstream/v7.6.6from
copilot/wsman-provider-source
Closed

Marc-André Moreau (mamoreau-devolutions) wants to merge 1 commit into
downstream/v7.6.6from
copilot/wsman-provider-source

Conversation

@mamoreau-devolutions

Copy link
Copy Markdown
Contributor

PR Summary

Add the payload-local devolutions.wsman provider scaffold and its 18 focused regressions to the actual PowerShell source history. This is the source half of the two-PR correction paired with packaging #40, not an operational WSMan implementation.

  • Provider source: src\Devolutions.MultiPwsh.Remoting.WSMan.
  • Tests: test\Devolutions.MultiPwsh.Remoting.WSMan.Tests, with the existing ..\..\src ProjectReference preserved.
  • Transfer the five provider files and two test files from reviewed packaging commit d690380a4c099029f690266946cbe04c59f7c53c; the only code adjustment is mechanically sorting the existing test imports for the source formatting gate. Preserve integer enum rejection, the null endpoint guard, and the valid-arguments NotSupportedException regression.
  • Add a source-local README documenting the build boundary, contract, option semantics, and blockers. No existing SMA source, packaging scripts, source build graph, workflow, or upstream tree is changed.

PR Context

Source-branch ownership and packaging dependency

master contains distribution tooling; downstream/v7.6.6 contains the PowerShell source history. This feature branch starts at source commit 51f58e2eeafbd52e9cbfd75eb1b1d4150296130a and targets downstream/v7.6.6, not master. The shared downstream branch has not been modified or pushed.

Packaging #40 will pin pwsh-src to this feature commit, remove the duplicated provider source from packaging master, and explicitly build/test these source paths. These standalone projects are intentionally outside the PowerShell engine project-reference graph and existing test\xUnit runner. They do not import PowerShell.Common.props or test\Test.Common.props, which impose engine-specific signing, versioning, analyzer packages, and Microsoft ownership metadata. The source .editorconfig applies; existing ignore rules already cover generated bin, obj, DLL, and NuGet package outputs. No generated artifacts are in this diff.

The transferred C# source has not been given an assumed Microsoft copyright/license header. No RDM source or licensing assumptions are introduced.

Exact managed reflection contract

Type: Devolutions.MultiPwsh.Remoting.WSMan.DevolutionsWsmanAdapter, public parameterless constructor.

Public static properties: ProviderId : string, ContractHash : string, ProviderVersion : string, Capabilities : ulong.

Public instance method:

RunspacePool CreateRunspacePool(
    string optionsJson,
    PSCredential credential,
    Func<string, int, bool, CancellationToken, Task<Stream>> connector)

Descriptor:

devolutions.wsman|1|static ProviderId:string|static ContractHash:string|static ProviderVersion:string|static Capabilities:uint64|ctor()|CreateRunspacePool(string,PSCredential,Func<string,int,bool,CancellationToken,Task<Stream>>):RunspacePool

SHA-256: 836ea45ab6a3169cc786392cf9db644ac2e6fe59494f514e6a4f94f2a5cd20f9; provider ID devolutions.wsman; provider version 0.1.0.

Capabilities remains 0. CreateRunspacePool validates its arguments/options and throws NotSupportedException for valid arguments. Reserved enum bits do not advertise transport/authentication functionality. SMA types stay inside the managed payload, not across the MultiPwsh NativeAOT boundary. Manifest and options-schema semantics remain unchanged, including endpoint path-to-AppName mapping, connection limits, SSPI selection, effective cancel-timeout floor, KDC proxy text, and the 512 KB envelope default.

Deferred blockers

The RDM WSMan/SSPI source closure is not copied: file-level ownership/licensing provenance must be resolved before extraction. Operational managed transport and patched-SMA integration remain separate work.

The project default remains AdapterTargetFramework=net8.0, but the actual patched SMA source currently targets net10.0. The .NET 8 compatibility blocker is not resolved by this scaffold. Packaging derives the effective framework from PowerShell.Common.props and passes AdapterTargetFramework explicitly. Compilation requires caller-supplied PowerShellSdkVendor=Devolutions and PowerShellSdkAssemblyPath pointing to the Devolutions source-built SMA. There is no stock SMA/PowerShell SDK package reference; the vendor property is a caller assertion, not independent provenance attestation.

Validation evidence

SDK selected by source global.json: 10.0.401. Provider/test framework: net10.0, derived from PowerShell.Common.props.

The provider tests use the already source-built patched assembly in the packaging parent's local SDK output:

$env:AdapterTargetFramework = 'net10.0'
$env:PowerShellSdkVendor = 'Devolutions'
$env:PowerShellSdkAssemblyPath = 'D:\dev\.copilot\copilot-worktrees\pwsh-distro\copilot-solid-meme\output\local-sdk\win-x64\PowerShell-AppHost\System.Management.Automation.dll'
dotnet format .\test\Devolutions.MultiPwsh.Remoting.WSMan.Tests\Devolutions.MultiPwsh.Remoting.WSMan.Tests.csproj --verify-no-changes --no-restore --verbosity minimal
dotnet test .\test\Devolutions.MultiPwsh.Remoting.WSMan.Tests\Devolutions.MultiPwsh.Remoting.WSMan.Tests.csproj --configuration Release -p:TreatWarningsAsErrors=true -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true --verbosity minimal

Passed: full formatting verification after import sorting; Passed: 18, Failed: 0, Skipped: 0. Release provider/test build completed with warnings-as-errors and analyzers enabled, with no warnings/errors. SMA input SHA-256: 1d4e9f3671a2d3a5d163d61f5512b8fe908e5a57d0fec2575187161d76cad971.

Source build/analyzer gate, run from this isolated source checkout:

pwsh -NoProfile -Command '$ErrorActionPreference = "Stop"; $env:PowerShellVendor = "Devolutions"; Import-Module .\build.psm1; Start-PSBuild -Configuration StaticAnalysis -Runtime win7-x64 -ReleaseTag v7.6.6 -NoPSModuleRestore -UseNuGetOrg'

Passed: full PowerShell source publish, source Roslyn analyzers enabled (no SkipRoslynAnalyzers), reference-assembly publication, and configuration generation. Only existing namespaced-tag warnings and the experimental-features-disabled configuration warning were emitted. The resulting source-built host starts as PowerShell 7.6.6 and SMA reports .NETCoreApp,Version=v10.0.

Passed: direct dotnet msbuild ... -t:ValidateDevolutionsPowerShellSdkReference -p:AdapterTargetFramework=net10.0 negative cases rejected missing vendor, missing SMA path, and nonexistent SMA with the expected errors. Manifest/schema parse and git diff refs/remotes/origin/downstream/v7.6.6...HEAD --check passed. Verified all six non-test-source transferred blobs match the reviewed parent commit; all test bodies remain unchanged.

Full source Pester/xUnit suites and hosted CodeQL execution were not run locally; no engine behavior is changed. The canonical full distro/package gate belongs to packaging #40 and is not claimed here.

PR Checklist

Move the reviewed provider scaffold and focused regressions into the downstream PowerShell source history. Keep the provider standalone with explicit patched-SMA references and document transport and net8 compatibility blockers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mamoreau-devolutions

Copy link
Copy Markdown
Contributor Author

Superseded by the user-directed decision to implement remoting at the MultiPwsh level rather than add a separate provider assembly. The downstream/v7.6.6 base already exposes the provider registry and transport extension points needed for direct managed registration, so no additional PowerShell source patch is required for that integration. No RDM WSMan/SSPI transport source was copied by this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant