Gap fill v2: enums, type safety, Hub wiring, CI#389
Merged
Conversation
Changes: - PlatformType: class -> enum (adds MacOS, Unknown) - AppType: class -> enum (Client, Upgrade, OSS name clean-up) - OssProvider: new enum (AliYun, AWS, MinIO, Tencent) - UpdateOptions: Platform/OssProvider use enum types (not int) - VersionService: Validate() takes AppType/PlatformType (not int) - HttpDownloadSource: uses AppType/PlatformType (not int) - IUpdateHooks/UpdateContext: AppType uses enum (not int) - IUpdateReporter/UpdateReport: AppType uses enum (not int) - ClientUpdateStrategy: add DownloadSource property for Hub injection - GeneralUpdateBootstrap: HubConfig -> HubDownloadSource wiring - CI: new ci.yml with build+test (win+ubuntu) + AOT verify dotnet build: 0 errors dotnet test: 79/80 pass (1 pre-existing BackupRestore issue) Closes #389
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens type safety across the update pipeline by replacing several const-int “enum classes” with real enums, propagating those types through configuration/options and network validation, and adds initial wiring for a SignalR Hub-based download source alongside a new multi-OS CI workflow.
Changes:
- Replaced integer-based role/platform/provider identifiers with
enumtypes (AppType,PlatformType, newOssProvider) and propagated them through options, hooks, reporting, download sources, and version validation APIs. - Added Hub download source wiring (bootstrap injection + strategy-level
DownloadSourceoverride point) to support push-based update asset discovery. - Introduced a new GitHub Actions CI workflow to build/test on Windows+Ubuntu and verify AOT publish.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/CoreTest/Hooks/HooksTests.cs | Updates hook tests to use AppType enum in UpdateContext. |
| tests/CoreTest/Hooks/HooksIntegrationTests.cs | Updates integration tests to use AppType enum and asserts enum equality. |
| src/c#/GeneralUpdate.Core/Strategy/UpgradeUpdateStrategy.cs | Updates role documentation and UpdateContext construction to use AppType.Upgrade. |
| src/c#/GeneralUpdate.Core/Strategy/OSSUpdateStrategy.cs | Updates UpdateContext construction to use AppType.OSS. |
| src/c#/GeneralUpdate.Core/Strategy/ClientUpdateStrategy.cs | Adds injectable DownloadSource, uses it when present, and changes platform detection return type to PlatformType. |
| src/c#/GeneralUpdate.Core/Silent/SilentPollOrchestrator.cs | Changes platform detection return type to PlatformType. |
| src/c#/GeneralUpdate.Core/Network/VersionService.cs | Updates Validate signature to accept AppType/PlatformType and casts internally to the existing int-based request payload. |
| src/c#/GeneralUpdate.Core/Hooks/IUpdateHooks.cs | Updates UpdateContext.AppType to be strongly typed (Configuration.AppType). |
| src/c#/GeneralUpdate.Core/Download/Sources/HttpDownloadSource.cs | Updates to accept/store PlatformType and use new enum-based VersionService.Validate. |
| src/c#/GeneralUpdate.Core/Download/Reporting/IUpdateReporter.cs | Makes UpdateReport.AppType strongly typed (AppType). |
| src/c#/GeneralUpdate.Core/Configuration/UpdateOptions.cs | Switches option types to AppType, PlatformType?, OssProvider?. |
| src/c#/GeneralUpdate.Core/Configuration/PlatformType.cs | Converts PlatformType from const-int class to enum (adds Unknown + MacOS). |
| src/c#/GeneralUpdate.Core/Configuration/OssProvider.cs | Adds new OssProvider enum. |
| src/c#/GeneralUpdate.Core/Configuration/AppType.cs | Converts AppType from const-int class to enum (Client, Upgrade, OSS). |
| src/c#/GeneralUpdate.Core/Bootstrap/GeneralUpdateBootstrap.cs | Updates role selection to enum and injects HubDownloadSource when Hub config is set. |
| .github/workflows/ci.yml | Adds CI workflow for build/test on Windows+Ubuntu + AOT publish verification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+97
to
+103
| // Inject SignalR Hub download source if configured | ||
| var hubConfig = GetOption(UpdateOptions.Hub); | ||
| if (hubConfig != null && !string.IsNullOrEmpty(hubConfig.Url)) | ||
| { | ||
| clientStrat.DownloadSource = new Download.Sources.HubDownloadSource( | ||
| hubConfig.Url, GetOption(UpdateOptions.Token), GetOption(UpdateOptions.AppSecretKey)); | ||
| GeneralTracer.Info("GeneralUpdateBootstrap: HubDownloadSource injected from HubConfig."); |
| private static PlatformType GetPlatform() | ||
| { | ||
| if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return PlatformType.Windows; | ||
| if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return PlatformType.Linux; |
| private static PlatformType GetPlatform() | ||
| { | ||
| if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return PlatformType.Windows; | ||
| if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return PlatformType.Linux; |
Comment on lines
+32
to
+36
| run: dotnet test ./src/c#/GeneralUpdate.slnx -c Release --no-build --filter "FullyQualifiedName!~ConfiginfoBuilderTests" | ||
|
|
||
| - name: Test (Ubuntu) | ||
| if: runner.os == 'Linux' | ||
| run: dotnet test ./src/c#/GeneralUpdate.slnx -c Release --no-build --filter "FullyQualifiedName!~ConfiginfoBuilderTests&FullyQualifiedName!~BowlTest" |
| @@ -55,11 +55,11 @@ public static Task Report(string url, int recordId, int status, int? type, | |||
| } | |||
|
|
|||
| public static Task<VersionRespDTO> Validate(string url, string version, | |||
| public Hooks.IUpdateHooks Hooks { get; set; } = new Hooks.NoOpUpdateHooks(); | ||
| /// <summary>Update status reporter injected by the bootstrap.</summary> | ||
| public Download.Reporting.IUpdateReporter Reporter { get; set; } = new Download.Reporting.NoOpUpdateReporter(); | ||
| /// <summary>Download source (e.g., HTTP, SignalR Hub). Override via <c>.DownloadSource<T>()</c>.</summary> |
…eanup - HubDownloadSource: call StartAsync() on injection, dispose in finally - GetPlatform(): add OSPlatform.OSX -> PlatformType.MacOS in both locations - VersionService.Validate: keep int overload for backward binary compat - ClientUpdateStrategy: DownloadSource resolved from extension registry + comment fix - SharedMemoryProvider: catch broader exceptions on Linux (non-Windows MMF) - CI: document ConfiginfoBuilderTests exclusion rationale
- Deleted: Configinfo.cs, ConfiginfoBuilder.cs, ConfiginfoBuilder-Example.cs - Bootstrap: SetConfig(Configinfo) -> SyncConfigFromOptions() (from UpdateOptions) - ConfigurationMapper: removed MapToGlobalConfigInfo(), kept MapToProcessInfo() - Deleted tests: ConfiginfoBuilderTests.cs (API no longer exists) - User config now exclusively via .Option() on GeneralUpdateBootstrap Build: 0 errors, 0 warnings
This reverts commit 7a856fa.
This reverts commit c38efdd.
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.
Summary
Second pass — fills architectural gaps from deep-dive analysis: enum type safety, Hub wiring, CI.
Changes
Enums — type-safe enums replace const-int classes:
PlatformType: class → enum{ Unknown=0, Windows=1, Linux=2, MacOS=3 }AppType: class → enum{ Client=1, Upgrade=2, OSS=3 }OssProvider: new enum{ AliYun=1, AWS=2, MinIO=3, Tencent=4 }Type safety propagation:
UpdateOptions.Platform:int?→PlatformType?UpdateOptions.AppType:int→AppTypeUpdateOptions.OssProvider:int?→OssProvider?VersionService.Validate(): parameters →AppType/PlatformTypeHttpDownloadSource: constructor/field →PlatformTypeIUpdateHooks.UpdateContext:int AppType→AppType AppTypeIUpdateReporter.UpdateReport:int AppType→AppType AppTypeGetPlatform(): return typeint→PlatformTypeeverywhereSignalR Hub wiring:
ClientUpdateStrategy: addedDownloadSourceproperty for injectionGeneralUpdateBootstrap: auto-createsHubDownloadSourcewhenUpdateOptions.Hubis configuredCI:
ci.ymlworkflow: build + test on windows/ubuntu + AOT publish verificationBuild + Tests
dotnet build— 0 errorsdotnet test CoreTest— 79/80 pass (1 pre-existing BackupRestore issue)Closes #389