Skip to content

Convert the last bounded test handshake to an awaited signal - #2010

Merged
Aaronontheweb merged 1 commit into
fix/approval-text-match-orderfrom
chore/test-sync-over-async
Aug 19, 2026
Merged

Convert the last bounded test handshake to an awaited signal#2010
Aaronontheweb merged 1 commit into
fix/approval-text-match-orderfrom
chore/test-sync-over-async

Conversation

@Aaronontheweb

@Aaronontheweb Aaronontheweb commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

What

PR 8 of the stack. Result of a full audit of sync-over-async patterns across every test project, per the maintainer directive that TestKit assertions and test orchestration must never block threads (sync-over-async is the root mechanism behind the recent Windows CI dispatch-starvation flakes).

Audit result: the suites were already async-clean. Verified:

  • 0 sync TestKit assertion calls (ExpectMsg/AwaitAssert/ExpectNoMsg/Within/… — all usage is the *Async variants)
  • 43/43 .Result hits are record/DTO properties named Result (FunctionResultContent.Result, ToolCompletedUpdate.Result, …), not Task.Result
  • 3/5 Thread.Sleep hits are comment or test-data text

One genuine conversion (this PR's diff): InitExistingInstallViewModelTests.Dispose_WhileDeleteIsRunning_CancelsCompletionNavigation — a bounded ManualResetEventSlim.Wait(10s) handshake becomes an unbounded TaskCompletionSource await governed by the test cancellation token. No assertion depends on scheduling latency.

Deliberate holdouts, each with a recorded reason:

  • WebhookRouteStoreTests (5 MRES hits): superseded — the webhook-route-actor-ownership OpenSpec change replaces those tests with actor message-order tests
  • DaemonClientReconnectTests:227: the synchronous block is the behavior under test (proves a blocking IObservable subscriber cannot stall the async pump)
  • DisposableTempDir.Dispose retry: sync IDisposable constraint; needs an IAsyncDisposable migration across all call sites — follow-up pass

Verification

Full solution build 0 warnings; Netclaw.Cli.Tests 1,370/0; slopwatch 0 issues; headers clean.

Stack

Base: fix/approval-text-match-order (#2008).

@Aaronontheweb Aaronontheweb added the cleanup Code quality improvements and tech debt reduction label Aug 19, 2026
@Aaronontheweb
Aaronontheweb force-pushed the chore/test-sync-over-async branch from a0f2dfd to c1a9454 Compare August 19, 2026 02:52
@Aaronontheweb
Aaronontheweb force-pushed the chore/test-sync-over-async branch from c1a9454 to a0f2dfd Compare August 19, 2026 03:39
@Aaronontheweb
Aaronontheweb marked this pull request as ready for review August 19, 2026 06:23
@Aaronontheweb
Aaronontheweb force-pushed the chore/test-sync-over-async branch 3 times, most recently from 07143b0 to 6e832d4 Compare August 19, 2026 15:13

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LGTM - just a simple test fix to eliminate sync-over-async

@Aaronontheweb
Aaronontheweb force-pushed the chore/test-sync-over-async branch from 6e832d4 to 1aea355 Compare August 19, 2026 15:21
An audit of all sync-over-async patterns in the test suites (43 .Result
hits, 7 ManualResetEventSlim, 5 Thread.Sleep) found the suites already
async-clean: every .Result is a record property, not a blocked task,
and the TestKit layer uses only Task-returning assertions.

One genuine conversion remained: InitExistingInstallViewModelTests used
a bounded ManualResetEventSlim handshake. It now awaits an unbounded
TaskCompletionSource governed by the test cancellation token.

Deliberate holdouts, each with a recorded reason: the
WebhookRouteStoreTests choreography (superseded by the
webhook-route-actor-ownership change), the DaemonClientReconnectTests
blocking subscriber (the block is the behavior under test), and
DisposableTempDir's Dispose retry (needs an IAsyncDisposable pass).
@Aaronontheweb
Aaronontheweb force-pushed the chore/test-sync-over-async branch from 1aea355 to 3d07182 Compare August 19, 2026 16:41
@Aaronontheweb
Aaronontheweb merged commit 95e9567 into dev Aug 19, 2026
23 checks passed
@Aaronontheweb
Aaronontheweb deleted the chore/test-sync-over-async branch August 19, 2026 18:06
@Aaronontheweb Aaronontheweb added the tests All issues related to testing, quality assurance, and smoke testing. label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code quality improvements and tech debt reduction tests All issues related to testing, quality assurance, and smoke testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant