Skip to content

Add driver update functionality via Drivelution integration#145

Merged
JusterZhu merged 5 commits intomasterfrom
copilot/add-driver-update-functionality
Feb 11, 2026
Merged

Add driver update functionality via Drivelution integration#145
JusterZhu merged 5 commits intomasterfrom
copilot/add-driver-update-functionality

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Implementation Plan for Driver Update Functionality

  • Add all Drivelution files to GeneralUpdate.Core/Common via project references
    • Added multi-target framework support (netstandard2.0;net8.0) to GeneralUpdate.Core
    • Added ProjectReference to GeneralUpdate.Drivelution for net8.0 target only
    • Used conditional compilation for driver-specific code
  • Add driver directory field to PipelineContext usage
    • Added DriverDirectory field to BaseConfigInfo (inherited by Configinfo and GlobalConfigInfo)
    • Added DriverDirectory to ProcessInfo for inter-process communication
    • Updated ConfigurationMapper to map DriverDirectory across all config classes
    • Updated InitializeFromEnvironment in GeneralUpdateBootstrap to read DriverDirectory from ProcessInfo
    • Updated CreatePipelineContext in WindowsStrategy to include driver directory
    • Updated CreatePipelineContext in LinuxStrategy to include driver directory
    • Removed unused FieldMappings from both strategy implementations
  • Create DrivelutionMiddleware
    • Implemented IMiddleware interface
    • Retrieves driver directory from PipelineContext
    • Calls GetDriversFromDirectoryAsync to locate drivers
    • Calls QuickUpdateAsync for each driver found
    • Added proper error handling and logging with detailed error messages
  • Integrate DrivelutionMiddleware into Pipeline
    • Added middleware to WindowsStrategy.BuildPipeline
    • Added middleware to LinuxStrategy.BuildPipeline
    • Used conditional UseMiddlewareIf based on DriveEnabled flag
  • Test the implementation
    • Verified the code compiles successfully for both netstandard2.0 and net8.0
    • Ran existing tests - all 26 tests passed
    • Built entire solution - succeeded with no errors
  • Code review and security check
    • Addressed code review feedback (improved error messages)
    • Ran CodeQL security check - no vulnerabilities found
    • Removed unused FieldMappings code per reviewer feedback
    • Added DriverDirectory support throughout entire configuration pipeline

Configuration Flow

The DriverDirectory is now properly propagated through the entire configuration chain:

  1. User Configuration → User sets DriverDirectory in Configinfo
  2. Runtime ConfigurationConfigurationMapper.MapToGlobalConfigInfo maps it to GlobalConfigInfo
  3. Inter-Process CommunicationConfigurationMapper.MapToProcessInfo includes it in ProcessInfo
  4. Environment DeserializationInitializeFromEnvironment reads it back from ProcessInfo JSON
  5. Pipeline Context → Strategies add it to PipelineContext
  6. Middleware ExecutionDrivelutionMiddleware retrieves and uses it

This ensures that driver directory configuration is correctly handled across all upstream and downstream components in the update workflow.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add driver update functionality to GeneralUpdate.Core</issue_title>
<issue_description>1.Add references to all files in GeneralUpdate.Drivelution to GeneralUpdate.Core/Common. If you are unsure how to do this, refer to the previous method used to add files to Common.
2.Add DrivelutionMiddleware to the Pipeline, add a driver directory field and related logic code in PipelineContext, then integrate the GeneralUpdate.Drivelution functionality into DrivelutionMiddleware. The general approach is to first retrieve the directory required by GetDriversFromDirectoryAsync from PipelineContext, locate the corresponding drivers, and then call QuickUpdateAsync to perform the installation.
3.Please supplement any content not mentioned or considered above based on the code context.</issue_description>

