Skip to content

feat: Integrate IProcessInfoProvider IPC into core workflow#413

Merged
JusterZhu merged 5 commits into
masterfrom
issue/408-ipc-integration
May 25, 2026
Merged

feat: Integrate IProcessInfoProvider IPC into core workflow#413
JusterZhu merged 5 commits into
masterfrom
issue/408-ipc-integration

Conversation

@JusterZhu
Copy link
Copy Markdown
Collaborator

Summary

Replaces \Environments\ (encrypted file) IPC with \AutoProcessInfoProvider\ (NamedPipe > SharedMemory > EncryptedFile auto-fallback) for all ProcessInfo transfer paths.

Changes

  • ClientUpdateStrategy: sends ProcessInfo via \AutoProcessInfoProvider.SendAsync()\ after building it
  • SilentPollOrchestrator: replaces \Environments.SetEnvironmentVariable()\ with \AutoProcessInfoProvider.SendAsync()\ in \OnProcessExit\
  • GeneralUpdateBootstrap.InitializeFromEnvironment(): replaces \Environments.GetEnvironmentVariable()\ with \AutoProcessInfoProvider.ReceiveAsync()\

Benefits

  • NamedPipe: zero file residue, most secure IPC mechanism
  • SharedMemory: Linux-friendly, no filesystem residue
  • EncryptedFile: reliable fallback when pipes/shm unavailable
  • Auto-fallback ensures maximum cross-platform compatibility

Closes #408

Replace Environments (encrypted file) IPC with AutoProcessInfoProvider
(NamedPipe > SharedMemory > EncryptedFile auto-fallback) for all
ProcessInfo transfer paths:

- ClientUpdateStrategy: send ProcessInfo via AutoProcessInfoProvider
  after building it, providing zero-file-residue IPC for the upgrade path
- SilentPollOrchestrator: replace Environments.SetEnvironmentVariable
  with AutoProcessInfoProvider.SendAsync in OnProcessExit
- GeneralUpdateBootstrap.InitializeFromEnvironment: replace
  Environments.GetEnvironmentVariable with ReceiveAsync

Closes #408
Copilot AI review requested due to automatic review settings May 25, 2026 10:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates the IProcessInfoProvider IPC abstraction into the main client→upgrade workflow by replacing the legacy Environments (temp-file) transport for ProcessInfo with AutoProcessInfoProvider (NamedPipe → SharedMemory → EncryptedFile fallback).

Changes:

  • ClientUpdateStrategy now builds ProcessInfo and attempts to send it via AutoProcessInfoProvider.SendAsync().
  • SilentPollOrchestrator stores a prepared ProcessInfo and sends it via IPC on process exit instead of writing to Environments.
  • GeneralUpdateBootstrap.InitializeFromEnvironment() now attempts to receive ProcessInfo via AutoProcessInfoProvider.ReceiveAsync().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/c#/GeneralUpdate.Core/Strategy/ClientUpdateStrategy.cs Sends ProcessInfo via IPC after building it.
src/c#/GeneralUpdate.Core/Silent/SilentPollOrchestrator.cs Switches process-exit ProcessInfo handoff from Environments to IPC.
src/c#/GeneralUpdate.Core/Bootstrap/GeneralUpdateBootstrap.cs Receives ProcessInfo via IPC during bootstrap initialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +183 to +185
// Wire ProcessInfo via IPC (NamedPipe > SharedMemory > EncryptedFile)
await new AutoProcessInfoProvider().SendAsync(processInfo).ConfigureAwait(false);
GeneralTracer.Info("ClientUpdateStrategy: ProcessInfo sent via IPC (AutoProcessInfoProvider).");
Comment on lines +183 to +185
// Wire ProcessInfo via IPC (NamedPipe > SharedMemory > EncryptedFile)
await new AutoProcessInfoProvider().SendAsync(processInfo).ConfigureAwait(false);
GeneralTracer.Info("ClientUpdateStrategy: ProcessInfo sent via IPC (AutoProcessInfoProvider).");
Comment on lines +323 to +327
// Send ProcessInfo via IPC — the upgrade process connects as client
if (_preparedProcessInfo != null)
{
new AutoProcessInfoProvider().SendAsync(_preparedProcessInfo).GetAwaiter().GetResult();
GeneralTracer.Info("SilentPollOrchestrator: ProcessInfo sent via IPC.");
Comment on lines 260 to 264
// Read ProcessInfo via IPC (NamedPipe > SharedMemory > EncryptedFile auto-fallback).
// Sync wait is acceptable here — the constructor runs once and the
// IPC providers use short timeouts (5s NamedPipe, immediate MMF/file).
var processInfo = new AutoProcessInfoProvider().ReceiveAsync().GetAwaiter().GetResult();
if (processInfo == null) return;
JusterZhu added 4 commits May 25, 2026 18:35
Prevent indefinite blocking when no upgrade process connects:
- ClientUpdateStrategy: 3s NamedPipe timeout, auto-falls back to
  SharedMemory/EncryptedFile (normal client flow has no separate
  upgrade process)
- SilentPollOrchestrator.OnProcessExit: 5s NamedPipe timeout with
  SharedMemory/EncryptedFile auto-fallback for timing gaps

Related #408
…Memory/Auto

Per review feedback: EncryptedFile is the simplest and most reliable
cross-platform IPC mechanism. Remove NamedPipe (connection timing issues),
SharedMemory (platform-specific quirks), and Auto (fallback complexity).

Changes:
- IProcessInfoProvider.cs: retain only interface + EncryptedFileProcessInfoProvider
- All call sites use EncryptedFileProcessInfoProvider directly
- Remove CancellationToken timeouts (EncryptedFile is synchronous)

Related #408
Replace all .ReceiveAsync().GetAwaiter().GetResult() and
.SendAsync().GetAwaiter().GetResult() with direct sync calls.

- Add Send() / Receive() sync methods to EncryptedFileProcessInfoProvider
- GeneralUpdateBootstrap: use Receive() instead of ReceiveAsync().GetAwaiter()
- SilentPollOrchestrator: use Send() instead of SendAsync().GetAwaiter()
- ClientUpdateStrategy: use Send() instead of await SendAsync()

Related #408
Remove tests referencing deleted providers:
- NamedPipeProvider_DetectsTimeout
- SharedMemoryProvider_RoundTrip
- SharedMemoryProvider_ReceiveWithoutSend_ReturnsNull
- AutoProvider_FallsBackToEncryptedFile
- AutoProvider_ThrowsWhenAllFail

Replaced with EncryptedFileIpcTests covering:
- Send/Receive roundtrip
- Receive without send returns null
- Data confidentiality and single-read guarantee
- Async API delegates to sync

Related #408
@JusterZhu JusterZhu merged commit 9a1f15e into master May 25, 2026
3 checks passed
@JusterZhu JusterZhu deleted the issue/408-ipc-integration branch May 25, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Integrate IProcessInfoProvider IPC into core workflow

2 participants