Skip to content

fix(wpf): make navigation lifecycle-safe - #8

Merged
nicolasestrem merged 1 commit into
mainfrom
codex/wpf-lifecycle-navigation
Aug 11, 2026
Merged

nicolasestrem merged 1 commit into
mainfrom
codex/wpf-lifecycle-navigation

Conversation

@nicolasestrem

Copy link
Copy Markdown
Owner

What changed

  • Adds explicit Timeline and Advanced history destinations to the WPF command bar.
  • Cancels and clears an active comparison before user-driven navigation, including same-snapshot reopen flows.
  • Disables workspace navigation while backup or restore work is active.
  • Prevents the last WPF window from closing during an active run and explains how to exit safely.
  • Reads the Advanced history catalog away from the UI thread and marshals collection updates back to its dispatcher.
  • Extends async commands with external availability checks and adds focused lifecycle regression tests.

Why

The WPF shell could trap users in Compare, hide an active progress workspace behind Settings or About, and terminate a running operation when the sole window closed. Advanced history also existed without a route and performed its catalog read on the UI thread.

Impact

Navigation now preserves operation visibility and comparison ownership. The active-run close guard prevents accidental termination while keeping normal close behavior unchanged. Advanced history is reachable without blocking rendering on catalog I/O.

This is a stacked draft based on feat/wpf-timeline-shell and should be reviewed after PR #7. It does not merge or modify PR #7.

Validation

  • dotnet build src\WinRestoreKit.Tests\WinRestoreKit.Tests.csproj -c CodexVerify: 0 warnings, 0 errors
  • dotnet test src\WinRestoreKit.Tests\WinRestoreKit.Tests.csproj -c CodexVerify --no-build: 990 passed, 0 failed
  • Focused WPF lifecycle suite: 16 passed, 0 failed
  • dotnet format ... --verify-no-changes --include <changed C# files>: 0 files require formatting
  • Added em dash scan: 0 matches

The isolated CodexVerify configuration was used because the user's active Debug session intentionally remained running and retained its executable lock.

@nicolasestrem
nicolasestrem marked this pull request as ready for review August 11, 2026 11:30
Base automatically changed from feat/wpf-timeline-shell to main August 11, 2026 11:31
@nicolasestrem
nicolasestrem merged commit f9dfeaa into main Aug 11, 2026
1 of 2 checks passed
@nicolasestrem
nicolasestrem deleted the codex/wpf-lifecycle-navigation branch August 11, 2026 11:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 482d407350

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +119 to +120
WorkflowLabel = "Run in progress";
OnPropertyChanged(nameof(WorkflowLabel));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the workflow label accurate after a blocked close

When a user attempts to close the window during a restore, this permanently replaces the current label with Run in progress. Unlike the backup path, ConfirmViewModel completes or cancels the restore without navigating to another workspace, so nothing restores the label after RunCoordinator becomes idle and the shell continues to describe a finished run as active. Avoid changing the workspace label here, or restore it when the run ends.

Useful? React with 👍 / 👎.

internal Task RefreshAsync(CancellationToken cancellationToken = default)
internal async Task RefreshAsync(CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Prevent stale history refreshes from winning

Because Advanced history is a shared view model and its view calls RefreshAsync on every Loaded, navigating away and back while this background catalog scan is still running starts another scan. There is no serialization or generation check, so a slower earlier read can reach ApplySnapshots after the newer read and overwrite the collection with stale filesystem state, as well as clear the user's newer selection. Cancel, serialize, or version refreshes so only the latest invocation applies its result.

Useful? React with 👍 / 👎.

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.

1 participant