<agent_instructions>Please fully understand the issue and the contextual logic of the code, then go through complete thinking and analysis before writing and designing the code.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 11, 2026 13:08
- Added multi-target framework support (netstandard2.0 and net8.0) to GeneralUpdate.Core
- Added ProjectReference to GeneralUpdate.Drivelution for net8.0 target
- Added DriverDirectory field to GlobalConfigInfo for specifying driver file location
- Created DrivelutionMiddleware to integrate driver update functionality
- Updated WindowsStrategy and LinuxStrategy to support driver updates
- DrivelutionMiddleware retrieves drivers from directory and calls QuickUpdateAsync for installation
- Used conditional compilation to ensure driver update features only available in net8.0 target

Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
Copilot AI changed the title [WIP] Add driver update functionality to GeneralUpdate.Core Add driver update functionality via Drivelution integration Feb 11, 2026
Copilot AI requested a review from JusterZhu February 11, 2026 13:13
{
context.Add("DriverOutPut", StorageManager.GetTempDirectory("DriverOutPut"));
context.Add("DriverDirectory", _configinfo.DriverDirectory);
context.Add("FieldMappings", _configinfo.FieldMappings);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the code related to FieldMappings and _configinfo.FieldMappings, as it is no longer required.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot check for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the FieldMappings code from both WindowsStrategy and LinuxStrategy in commit 9807cec.

Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
@JusterZhu
Copy link
Collaborator

@copilot Adaption related to the driver directory is also required in GeneralUpdateBootstrap.
For example, the upstream and downstream components involved in the InitializeFromEnvironment method all need to be checked and adapted.

- Added DriverDirectory property to BaseConfigInfo (inherited by Configinfo and GlobalConfigInfo)
- Added DriverDirectory parameter to ProcessInfo constructor and as a JSON property
- Updated ConfigurationMapper to map DriverDirectory in MapToGlobalConfigInfo, MapToProcessInfo, and CopyBaseFields
- Updated InitializeFromEnvironment in GeneralUpdateBootstrap to read DriverDirectory from ProcessInfo
- This ensures DriverDirectory is properly propagated through the entire configuration pipeline

Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 11, 2026

@copilot Adaption related to the driver directory is also required in GeneralUpdateBootstrap.
For example, the upstream and downstream components involved in the InitializeFromEnvironment m...

Added DriverDirectory support throughout the configuration pipeline in commit a7ea9f2:

  • Added DriverDirectory to BaseConfigInfo (inherited by Configinfo and GlobalConfigInfo)
  • Added DriverDirectory to ProcessInfo with JSON serialization
  • Updated ConfigurationMapper to map DriverDirectory across all config classes
  • Updated InitializeFromEnvironment in GeneralUpdateBootstrap to read DriverDirectory from ProcessInfo environment variable

The driver directory is now properly propagated through the entire upstream and downstream configuration chain.

@JusterZhu
Copy link
Collaborator

@copilot GeneralUpdate.ClientCore also needs to be adapted for the driver directory field or related logic, because the parameters passed by the user come from GeneralUpdate.ClientCore and are then written into the ProcessInfo file. After that, GeneralUpdate.Core reads the parameters from ProcessInfo to complete the remaining logic. Please clarify this execution flow and carry out the overall adaptation based on this flow.

Copy link
Contributor Author

Copilot AI commented Feb 11, 2026

@copilot GeneralUpdate.ClientCore also needs to be adapted for the driver directory field or related logic, because the parameters passed by the user come from GeneralUpdate.ClientCore and are then wr...

The DriverDirectory field is already fully integrated throughout the entire configuration pipeline (completed in commit a7ea9f2). Here's the complete execution flow:

Flow from GeneralUpdate.ClientCore to GeneralUpdate.Core:

  1. User Configuration → User sets DriverDirectory in Configinfo when calling SetConfig()
  2. ClientCore ProcessingGeneralClientBootstrap.SetConfig() calls ConfigurationMapper.MapToGlobalConfigInfo() which copies DriverDirectory to GlobalConfigInfo
  3. ProcessInfo CreationGeneralClientBootstrap.ExecuteWorkflowAsync() calls ConfigurationMapper.MapToProcessInfo() at line 182, which includes source.DriverDirectory parameter
  4. Serialization → ProcessInfo is serialized to JSON and stored in environment variable (lines 189-190)
  5. Inter-Process Transfer → Strategy classes set the ProcessInfo environment variable before launching GeneralUpdate.Core
  6. Core DeserializationGeneralUpdateBootstrap.InitializeFromEnvironment() deserializes ProcessInfo JSON and sets _configInfo.DriverDirectory (line 225)
  7. Pipeline Context → WindowsStrategy/LinuxStrategy add DriverDirectory to PipelineContext (line 24)
  8. Middleware Execution → DrivelutionMiddleware retrieves DriverDirectory from context and uses it

All components (BaseConfigInfo, Configinfo, GlobalConfigInfo, ProcessInfo, ConfigurationMapper) have been updated to support DriverDirectory. Verified with successful builds of Common, ClientCore, and Core modules.

@JusterZhu JusterZhu marked this pull request as ready for review February 11, 2026 14:24
Copilot AI review requested due to automatic review settings February 11, 2026 14:24
@JusterZhu JusterZhu merged commit d28a602 into master Feb 11, 2026
3 checks passed
@JusterZhu JusterZhu deleted the copilot/add-driver-update-functionality branch February 11, 2026 14:25
Copy link
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 adds driver update functionality to GeneralUpdate.Core by integrating the Drivelution component for Windows and Linux driver management.

Changes:

  • Added multi-target framework support (netstandard2.0 and net8.0) to enable conditional Drivelution integration
  • Implemented DriverDirectory configuration field throughout the entire configuration pipeline (BaseConfigInfo → Configinfo → GlobalConfigInfo → ProcessInfo → PipelineContext)
  • Created DrivelutionMiddleware to handle driver discovery and installation from the configured directory
  • Integrated the middleware into both Windows and Linux update strategies with conditional compilation for net8.0+ targets

Reviewed changes

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

Show a summary per file
File Description
GeneralUpdate.Core.csproj Added net8.0 target framework and conditional Drivelution project reference
BaseConfigInfo.cs Added DriverDirectory property to base configuration class
GlobalConfigInfo.cs Added DriverDirectory property with documentation
ConfigurationMapper.cs Updated all mapping methods to include DriverDirectory field
ProcessInfo.cs Added DriverDirectory parameter and property for inter-process communication
GeneralUpdateBootstrap.cs Updated environment initialization to read DriverDirectory from ProcessInfo
WindowsStrategy.cs Replaced DriverOutPut/FieldMappings with DriverDirectory and integrated DrivelutionMiddleware
LinuxStrategy.cs Replaced DriverOutPut/FieldMappings with DriverDirectory and integrated DrivelutionMiddleware
DrivelutionMiddleware.cs New middleware implementing driver discovery and update logic using Drivelution

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


if (string.IsNullOrWhiteSpace(driverDirectory))
{
GeneralTracer.Info("Driver directory not specified in context, skipping driver update.");
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The log message is misleading. If DriveEnabled is true but DriverDirectory is not set, this suggests a configuration error rather than an intentional skip. Consider changing the log level to Warn and clarifying that this is a configuration issue: 'Driver directory not configured despite driver updates being enabled. Skipping driver update.'

Suggested change
GeneralTracer.Info("Driver directory not specified in context, skipping driver update.");
GeneralTracer.Warn("Driver directory not configured in context. This may indicate a configuration issue. Skipping driver update.");

Copilot uses AI. Check for mistakes.
@@ -23,19 +23,22 @@ protected override PipelineContext CreatePipelineContext(VersionInfo version, st
// Driver middleware (Windows-specific)
if (_configinfo.DriveEnabled == true)
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The DriverDirectory value is added to context without validation. Since DrivelutionMiddleware checks for null/empty values, consider either validating here before adding to context, or documenting that validation happens in the middleware. This would make the data flow more explicit and avoid adding potentially invalid values to the context.

Suggested change
if (_configinfo.DriveEnabled == true)
if (_configinfo.DriveEnabled == true && !string.IsNullOrWhiteSpace(_configinfo.DriverDirectory))

Copilot uses AI. Check for mistakes.
@@ -21,19 +21,22 @@ protected override PipelineContext CreatePipelineContext(VersionInfo version, st
// Driver middleware (Linux-specific)
if (_configinfo.DriveEnabled == true)
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The DriverDirectory value is added to context without validation. Since DrivelutionMiddleware checks for null/empty values, consider either validating here before adding to context, or documenting that validation happens in the middleware. This would make the data flow more explicit and avoid adding potentially invalid values to the context.

Suggested change
if (_configinfo.DriveEnabled == true)
if (_configinfo.DriveEnabled == true && !string.IsNullOrWhiteSpace(_configinfo.DriverDirectory))

Copilot uses AI. Check for mistakes.
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.

Add driver update functionality to GeneralUpdate.Core

2 participants