Move scrape cancellation into MainWindowViewModel#18
Merged
astar-development-jb merged 1 commit intoJul 14, 2026
Conversation
Code-behind held a CancellationTokenSource but never touched the scrape work, which lives in the ViewModel. Move ownership there: CancelCommand (enabled only while a scrape is running) cancels the active run at checkpoints around confirmation and Playwright setup. Also subscribe each scrape command's ThrownExceptions - without it, ReactiveCommand.CreateFromTask swallows an unobserved exception and the command hangs forever instead of faulting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
astar-development-jb
enabled auto-merge (squash)
July 14, 2026 13:15
astar-development-jb
approved these changes
Jul 14, 2026
astar-development-jb
deleted the
feature/main-window-viewmodel-cancellation
branch
July 14, 2026 13:15
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
MainWindowViewModel(was previously wired to a deadCancellationTokenSourceinMainWindowcode-behind that never touched the ViewModel's work).IsBusydrivesCancelCommand.CanExecute; a per-runCancellationTokenSourceis checked before/after the confirm dialog and before Playwright configuration.MainWindowViewModelimplementsIDisposable, cancelling any in-flight run on teardown.ThrownExceptions, soReactiveCommand.CreateFromTaskwould swallow an unobserved exception and hang forever instead of faulting. Now routed toStatusText.OnScrapeClicked,OnCancelClicked,cts,IDisposable) fromMainWindow.axaml.cs.Test plan
GivenMainWindowViewModeltest class (6 tests: cancel enablement, cancellation before Playwright config, cancel resets IsBusy, successful completion, dispose cancels)dotnet buildclean, 0 warnings/errorsdotnet teston affected test project: 23/25 pass (2 pre-existing failures unrelated to this change - env-specific connection string test, flaky temp-dir cleanup race inGivenPlaywrightService)🤖 Generated with Claude Code