Skip to content

Batch 2: Wire IUpdateHooks and IUpdateReporter into strategy flows#364

Merged
JusterZhu merged 1 commit into
masterfrom
batch-2-hooks-reporter
May 24, 2026
Merged

Batch 2: Wire IUpdateHooks and IUpdateReporter into strategy flows#364
JusterZhu merged 1 commit into
masterfrom
batch-2-hooks-reporter

Conversation

@JusterZhu
Copy link
Copy Markdown
Collaborator

Summary

Wires the existing IUpdateHooks and IUpdateReporter interfaces into the three strategy flows (Client/Upgrade/OSS).

Changes

GeneralUpdateBootstrap

  • Resolve hooks and reporter from extensions in LaunchWithStrategy
  • Inject both into Client, Upgrade, and OSS strategies

ClientUpdateStrategy

  • OnBeforeUpdateAsync — after version validation, before download (return false = cancel)
  • OnBeforeStartAppAsync — before launching upgrade process
  • OnUpdateErrorAsync — in catch blocks
  • Report UpdateStarted / DownloadCompleted / UpdateFailed

UpgradeUpdateStrategy

  • OnBeforeUpdateAsync — before applying pipeline
  • OnAfterUpdateAsync — after pipeline completes
  • OnBeforeStartAppAsync — before starting main app
  • OnUpdateErrorAsync — in catch blocks
  • Report UpdateApplied / UpdateFailed

OSSUpdateStrategy

  • OnBeforeUpdateAsync — before download
  • OnBeforeStartAppAsync — before starting main app
  • OnUpdateErrorAsync — in catch blocks
  • Report UpdateStarted / UpdateApplied / UpdateFailed

All hook/reporter calls use safe wrappers that log and swallow exceptions to prevent hooks from breaking the update flow.

Build

  • dotnet build src/c#/GeneralUpdate.slnx — 0 errors

Closes #363

- Resolve hooks and reporter in GeneralUpdateBootstrap.LaunchWithStrategy
  and inject into all three strategies (Client/Upgrade/OSS)
- ClientUpdateStrategy: call hooks at key lifecycle points:
  OnBeforeUpdateAsync (can cancel), OnBeforeStartAppAsync, OnUpdateErrorAsync
  Report UpdateStarted, DownloadCompleted, UpdateFailed
- UpgradeUpdateStrategy: call hooks at key lifecycle points:
  OnBeforeUpdateAsync, OnAfterUpdateAsync, OnBeforeStartAppAsync, OnUpdateErrorAsync
  Report UpdateApplied, UpdateFailed
- OSSUpdateStrategy: call hooks at key lifecycle points:
  OnBeforeUpdateAsync, OnBeforeStartAppAsync, OnUpdateErrorAsync
  Report UpdateStarted, UpdateApplied, UpdateFailed
- All hook/reporter calls use safe wrappers that log and swallow
  exceptions to prevent hooks from breaking the update flow

Closes #363
Copilot AI review requested due to automatic review settings May 24, 2026 10:02
@JusterZhu JusterZhu merged commit 1c26de8 into master May 24, 2026
1 check failed
@JusterZhu JusterZhu deleted the batch-2-hooks-reporter branch May 24, 2026 10:03
@JusterZhu JusterZhu review requested due to automatic review settings May 24, 2026 10:25
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.

Batch 2: Wire IUpdateHooks and IUpdateReporter into strategy flows

1 participant