Skip to content

test(webkit/window): guard the mock window's fields with a mutex - #47

Merged
Snider merged 1 commit into
mainfrom
fix/window-mock-race
Aug 8, 2026
Merged

test(webkit/window): guard the mock window's fields with a mutex#47
Snider merged 1 commit into
mainfrom
fix/window-mock-race

Conversation

@Snider

@Snider Snider commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

The data race go test -race ./display/webkit/pkg/window/ reports on main is in the test double, not production code. mockWindow.ExecJS appended to execJSCalls unguarded while the test's goroutine read the same slice.

Fix

  • one mutex per mock window, covering every field
  • reads go through a new execJSCallsSnapshot() accessor
  • emit / emitFileDrop copy the handler slice outside the lock, so a handler that re-enters the mock cannot deadlock

Receipt

GOWORK=off go test -race -count=5 ./display/webkit/pkg/window/
WARNING: DATA RACE
before (main@95593e4) 2
after 0 — ok dappco.re/go/render/display/webkit/pkg/window 2.150s

🤖 Generated with Claude Code
Co-Authored-By: Virgil virgil@lethean.io

The data race was in the test double, not production. mockWindow.ExecJS
appended to execJSCalls with no lock while the test's own goroutine read
the same slice, so `go test -race` on display/webkit/pkg/window reported
two races on main.

Every mockWindow field now sits behind one mutex, reads go through an
execJSCallsSnapshot() accessor, and emit/emitFileDrop copy the handler
slice outside the lock so a handler that re-enters the mock cannot
deadlock.

Receipt: GOWORK=off go test -race -count=5 ./display/webkit/pkg/window/
  before: 2 × "WARNING: DATA RACE"
  after:  0 races, ok 2.150s

Co-Authored-By: Virgil <virgil@lethean.io>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Snider, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 03254c3f-6f3d-402a-9f42-e6ada205c5d8

📥 Commits

Reviewing files that changed from the base of the PR and between 95593e4 and 8672024.

📒 Files selected for processing (2)
  • go/display/webkit/pkg/window/mock_test.go
  • go/display/webkit/pkg/window/service_test.go

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Snider
Snider merged commit 0d5633b into main Aug 8, 2026
2 checks passed
@Snider
Snider deleted the fix/window-mock-race branch August 8, 2026 09:04
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