Skip to content

test(ui/di): stop the trend feed before the cleanup - #25

Merged
mrcsin merged 1 commit into
masterfrom
test-feed-cleanup
Nov 17, 2026
Merged

mrcsin merged 1 commit into
masterfrom
test-feed-cleanup

Conversation

@mrcsin

@mrcsin mrcsin commented Nov 17, 2026

Copy link
Copy Markdown
Member

Problem

AppLifecycleTrendTests.TheTrendShowsTheStoredPointsAfterARestart failed in about one full test run in four to six. The test's assertions passed, and the failure came from its cleanup:

System.IO.IOException : The process cannot access the file 'spectra.db' because it is being used by another process.
   at SemiSpec.Tests.Unit.TempFolder.Dispose()
   at SemiSpec.Tests.Unit.UI.Di.AppLifecycleTestBase.DisposeAsync()

The restarted app reads the stored day from spectra.db in hour chunks in the background. The test returns once its points land. The cleanup stopped only the spectrum store before it deleted the temp folder, while a trend read still held a reader connection. SqliteConnection.ClearAllPools cannot close a connection that is in use.

The app is not affected: its close awaits TrendFeed.StopAsync, which waits for the reads, before it stops the store.

Change

  • AppLifecycleTestBase and CompositionRootTests now record each container's TrendFeed. Their cleanup awaits TrendFeed.StopAsync() before the store's stop, the same order as the app's close.
  • Test code only.

Verification

  • Before the change: 1 failure in 6 full runs, and 2 to 3 failures in 6 to 8 runs on earlier probes of master.
  • After the change: 8 of 8 full runs passed, with --blame-hang and no hang. At the old rate there was about a 1-in-6 chance of 8 passes in a row anyway, so this is strong evidence, not proof.
  • CompositionRootTests.TheAppBuildsTheMainWindowFromTheProvider uses the same setup and gets the same cleanup. Its own failure text was never captured, so the shared cause is likely but unconfirmed.
  • dotnet format --verify-no-changes and terse on the changed files: exit 0.
Per-task commits before collapse
8dface1 test(ui/di): stop the trend feed before the cleanup

🤖 Generated with Claude Code

TheTrendShowsTheStoredPointsAfterARestart failed in about one full run
in four with "The process cannot access the file 'spectra.db'" from
TempFolder.Dispose. The restarted app reads the stored day in hour
chunks in the background; the test returns once its points land, and
its cleanup stopped only the store before deleting the folder, while a
trend read still held a reader connection that ClearAllPools cannot
close.

Both container cleanups now await TrendFeed.StopAsync before the
store's stop, the order the app's own close follows, so no read holds
the file at the delete. Eight full runs passed after the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrcsin
mrcsin marked this pull request as ready for review November 17, 2026 08:37
@mrcsin
mrcsin merged commit f1a14e0 into master Nov 17, 2026
1 check passed
@mrcsin
mrcsin deleted the test-feed-cleanup branch November 17, 2026 08:41
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