Move WorkspaceApiTests to the worker-disabled factory so background workers cannot mutate seeded queue rows (#1418) - #1419
Conversation
…orkers cannot mutate seeded queue rows (#1418)
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Self-review (adversarial pass)Scope: single file, 8 insertions / 3 deletions — swap the class fixture from the worker-enabled base Existing comments inspected: gemini-code-assist (consumer bot sunset — no content), copilot-pull-request-reviewer (quota-limited, could not review). No actionable bot findings; no review-thread comments. Findings by severity: none.
Verification: No fixes required. |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
…eview proposal seeds, not Today_* seeds (#1418 review)
Fix evidence (lens-2 review)
All findings addressed; none skipped. |
Problem
WorkspaceApiTests.Home_ShouldReturnCurrentUserSummaryOnlyflakes under full-suite CPU contention.Root cause
WorkspaceApiTestsusedIClassFixture<TestWebApplicationFactory>— the worker-ENABLED base factory (UseEnvironment("Development"),Workers:EnableAutoQueueProcessingdefaults true,Workers:QueuePollIntervalSeconds=1). The test seeds a capture inRequestStatus.Processing. The liveLlmQueueToProposalWorkercapture lane (GetOldestProcessingCaptureAsync) claims exactly that row and mutates it to a terminal state. Under contention the worker's 1s poll occasionally lands before the test'sGET /api/workspace/home, flippingFailedCount1→2 and makingCapturesNeedingTriagereturn 3 instead of the expected 2.This is the exact failure mode documented in
HostedWorkerDisabledTestWebApplicationFactory's header comment (issue #1335).Fix
Move the class onto
HostedWorkerDisabledTestWebApplicationFactory, which removes all application background workers from the test host so no worker can pre-empt seeded queue rows. Three edit points inbackend/tests/Taskdeck.Api.Tests/WorkspaceApiTests.cs(class fixture, field type, constructor parameter), plus a class comment citing #1418/#1335.Not a product bug
GetCaptureSummaryByUserAsyncis correctly user-scoped — the aggregation itself is right. This is purely a test-harness isolation issue: the seededProcessingcapture was being claimed by a live worker mid-test. No test in the class depends on a live worker; every test sets statuses directly and asserts aggregation, and theToday_*seeds are likewise protected fromProposalHousekeepingWorker.Convention
Follows the issue #1335 isolation boundary: use the worker-disabled factory for any test that seeds state an app worker polls or mutates. Isolation lives in the fixture, not in
backend/src— production and every worker-dependent test class keep the workers via the base factory.Verification
dotnet test backend/Taskdeck.sln -c Release -m:1 --filter "FullyQualifiedName~WorkspaceApiTests"run twice:(The race is non-deterministic and won't repro reliably in isolation; these runs prove the factory swap breaks nothing.)
Closes #1418