Skip to content

fix: silent update - manifest identity fields and upgrade process launch#483

Merged
JusterZhu merged 1 commit into
masterfrom
fix/silent-update
Jun 1, 2026
Merged

fix: silent update - manifest identity fields and upgrade process launch#483
JusterZhu merged 1 commit into
masterfrom
fix/silent-update

Conversation

@JusterZhu

Copy link
Copy Markdown
Collaborator

Summary

Three fixes for the silent update flow discovered during end-to-end testing.

1. AppMetadataDiscoverer: manifest identity fields now take precedence over defaults

Problem: MainAppName, UpdateAppName, UpdatePath, ClientVersion have non-empty defaults ("Client", "Update.exe", null, "1.0.0.0") in UpdateConfiguration. The old Discover() logic only filled empty fields from the manifest, so these defaults blocked manifest values. This caused three bugs:

  • Endless update loop: After WriteBackClientVersion updates the manifest to v2.0.0.0, the default "1.0.0.0" blocks it from being read back on restart → client re-downloads the same update forever
  • Can't find main app: Default "Client" blocks manifest's "ClientTest.exe" → upgrade process can't restart the application
  • Can't launch upgrade: Default "Update.exe" blocks manifest's "UpgradeTest.exe"

Fix: These four identity fields now unconditionally take manifest values when the manifest has them. The defaults are mere fallbacks, not explicit user choices.

2. SilentPollOrchestrator: explicit upgrade launch for console apps

Problem: AppDomain.ProcessExit does not fire reliably in console applications terminated via Ctrl+C, so the upgrade process was never launched.

Fix: Added TryLaunchUpgrade() and HasPreparedUpdate public members. Callers can invoke TryLaunchUpgrade() explicitly before process exit. The built-in _updaterStarted guard prevents double-launch if ProcessExit also fires.

3. GeneralUpdateBootstrap: expose orchestrator to callers

Added SilentOrchestrator property so callers can access the orchestrator after LaunchAsync() returns in silent mode.

Files Changed

File Change
src/c#/GeneralUpdate.Core/Configuration/AppMetadataDiscoverer.cs Identity fields unconditionally from manifest
src/c#/GeneralUpdate.Core/Silent/SilentPollOrchestrator.cs TryLaunchUpgrade(), HasPreparedUpdate
src/c#/GeneralUpdate.Core/Bootstrap/GeneralUpdateBootstrap.cs SilentOrchestrator property
tests/ClientTest/Program.cs Silent mode, keep-alive, explicit launch on exit
tests/ClientTest/ClientTest.csproj Manifest copy + post-build copy UpgradeTest
tests/ClientTest/generalupdate.manifest.json Sample identity manifest (NEW)

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Three fixes for the silent update flow:

1. AppMetadataDiscoverer: MainAppName, UpdateAppName, UpdatePath, ClientVersion
   now unconditionally take manifest values. Previously these fields had defaults
   ('Client', 'Update.exe', null, '1.0.0.0') that blocked manifest overrides,
   causing: wrong executable names, endless update loops after version write-back.

2. SilentPollOrchestrator: add TryLaunchUpgrade() and HasPreparedUpdate for
   explicit upgrade process launch. AppDomain.ProcessExit does not fire reliably
   in console apps (Ctrl+C), so callers can now trigger the launch explicitly.

3. GeneralUpdateBootstrap: expose SilentOrchestrator property so callers can
   access the orchestrator to call TryLaunchUpgrade().

Test infrastructure:
- ClientTest: enable silent mode, keep-alive loop, explicit launch on exit
- ClientTest.csproj: copy manifest + UpgradeTest output for test environment
- generalupdate.manifest.json: sample identity manifest for ClientTest

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 1, 2026 11:07
@JusterZhu JusterZhu self-assigned this Jun 1, 2026
@JusterZhu JusterZhu added the fix Fix some existing issues label Jun 1, 2026
@JusterZhu JusterZhu merged commit b8a7cef into master Jun 1, 2026
3 of 4 checks passed
@JusterZhu JusterZhu deleted the fix/silent-update branch June 1, 2026 11:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Labels

fix Fix some existing issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silent update: ProcessExit not firing, manifest identity fields blocked by defaults

2 participants